Before you can integrate with Doku, you are expected to have a Doku account and register your Key on the Payment Hub. See Payment Gateway to register.
Environment | BASE_URL |
Staging | https://payment-hub.bnlstg.com |
Production | https://paymenthub.bookandlink.com |
# | Feature | Support |
1 | Return to specific URL after success or failed to pay | YES |
2 | Tokenize credit card | NO |
3 | Tokenize 3ds credit card | YES |
Doku has 2 types of payment links, namely "direct" and "invoice". These 2 types of payment links have different available options.
To do the payment simulation, you can use Doku simulator page to do it : https://sandbox.doku.com/integration/simulator/
The following is a list of available currencies supported by the Doku Payment Gateway.
Doku provides a feature to change the language on generated invoices. The following are the languages supported by Doku. Payment Hub use en - English as default language.
The "direct" payment link only allows payments using "CREDIT_CARD"
Meanwhile, for the "invoice" payment link type, you can use the following payment method:
Virtual Account
Payment Method | Value |
---|---|
BCA VA | VIRTUAL_ACCOUNT_BCA |
Bank Mandiri VA | VIRTUAL_ACCOUNT_BANK_MANDIRI |
Bank Syariah Indonesia VA | VIRTUAL_ACCOUNT_BANK_SYARIAH_MANDIRI |
BRI VA | VIRTUAL_ACCOUNT_BRI |
BNI VA | VIRTUAL_ACCOUNT_BNI |
DOKU VA | VIRTUAL_ACCOUNT_DOKU |
PERMATA VA | VIRTUAL_ACCOUNT_BANK_PERMATA |
CIMB VA | VIRTUAL_ACCOUNT_BANK_CIMB |
Danamon VA | VIRTUAL_ACCOUNT_BANK_DANAMON |
Credit Card
Payment Method | Value |
---|---|
Credit Card | CREDIT_CARD |
Convenience Store
Payment Method | Value |
---|---|
Alfa Group (Alfamart, Alfamidi, Dan+Dan) | ONLINE_TO_OFFLINE_ALFA |
Indomaret | ONLINE_TO_OFFLINE_INDOMARET |
Payment Method | Value |
---|---|
QRIS | QRIS |
Payment Method | Value |
---|---|
OVO | EMONEY_OVO |
SHOPEE PAY | EMONEY_SHOPEE_PAY |
DOKU WALLET | EMONEY_DOKU |
LINKAJA | EMONEY_LINKAJA |
DANA | EMONEY_DANA |
Payment Method | Value |
---|---|
AKULAKU | PEER_TO_PEER_AKULAKU |
KREDIVO | PEER_TO_PEER_KREDIVO |
INDODANA | PEER_TO_PEER_INDODANA |
Payment Method | Value |
---|---|
Direct Debit BRI | DIRECT_DEBIT_BRI |
Payment Method | Value |
---|---|
JENIUS PAY | JENIUS_PAY |
artu Kredit Indonesia
Payment Method | Value |
---|---|
KKI | KARTU_KREDIT_INDONESIA |
The payment method that can be used also depends on your merchant setting in Doku.
Doku allows to present hosted payment links via html iframe. Below are several screenshots of the hosted payment link from Doku.
Tokenize is used to generate tokens based on the user's credit card. Later this token can be used to make payments or charge transactions.
In Payment Hub, this endpoint can be used specifically to create tokens only, or automatically charge transactions.
We recommend that this process be carried out directly from the client page so that the customer's credit card credentials do not pass through your server. This process can be done with your public token or client token as the Authorization header. For the security of your account, use a public token if this process is done via client side.
Doku only provide 3ds tokenize
This endpoint is specifically used to generate 3D secure tokens. This endpoint will provide the one time use token, status and verify URL.
We recommend that this process be carried out directly from the client page so that the customer's credit card credentials do not pass through your server. This process can be done with your public token or client token as the Authorization header. For the security of your account, use a public token if this process is done via client side.
POST: BASE_URL/api/v1/transactions/token/3ds
Server side example
curl --location 'BASE_URL/api/v1/transactions/token/3ds' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9' \
--header 'Content-Type: application/json' \
--data '{
"payment_vendor": "66021e70b3239bdfc1dcd8e1",
"credit_card" : {
"account_name" : "Test Card",
"account_number" : "4100000000000100",
"exp_month" : "08",
"exp_year" : 2025
},
"amount" : 1500000,
"currency" : "IDR",
"return_url" : "https://example.com/complete"
}'
Client Side Example
<html>
<body>
<button onclick="generateToken()">Generate Token</button>
</body>
<script>
async function generateToken() {
var public_key = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6Ik9iamVjdElEKFwiNjYwMjE4NDBiMzIzOWJkZmMxZGNkOGRiXCIpIiwiR2VuZXJhdGVkQXQiOiIyMDI0LTAzLTI3VDE2OjQzOjE4LjEzOTkwNjYzNiswODowMCIsIlRva2VuVHlwZSI6InB1YmxpYyIsImV4cCI6MTcxMTUzMjU5OH0.sfw-Jg9OcL443VU4q1AXlYE2l8o3aqnHKneCA-xWVLM";
const token = await fetch('BASE_URL/api/v1/transactions/token/3ds', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${public_key}`,
},
body: JSON.stringify({
"payment_vendor": "66021e70b3239bdfc1dcd8e1",
"credit_card" : {
"account_name" : "Test Card",
"account_number": "4100000000000100",
"exp_month" : "08",
"exp_year" : 2025,
"cvn" : "123"
},
"amount" : 1500000,
"currency" : "IDR",
"return_url": "https://example.com/complete"
})
}).then(r => r.json())
console.log(token);
}
</script>
</html>
Field | Descriptions | Type |
---|---|---|
payment_vendor | Your payment gateway ID to use | text |
credit_card.account_name | Customer credit card account name | text |
credit_card.account_number | Customer credit card account number | text |
credit_card.exp_month | Customer credit card expired account month | text |
credit_card.exp_year | Customer credit card expired account year | number |
credit_card.cvn | 3 digit of credit card CVN. It won't be used for domestic Korean cards | text |
amount | Amount to charge | number |
currency | Indicates the currency in which the transaction is conducted. | text |
return_url | The URL to redirect the user to after a user successfully verify their credit card token | text |
{
"success": true,
"message": "Tokenize successfully",
"data": {
"token": "JFRO2aWAzFZtGM30nzCqlcqeStAmPR6iigd4zEHfyJU1O1pzRzrqqTXerKEKjEGBWhwn-FObAqmzvMyJMIP01FUbKqeuC0WJFmsoGyNP_TDcjCZN",
"status": "verified",
"auth_url": "https://sandbox.doku.com/wt-frontend-transaction/three-d-secure?authenticationId=c94b6e55f229f3ba88a6cc987e0690e8fe344ce72cf9498f54cad1cf6311869e&clientId=BRN-0268-1732755484580"
}
}
Field | Descriptions | type |
---|---|---|
token | Represent the generated token from credit card | text |
status | Represent the token status from merchant. For Doku, this status will always "verify" | text |
auth_url | Client can be redirected to this URL to verify the token before charge. | text |
Error Code | Message | Description |
---|---|---|
401 | Unauthorized | The client token was invalid |
400 | Validation failed | Inputs are failing validation. The errors field contains details about which fields are violating validation. |
500 | Server went wrong | An internal error occurred |
This endpoint allow you to check the status of token.
GET: BASE_URL
/api/v1/transactions/token
curl --location --request GET 'BASE_URL/api/v1/transactions/token' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.GV-Wei86FcFsdWz8wXMgzyBx06zaQLAUTMK4k-QUrz8' \
--header 'Content-Type: application/json' \
--data '{
"payment_vendor": "65f3eadc9d311dea1a9f1ff8",
"token" : "MFe0Rw-dpMp6eJwqf045bOR3WJpIPj6ix9mzeCT7bGKfuN0htGjynvOi_yp6rVrKvSnpJAOZ-hDLK4ZwrM0mWTo6b1cyrwVqrvVq4lxMbqY6cfUo"
}'
{
"success": true,
"message": "Token check result",
"data": {
"chargeable": true,
"description": "",
"status": "verified",
"token": "MFe0Rw-dpMp6eJwqf045bOR3WJpIPj6ix9mzeCT7bGKfuN0htGjynvOi_yp6rVrKvSnpJAOZ-hDLK4ZwrM0mWTo6b1cyrwVqrvVq4lxMbqY6cfUo"
}
}
Field | Descriptions | type |
---|---|---|
chargeable | Indicate the token is available to charge or not | boolean |
description | Indicate the description of token state | text |
status | Represent the token status from merchant. For Doku, this status will always "verify" | text |
token | Echo back the token from your payload | text |
If you don't want to automatically charge generated tokens, you can charge them manually via this endpoint.
POST: BASE_URL/api/v1/transactions/charge
curl --location 'BASE_URL/api/v1/transactions/charge' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9' \
--header 'Content-Type: application/json' \
--data '{
"payment_vendor" : "65f3eadc9d311dea1a9f1ff8",
"token" : "MFe0Rw-dpMp6eJwqf045bOR3WJpIPj6ix9mzeCT7bGKfuN0htGjynvOi_yp6rVrKvSnpJAOZ-hDLK4ZwrM0mWTo6b1cyrwVqrvVq4lxMbqY6cfUo",
"transaction_detail" : {
"merchant_ref_code": "TEST_STG-500000007",
"amount": 1500000,
"service_charge": 0,
"description": "Invoice TEST_STG-500000007",
"currency": "IDR",
"first_name": "",
"last_name": "",
"mobile": "",
"email": "",
"payment_method" : "",
"lang": "",
"send_email" : true,
"webhook_url": "https://payku.bnlstg.com/hook/payment/TEST_STG-500000007"
}
}'
Field | Descriptions | type |
---|---|---|
payment_vendor | Your payment gateway ID to use | text |
token | Credit card token that has been generated from create token endpoint. | text |
transaction_detail | Detailed transaction information that you want to charge | object |
This endpoint will create payment to current transaction based on merchant_ref_code
and will echo back the paid transaction data.
{
"success": true,
"message": "Charge Credit Card Successfully",
"data": {
"token": "65d434c1644935001525604c",
"transaction": {
"ID": "65d4197150dab0e83598a14b",
"ClientId": "65d2ab05d469920aee62896f",
"Description": "Invoice 84b88501",
"FirstName": "",
"LastName": "",
"Amount": 1500,
"ServiceCharge": 0,
"Mobile": "",
"Currency": "IDR",
"Email": "",
"PaymentMethod": null,
"PaymentVendor": "65f3b208559e33aa146f7dca",
"Status": "paid",
"Total": 100000,
"MerchantRefCode": "TEST_STG-500000007",
"WebhookUrl": "https://clientpage.io/webhook/84b88501",
"PaymentFailReason": "",
"Lang": "",
"SendEmail": true,
"Enable3dSecure": false,
"PaymentLinkType": "",
"ExpiredAt": "0001-01-01T00:00:00Z",
"CreatedAt": "2024-02-20T03:16:01.184Z",
"UpdatedAt": "2024-02-20T03:16:05.429Z",
"VendorId": "",
"VendorOrderId": "",
"VendorPaymentId": "65d419756449350015255ab2",
"VendorPaidAt": "2024-02-20T03:16:05.429Z",
"VendorPaymentChannel": "VISA",
"VendorPaymentMethod": "CREDIT_CARD",
"Refunds": null
}
}
}
Note:
Transaction status can be "paid" or "failed".
Error Code | Message | Description |
---|---|---|
401 | Unauthorized | The client token was invalid |
400 | Validation failed | Inputs are failing validation. The errors field contains details about which fields are violating validation. |
500 | Server went wrong | An internal error occurred |