Withdraw

The process of withdraw balance consists of three stages, namely withdrawal inquiry, withdrawal, and withdrawal status notification. In first stage, user must make a withdrawal inquiry to get a bank account, and balance can be withdrawn. Then second stage, make a withdrawal request, the amount allowed must match that in the withdrawal inquiry. At the withdrawal stage the status is still pending. Finally, notify withdraw, where the last withdrawal status will be sent to the endpoint that you have previously provided.

Withdraw Inquiry

POST https://tokoapi-stg.netzme.com/api/aggregator/merchant/qr/withdraw/inquiry

This endpoint allows merchant to inquiry bank account before withdraw.

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

userId*

string

contains merchantId

type*

string

value "withdraw_inquiry"

requestId*

string

format {{ClientId}}{{YYYYMMDDHHmmSS}}{{4 digit increments}} sample aggregator202103091003110001

{
    "requestId": "aggregator20210409144959687",
    "type": "withdraw_inquiry",
    "status": 100,
    "statusMessage": "success",
    "body": {
        "withdrawalAmount": "IDR 37995.00",
        "accountHolderName": "Christian Cain",
        "bankAccountNumber": "12345678",
        "bankName": "BANK BCA",
        "bankCode": "014",
        "amountAllowed": true
    }
}

Sample JSON Request :

{"requestId":"aggregator20210409144959687","type":"withdraw_inquiry","body":{"userId":"M_czBSCDVY"}}

Withdraw

POST https://tokoapi-stg.netzme.com/api/aggregator/merchant/qr/withdraw

This endpoint allows merchant to withdraw their balance.

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

userId*

string

merchant id

withdrawalAmount*

integer

closed amount, withdrawal amount value must be equals with response inquiry withdrawal

accountHolderName*

string

bankAccountNumber*

string

bankName*

string

bankCode*

string

pin*

string

hash pin enrich with client Id and merchant Id

type*

string

value "submit_withdraw"

requestId*

string

format {{ ClientId }}{{YYYYMMDDHHmmSS}}{{4 digit increments}} sample aggregator202103091003110001

{
    "requestId": "5f79801b-d4e2-4463-bde9-e0855b5745e9",
    "type": "submit_withdraw",
    "status": 101,
    "statusMessage": "pending",
    "body": {
        "customerReffNum": "20210309103858740544",
        "userId": "M_czBSCDVY",
        "withdrawalAmount": "IDR 37995.00",
        "accountHolderName": "Christian Cain",
        "bankAccountNumber": "12345678",
        "bankName": "BANK BCA",
        "bankCode": "014"
    }
}

Sample Json Body Request :

{"requestId":"aggregator20210409144959688","type":"submit_withdraw","body":{"userId":"M_czBSCDVY","withdrawalAmount":37995,"accountHolderName":"Christian Cain","bankAccountNumber":"123456789","bankName":"BANK BCA","bankCode":"014","pin":"d8bbeb69bebcfa2771eeaf8ba0b197ed591fe9b0b45eed2ccd67ded6f0ac52f7"}}

Sample code hashpin :

    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;
        }
    }

Withdraw Status Notification

After getting a pending response at the withdrawal stage, the final status will be sent to the withdrawal status notification endpoint that you have previously prepared.

Parameter

Data Type

Description

type

String

value "submit_withdraw"

amount

String

"IDR 37995.00"

status

Integer

final status withdrawal

statusMessage

String

description of status

requestId

String

customerReffNumber

String

Sample :

{
   "type":"submit_withdraw",
   "amount":"IDR 37995.00",
   "status":100,
   "statusMessage":"success",
   "requestId":"5f79801b-d4e2-4463-bde9-e0855b5745e9",
   "customerReffNumber":"20210309103858740544"
}

Status withdraw :

Status

Description

100

success

101

pending

404

pin not found, merchant must create first

201

invalid account number / invalid amount

204

invalid pin

301

invalid merchant id

205

different account number

203

generic error

Last updated