Skip to main content

bri-direct-debit-recurring

To create the recurring payment, you will need to hit this API through your Backend:

API Request

TypeValue
HTTP MethodPOST
API endpoint (Sandbox)https://api-sandbox.doku.com/direct-debit/v1/payment-recurring
API endpoint (Production)https://api.doku.com/direct-debit/v1/payment-recurring

Here is the sample of request header to create the recurring payment:

Client-Id: MCH-0001-10791114622547
Request-Id: b6a465ea-bb65-48b2-a22b-3e8fb51cf22e
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 create the recurring payment:

{
"customer": {
"id":"1232131321",
"name":"Jessica Tessalonika",
"email":"jessica@gmail.com",
"phone":"081287458232",
"id_card":"",
"country":"ID",
"address":"Jakarta, Menara Mulia Lt 8",
"date_of_birth":"08-09-1998",
"additional_info":""
},
"additional_info":{},
"order": {
"invoice_number":"MINV20201231468",
"line_items": [
{
"name": "bola",
"price": 10000,
"quantity": 1
},
{
"name": "ubi",
"price": 5000,
"quantity": 1
}
],
"amount": 15000,
"session_id":"session"
},
"payment": {
"token_id":"bcdbcdbcdbcbdbcdb-bcdbcd-bcdbcdb"
}
}
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
customer.emailstringOptionalCustomer email
Allowed chars: alphabetic, numeric, special chars
Max Length: 64
customer.phonestringOptionalCustomer phone number. Format: {calling_code}{phone_number}. Example: 6281122334455
Allowed chars: numeric
Max Length: 20
customer.addressstringOptionalCustomer address
Allowed chars: alphabetic, numeric, special chars
Max Length: 255
customer.countrystringOptional2 alphabetic country code ISO 3166-1
Allowed chars: alphabetic
Min-max Length: 60
customer.id_cardstringOptionalCustomer Identity Card number (KTP) for our risk engine assessment
Allowed chars: alphabetic, numeric, special chars
Max length: 20
customer.date_of_birthstringOptionalCustomer date of birth for our risk engine assesment
Format: dd-MM-yyyy
customer.additional_infostringOptionalCustomer additional info
additional_infostringOptionaladditional info
order.amountnumberMandatoryIn IDR Currency and without decimal
Allowed chars: numeric
Max length: 12
order.invoice_numberstringMandatoryGenerated by merchant to identify the order
Allowed chars: alphabetic, numeric, special chars
Max length: 64
order.line_items.namestringOptionalName of the product item
Allowed chars: alphabetic, numeric, special chars
order.line_items.pricenumberOptionalPrice of the product item. Total price and quantity must match with the order.amount
Allowed chars: numeric
order.line_items.quantitynumberOptionalQuantity of the product item
Allowed chars: numeric
order.session_idstringOptionalTransaction session id
payment.card_tokenstringMandatoryToken created from debit card data that linked to customer id (token id)

API Response

After hitting the above API request, DOKU will give the response.

TypeValue
HTTP Status201
ResultCREATED

Here is the sample response header:

Client-Id: MCH-0001-10791114622547
Request-Id: b6a465ea-bb65-48b2-a22b-3e8fb51cf22e
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:

{
"acquirer": {
"id":"BRI"
},
"customer": {
"id":"1232131321",
"name":"Jessica Tessalonika",
"email":"jessica@gmail.com",
"phone":"081287458232",
"id_card":"",
"country":"ID",
"address":"Jakarta, Menara Mulia Lt 8",
"date_of_birth":"",
"additional_info":""
},
"additional_info":{},
"order": {
"invoice_number":"MINV20201231468",
"line_items": [
{
"name": "bola",
"price": 10000,
"quantity": 1
},
{
"name": "ubi",
"price": 5000,
"quantity": 1
}
],
"amount": 15000,
"session_id":"session"
},
"payment": {
"payment_id":"123212313",
"token":"qweqweqwewqeqwdasdassad",
"status":"SUCCESS"
}
}
Response Body Explanation
ParameterTypeMandatoryDescription
acquirer.idstringMandatoryBank Acquirer
customer.idstringMandatorySame as the request
customer.namestringOptionalSame as the request
customer.emailstringOptionalSame as the request
customer.phonestringOptionalSame as the request
customer.addressstringOptionalSame as the request
customer.countrystringOptionalSame as the request
customer.id_cardstringOptionalSame as the request
customer.date_of_birthstringOptionalSame as the request
customer.additional_infostringOptionalSame as the request
additional_infostringOptionalSame as the request
order.amountnumberMandatorySame as the request
order.invoice_numberstringMandatorySame as the request
order.line_items.namestringOptionalSame as the request
order.line_items.pricenumberOptionalSame as the request
order.line_items.quantitynumberOptionalSame as the request
order.session_idstringOptionalTransaction session id
payment.payment_idstringMandatoryPayment ID generated by Acquirer
payment.tokenstringMandatoryPayment token generated by DOKU specific for the transaction
payment.statusstringMandatoryPayment status. In this state, it should be PENDING