---
title: "Set pin"
method: POST
path: "/pws/pws_set_pin/"
tags: ["Card"]
---

# Set pin

`POST /pws/pws_set_pin/`

## Request

- Base URL: `https://api.uat.paymentology.com/ppws/api`
- URL: `https://api.uat.paymentology.com/ppws/api/pws/pws_set_pin/`
- Auth: none declared

This web service provides the ability to set the PIN for a card/token. An encrypted PIN (encrypted with client processing key (CP Key)) is required and needs to meet PIN criteria of strength i.e.

*   No simple number sequences like 1234, 0000
*   No repeated number like 1111,22222
*   Minimum length of 4 digit only
*   Maximum length of 12 digit only

### Epin Generation Java Example

    
    String cpkey="34df95e9ef7cd3f79c118022a7ef379c"; //CPkey is sent in email during client create
    String pin="5296";
    SecretKey secretKey = new SecretKeySpec(hexStringToByteArray(cpkey), "AES");
    Cipher cipher = Cipher.getInstance("AES/ECB/ZeroBytePadding",new BouncyCastleProvider());
    cipher.init(Cipher.ENCRYPT_MODE, secretKey);
    byte[] bytedata=cipher.doFinal(pin.getBytes());
    String epin=byteArrayToHexString(bytedata);
    
    //Function To Convert Hex String to Byte Array 
    public static byte[] hexStringToByteArray(String Hex) {   
    int len = Hex.length();       
    byte[] data = new byte[len / 2];      
    for(int i = 0; i < len; i += 2) {      
    data[i / 2] = (byte)((Character.digit(Hex.charAt(i), 16) << 4) + Character.digit(Hex.charAt(i + 1), 16));   
    }    
    return data;   
    }
    
    //Function To Convert Byte Array to Hex String 
    public static String byteArrayToHexString(byte[] bytes) {   
    char[] hexChars = new char[bytes.length * 2];   
    for(int j = 0; j < bytes.length; ++j) {   
    int v = bytes[j] AND 255;    
    hexChars[j * 2] = hexArray[v >>> 4];    
    hexChars[j * 2 + 1] = hexArray[v AND 15];     
    }      
    return new String(hexChars);  
    }

## Request body

- SetPinModel: This web service allows to set pin for a card/token. client should pass encrypted pin (with cp key) to api.
  - `api_call_unique_identifier` string, required: Unique number that must be passed at each API request. Identifier to make each API request unique
  - `client_id` integer, required: Unique identifier for the client which Paymentology will provide at outset
  - `epin` string, required: AES Encrypted pin with client processing key
  - `token` integer, required: Public token for the card
  - `user_id` string: User Id of the Customer who triggered the API request.
  - `remarks` string: Remarks for API request

## Response `200`

Successful Response

- SetPinResponse: This model contains response details when we call set pin api
  - `header` SetPinHeader
    - `error_id` integer: error id
    - `error_desc` string: error message
  - `body` SetPinBody
    - `message` string: message

## Other responses

- `404`: Webservices does not exist
- `500`: Internal Server error

## Changes

- **2026-11-03** `73c2771493b1`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/paymentology/apis/payapi-docs/changes/pws/pws_set_pin/post.md)

---

[API](https://skmtc.dev/paymentology/apis/payapi-docs.md) - [All operations](https://skmtc.dev/paymentology/apis/payapi-docs/llms.txt) - [OpenAPI document](https://skmtc.dev/paymentology/apis/payapi-docs/revisions/73c2771493b1?raw)
