Create Pin

To ensure security in withdraw transaction, when request withdrawal are required to send a pin in the payload of the withdrawal request. Therefore the merchant must first create a pin before making a withdrawal.

Create Pin

POST https://tokoapi-stg.netzme.com/api/aggregator/merchant/pin/create_pin

Headers

NameTypeDescription

Content-Type*

string

application/json

Authorization*

string

See Authentication Page

Client-Id*

string

See Authentication Page

Request-Time*

string

See Authentication Page

Signature*

string

See Authentication Page

Request Body

NameTypeDescription

pin*

string

pin 6 digit numeric encrich with client id and merchant id

username*

string

merchant id

type*

string

value "create_pin"

requestId*

string

format {{ClientId}}{{YYYYMMDDHHmmss}}{{4 digit increments}} Sample : aggregator202103031542100001

{
    "requestId": "aggregator202103031542100001",
    "type": "create_pin",
    "status": "100",
    "statusMessage": "success",
    "body": {}
}

Sample JSON Request :

{"requestId":"aggregator20210420090452526","type":"create_pin","body":{"username":"M_czBSCDVY","pin":"8f9856af95b408b5d2cf8eb88c99d1abca114d0da3cf4e5d885011206c9a2c6e"}}

Sample Code Hash Pin :

    private void sampleGeneratePinHash() {
        String newPin = "123456";
        String merchantId = "M_czBSCDVY";
        String clientId = "aggregator-1";
        final String pinHash = pinHash(newPin, clientId, merchantId);
    }
    
    private String pinHash(String clearPin, String salt, String userName) {
        final String key = new StringBuilder()
                .append(salt)
                .append(userName).toString();
        return hmacSHA256(key, clearPin);
    }

    private String hmacSHA256(String salt, String bodyMessage) {
        try {
            Mac hmac256SHAInstance = Mac.getInstance("HmacSHA256");
            SecretKeySpec secret_key = new SecretKeySpec(salt.getBytes(StandardCharsets.UTF_8), "HmacSHA256");
            hmac256SHAInstance.init(secret_key);
            return Hex.encodeHexString(hmac256SHAInstance.doFinal(bodyMessage.getBytes(StandardCharsets.UTF_8)));
        } catch (Exception var4) {
            return null;
        }
    }

Last updated