Skip to main content

DOKU Wallet Guide

Integration steps

Here is the overview of how to integrate with DOKU Wallet:

  1. Obtain payment.url by generating order
  2. Display DOKU Wallet payment page to customer
  3. Acknowledge payment result
Direct API - DOKU Wallet Sequence Diagram
 Direct API - DOKU Wallet Merchant Flow

1. Obtain payment.url by generating order

To generate order, you will need to hit this API through your Backend:

API Request

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

Here is the sample of request header to generate order:

Client-Id: MCH-0001-10791114622547
Request-Id: baec7d95-f30a-4b78-b711-6ebe0ccdf50b
Request-Timestamp: 2021-07-07T08: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 request body to generate order:

{
"order": {
"invoice_number":"TEST-1234",
"amount": 9000,
"line_items": [
{
"name": "T-Shirt Red",
"price": 3000,
"quantity": 2
},
{
"name": "Polo Navy",
"price": 3000,
"quantity": 1
}
],
"success_url": "https://www.google.com/",
"failed_url": "https://www.kaskus.com/",
"notify_url": "https://merchant.com/notify-url",
"auto_redirect": false
}
}
Request Body Explanation
ParameterTypeMandatoryDescription
order.invoice_numberstringMandatoryGenerated by merchant to identify the order and must unique per request
Allowed chars: alphabetic, numeric, special chars
Max length: 64
order.amountnumberMandatoryIn IDR currency and without decimal
Allowed chars: numeric
Max length: 12
order.line_items.namestringConditionalOptional if request doesnt pass line items. But if request passes, then it becomes Mandatory.
Allowed chars: alphabetic, numeric, special chars
Max Length: 255
order.line_items.pricenumberConditionalPrice of the product item. Total price and quantity must match with the order.amount. Optional if request doesnt pass line items. But if request passes, then it becomes Mandatory.
Allowed chars: numeric
Max Length: 12
order.line_items.quantitynumberConditionalQuantity of the product item<. Optional if request doesnt pass line items. But if request passes, then it becomes Mandatory.
Allowed chars: numeric
Max Length: 4
success_urlstringOptionalMerchant URL that will redirected to after the order success. If merchant set order.auto_redirect to true, then the default url is "www.doku.com".
Allowed chars: alphabetic, numeric, special chars
failed_urlstringOptionalMerchant URL that will redirected to after the order failed. If not set, then will redirect to success_url
Allowed chars: alphabetic, numeric, special chars
notify_urlstringMandatoryMerchant URL that will be notify from DOKU. If its not define, status in merchant will not update.
Allowed chars: alphabetic, numeric, special chars
auto_redirectstringMandatoryRedirection to defined success_url after payment process completed
Possible value: true, false
Default value: false

API Response

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

TypeValue
HTTP Status200
ResultSUCCESS
Client-Id: MCH-0001-10791114622547
Request-Id: baec7d95-f30a-4b78-b711-6ebe0ccdf50b
Response-Timestamp: 2021-07-07T08:45:42Z
Signature: HMACSHA256=9UPUFzOqJc47aJzD9ESOTcWg6TMsg3mqSP+DnUO8ENE=
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:

{
"order": {
"invoice_number": "JT-JOKUL-PP_20220125093936",
"line_items": [
{
"name": "T-Shirt Red",
"price": 3000,
"quantity": 2
},
{
"name": "Polo Navy",
"price": 3000,
"quantity": 1
}
]
},
"doku_wallet_payment_page": {
"url": "https://staging.doku.com/wallauth/jokultransaction?sessionId=ff54640d-8a3d-4efb-a867-47785971c7c9"
}
}
Response Body Explanation
ParameterTypeMandatoryDescription
order.invoice_numberstringMandatorySame as the request
order.line_items.namenumberMandatorySame as the request
order.line_items.pricenumberMandatorySame as the request
order.line_items.quantitynumberMandatorySame as the request
doku_wallet_payment_page.urlstringMandatoryDOKU Wallet Payment Page URL generated by DOKU that merchant displays to the customer

2. Display DOKU Wallet payment page to customer

Once you have the payment.url, you can now display the payment page by redirecting your customer to the DOKU Wallet payment page.

After the customer completed the payment, they will be redirected to the defined success_url that you set on the API request.


3. Acknowledge payment result

After the payment is being made by your customer, DOKU will send HTTP Notification to your defined Notification URL. Learn how to handle the notification from DOKU: