Bookandlink Documentations

API Payment Hub > Doku

Doku

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.

EnvironmentBASE_URL
Staginghttps://payment-hub.bnlstg.com
Productionhttps://paymenthub.bookandlink.com
#FeatureSupport
1Return to specific URL after success or failed to payYES
2Tokenize credit cardNO
3Tokenize 3ds credit cardYES

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/

Currency

The following is a list of available currencies supported by the Doku Payment Gateway.

  • IDR - Indonesian Rupiah

Language

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.

  • EN - English
  • ID - Indonesian

Payment Method

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 MethodValue
BCA VAVIRTUAL_ACCOUNT_BCA
Bank Mandiri VAVIRTUAL_ACCOUNT_BANK_MANDIRI
Bank Syariah Indonesia VAVIRTUAL_ACCOUNT_BANK_SYARIAH_MANDIRI
BRI VAVIRTUAL_ACCOUNT_BRI
BNI VAVIRTUAL_ACCOUNT_BNI
DOKU VAVIRTUAL_ACCOUNT_DOKU
PERMATA VAVIRTUAL_ACCOUNT_BANK_PERMATA
CIMB VAVIRTUAL_ACCOUNT_BANK_CIMB
Danamon VAVIRTUAL_ACCOUNT_BANK_DANAMON

Credit Card

Payment MethodValue
Credit CardCREDIT_CARD

Convenience Store

Payment MethodValue
Alfa Group (Alfamart, Alfamidi, Dan+Dan)ONLINE_TO_OFFLINE_ALFA
IndomaretONLINE_TO_OFFLINE_INDOMARET

QRIS Payment

Payment MethodValue
QRISQRIS

E-wallet

Payment MethodValue
OVOEMONEY_OVO
SHOPEE PAYEMONEY_SHOPEE_PAY
DOKU WALLETEMONEY_DOKU
LINKAJAEMONEY_LINKAJA
DANAEMONEY_DANA

Paylater

Payment MethodValue
AKULAKUPEER_TO_PEER_AKULAKU
KREDIVOPEER_TO_PEER_KREDIVO
INDODANAPEER_TO_PEER_INDODANA

Direct Debit

Payment MethodValue
Direct Debit BRIDIRECT_DEBIT_BRI

Digital Banking

Payment MethodValue
JENIUS PAYJENIUS_PAY

artu Kredit Indonesia

Payment MethodValue
KKIKARTU_KREDIT_INDONESIA

The payment method that can be used also depends on your merchant setting in Doku.

Hosted Payment Page

Doku allows to present hosted payment links via html iframe. Below are several screenshots of the hosted payment link from Doku.

Invoice Payment Link
Direct Payment Link

Tokenize

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


Create 3ds Token

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>
Body Parameters
FieldDescriptionsType
payment_vendorYour payment gateway ID to usetext
credit_card.account_nameCustomer credit card account nametext
credit_card.account_numberCustomer credit card account numbertext
credit_card.exp_monthCustomer credit card expired account monthtext
credit_card.exp_yearCustomer credit card expired account yearnumber
credit_card.cvn3 digit of credit card CVN. It won't be used for domestic Korean cardstext
amountAmount to chargenumber
currencyIndicates the currency in which the transaction is conducted.text
return_urlThe URL to redirect the user to after a user successfully verify their credit card tokentext
Response Parameters
{
    "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"
    }
}
FieldDescriptionstype
tokenRepresent the generated token from credit cardtext
statusRepresent the token status from merchant. For Doku, this status will always "verify"text
auth_urlClient can be redirected to this URL to verify the token before charge.text
Error Codes
Error CodeMessageDescription
401UnauthorizedThe client token was invalid
400Validation failedInputs are failing validation. The errors field contains details about which fields are violating validation.
500Server went wrongAn internal error occurred

Check Token Status

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"
}'
Response Parameters
{
    "success": true,
    "message": "Token check result",
    "data": {
        "chargeable": true,
        "description": "",
        "status": "verified",
        "token": "MFe0Rw-dpMp6eJwqf045bOR3WJpIPj6ix9mzeCT7bGKfuN0htGjynvOi_yp6rVrKvSnpJAOZ-hDLK4ZwrM0mWTo6b1cyrwVqrvVq4lxMbqY6cfUo"
    }
}
FieldDescriptionstype
chargeableIndicate the token is available to charge or notboolean
descriptionIndicate the description of token statetext
statusRepresent the token status from merchant. For Doku, this status will always "verify"text
tokenEcho back the token from your payloadtext

Create Charge

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"
    }
}'
Body Parameters
FieldDescriptionstype
payment_vendorYour payment gateway ID to usetext
tokenCredit card token that has been generated from create token endpoint.text
transaction_detailDetailed transaction information that you want to chargeobject
Response Parameters

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".

  • paid, If the charge process is successful with the token
  • failed, if the charge process is failed with the token provided

Error Codes
Error CodeMessageDescription
401UnauthorizedThe client token was invalid
400Validation failedInputs are failing validation. The errors field contains details about which fields are violating validation.
500Server went wrongAn internal error occurred

On this page