Skip to main content

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

TypeValue
HTTP MethodPOST
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
ParameterDescription
Client-IdClient ID retrieved from DOKU Back Office
Request-IdUnique random string (max 128 characters) generated from merchant side to protect duplicate request
Request-TimestampTimestamp 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
SignatureSecurity 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
ParameterTypeMandatoryDescription
customer.idstringMandatoryThe customer ID that has been registered to DOKU
Allowed chars: alphabetic, numeric, special chars
Max Length: 50
customer.namestringOptionalThe 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.

TypeValue
HTTP Status200
ResultSUCCESS

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
ParameterDescription
Client-IdSame as the request
Request-IdSame as the request
Response-TimestampTimestamp Response on UTC with format ISO8601 UTC+0 from DOKU
SignatureSignature 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
ParameterTypeMandatoryDescription
customer.idstringMandatorySame as the request
customer.namestringOptionalSame as the request
debit_card.token_idstringMandatoryToken generated by DOKU for the Debit card to use when do payment
Max length: 128
debit_card.card_last_fourstringMandatoryLast 4 digit of the Debit Card number