bri-direct-debit-get-token-list-sample
After the card is registered, you can show the token saved for your customer. This API also used to list down all the registered card, so that your customer does not need to register the card for the future payments.
To get the token list, you will to hit this API from your Backend:
API Request
Type | Value |
---|---|
HTTP Method | POST |
API endpoint (Sandbox) | https://api-sandbox.doku.com/direct-debit/v1/tokens |
API endpoint (Production) | https://api.doku.com/direct-debit/v1/tokens |
Here is the sample of request header to get the token list:
Client-Id: MCH-0001-10791114622547
Request-Id: 415f8064-ce1c-4c94-84b8-167201fd47cb
Request-Timestamp: 2020-08-11T08:45:42Z
Signature: HMACSHA256=vl9DBTX5KhEiXmnpOD0TSm8PYQknuHPdyHSTSc3W6Ps=
Request Header Explanation
Parameter | Description |
---|---|
Client-Id | Client ID retrieved from DOKU Back Office |
Request-Id | Unique random string (max 128 characters) generated from merchant side to protect duplicate request |
Request-Timestamp | Timestamp request on UTC time in ISO8601 UTC+0 format. It means to proceed transaction on UTC+7 (WIB), merchant need to subtract time with 7. Ex: to proceed transaction on September 22th 2020 at 08:51:00 WIB, the timestamp should be 2020-09-22T01:51:00Z |
Signature | Security parameter that needs to be generated on merchant Backend and placed to the header request to ensure that the request is coming from valid merchant. Please refer to this section to generate the signature |
Here is the sample of request body to get the token list:
{
"customer": {
"id":"CUST-0001",
"name": "Anton Budiman"
}
}
Request Body Explanation
Parameter | Type | Mandatory | Description |
---|---|---|---|
customer.id | string | Mandatory | The customer ID that has been registered to DOKU Allowed chars: alphabetic, numeric, special chars Max Length: 50 |
customer.name | string | Optional | The customer name that has been registered to DOKU Allowed chars: alphabetic Max Length: 70 |
API Response
After hitting the above API request, DOKU will give the response.
Type | Value |
---|---|
HTTP Status | 200 |
Result | SUCCESS |
Here is the sample response header:
Client-Id: MCH-0001-10791114622547
Request-Id: 415f8064-ce1c-4c94-84b8-167201fd47cb
Response-Timestamp: 2020-08-11T08:45:42Z
Signature: HMACSHA256=1jap2tpgvWt83tG4J7IhEwUrwmMt71OaIk0oL0e6sPM=
Response Header Explanation
Parameter | Description |
---|---|
Client-Id | Same as the request |
Request-Id | Same as the request |
Response-Timestamp | Timestamp Response on UTC with format ISO8601 UTC+0 from DOKU |
Signature | Signature generated by DOKU based on the response body |
Here is the sample of response body:
[
{
"customer": {
"id": "CUST-0001",
"name": "Anton Budiman",
},
"debit_card": {
"token_id": "243591d7e49f45109961581718c3ef82",
"card_last_four": "8224"
}
}
]
Response Body Explanation
Parameter | Type | Mandatory | Description |
---|---|---|---|
customer.id | string | Mandatory | Same as the request |
customer.name | string | Optional | Same as the request |
debit_card.token_id | string | Mandatory | Token generated by DOKU for the Debit card to use when do payment Max length: 128 |
debit_card.card_last_four | string | Mandatory | Last 4 digit of the Debit Card number |