Backend Integration

Backend Integration to initiate payment

To obtain the payment.url, you will need to hit this API through your Backend :

Endpoint

TypeValue

HTTP Method

POST

API endpoint (sandbox)

API endpoint (production)


Request

Here is the sample of request header to obtain payment.url:

Client-Id: MCH-0001-10791114622547
Request-Id: fdb69f47-96da-499d-acec-7cdc318ab2fe
Request-Timestamp: 2020-08-11T08:45:42Z
Signature: HMACSHA256=1jap2tpgvWt83tG4J7IhEwUrwmMt71OaIk0oL0e6sPM=

Request Header Explanation

ParameterDescription

client-id

Client ID retrieved from DOKU Back Office

request-id

Unique random string (max 128 characters) generated from merchant side to protect duplicate request

request-timestamp

Timestamp 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

signature

Security 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 obtain payment.url, you can send a simple request for a basic payment page and you can send the parameter according to your needs :

{
    "order": {
        "amount": 20000,
        "invoice_number": "INV-20210231-0001"
    },
    "payment": {
        "payment_due_date": 60
    }
}
Body ParameterTypeMandatoryDescription

order.amount

number

Mandatory

In IDR Currency and without decimal Max length: 12

order.invoice_number

string

Mandatory

Generated by merchant to identify the order. Max length: 64 Notes: If you have Credit Card channel activated, the maximum length is 30 chars due to the acquirer's requirements

payment.payment_due_date

number

Optional

The payment due date of the checkout page in minutes. Default : 60 minutes. Max Length: 6

This basic request only could be implement for selected payment method, such as :

  1. Virtual Account

  2. Credit Card

  3. QRIS

  4. Convenience Store

  5. E-money (OVO and Linkaja)

Order object

{
"order": {
  "amount": 80000,
  "invoice_number": "INV-{{$timestamp}}",
  "currency": "IDR",
  "callback_url": "http://doku.com/",
  "callback_url_cancel": "https://doku.com",
  "language":"EN",
  "auto_redirect":true,
  "disable_retry_payment" :true,
  "line_items": [
    {
        "id":"001",
        "name":"Fresh flowers",
        "quantity":1,
        "price":40000,
        "sku": "FF01",
        "category": "gift-and-flowers",
        "url": "http://doku.com/",
        "image_url":"http://doku.com/",
        "type":"ABC"
    },
    {
        "id":"002",
        "name":"T-shirt",
        "quantity":1,
        "price":40000,
        "sku": "T01",
        "category": "clothing",
        "url": "http://doku.com/",
        "image_url":"http://doku.com/",
        "type":"ABC"
    }
  ]
}
Body ParameterType`MandatoryDescription

order.amount

number

Mandatory

Order amount in IDR currency and without decimal. Max length: 12

order.invoice_number

string

Mandatory

Unique identifier generated by merchant to identify the order.

Max length: 64, except credit card which 30 chars only

order.currency

string

Optional

3 alphabetic currency code ISO 4217 Min-max Length: 3 Default value: IDR

order.callback_url

string

Conditional, Mandatory for Payment Methods : Jenius.

The URL designated for the merchant's redirection upon order completion.

order.callback_url_cancel

string

Conditional, Currently only available for payment methods : Indodana

The URL specified for merchant redirection in the event of order cancellation.

order.language

string

Optional

Default language shown when redirect to checkout page Max length: 2

order.auto_redirect

boolean

Mandatory

When set to true, the transaction result page redirects to the callback URL; otherwise, it redirects to the payment result page.

order.disable_retry_payment

boolean

Conditional, Only applied for payment methods : Credit Card, DOKU Wallet, Akulaku, OVO, ShopeePay

This condition is applicable only when the merchant sends this parameter with a "true" value. If the merchant does not include this parameter, sends a "false" value, or if the customer fails to complete the payment, the result page will be displayed in the Checkout. From there, the customer can retry payment or modify their payment options if multiple channels are available.

order.line_items.id

string

Conditional Mandatory for Payment Methods : Akulaku, Kredivo, Indodana.

Item ID of the item in this transaction. Max Length: 64

order.line_items.name

string

Conditional, Mandatory for Payment Methods : Jenius, Kredivo, Indodana.

Name of the product item. Max Length: 255

order.line_items.price

number

Conditional, Mandatory for Payment Methods : Jenius, Kredivo, Akulaku, Indodana

Price of the product item. Total price and quantity must match with the order.amount.

order.line_items.quantity

number

Conditional, Mandatory for Payment Methods : Jenius, Kredivo, Akulaku, Indodana.

Quantity of the product item.

order.line_items.sku

string

Conditional. Mandatory for Payment Methods : Akulaku, Kredivo, Indodana.

SKU of the product item.

order.line_items.category

string

Conditional, Mandatory for Payment Methods : Akulaku, Kredivo, Indodana.

Category of the product item. For Indodana, the category should be based on these list.

order.line_items.url

string

Conditional, Mandatory for Payment Methods : Kredivo and Indodana.

URL to the product item on merchant site.

order.line_items.image_url

string

Conditional, Mandatory for Payment Methods : Indodana.

URL the image of the product item on merchant site.

order.line_items.type

string

Conditional, Mandatory for Payment Methods : Indodana.

Type of the item in this transaction.

Payment Object

"payment": {
      "payment_due_date": 60,
      "payment_method_types": [
          "VIRTUAL_ACCOUNT_BCA",
          "VIRTUAL_ACCOUNT_BANK_MANDIRI",
          "VIRTUAL_ACCOUNT_BANK_SYARIAH_MANDIRI",
          "VIRTUAL_ACCOUNT_DOKU",
          "VIRTUAL_ACCOUNT_BRI",
          "VIRTUAL_ACCOUNT_BNI",
          "VIRTUAL_ACCOUNT_BANK_PERMATA",
          "VIRTUAL_ACCOUNT_BANK_CIMB",
          "VIRTUAL_ACCOUNT_BANK_DANAMON",
          "ONLINE_TO_OFFLINE_ALFA",
          "CREDIT_CARD",
          "DIRECT_DEBIT_BRI",
          "EMONEY_SHOPEEPAY",
          "EMONEY_OVO",
          "QRIS",
          "PEER_TO_PEER_AKULAKU",
          "PEER_TO_PEER_KREDIVO",
          "PEER_TO_PEER_INDODANA"
      ]
  }
Body parameterTypeMandatoryDescription

payment.payment_method_types

array

optional

Payment method that will shown to users in Checkout Page. If you wish to showcase all available payment methods, simply omit sending this parameter, and all options will be visible. Alternatively, if you prefer to direct users to a specific payment method, include this parameter and specify the desired payment method by filling in its corresponding value. The value are listed here.

payment.payment_due_date

number

optional

The payment due date of the checkout page in minutes. Default : 60 minutes. Max Length: 6

Customer Object

"customer":{
      "id":"JC-01",
      "name":"Zolanda",
      "last_name":"Anggraeni",
      "phone":"628121212121",
      "email": "zolanda@example.com",
      "address":"taman setiabudi",
      "postcode":"120129",
      "state":"Jakarta",
      "city":"Jakarta Selatan",
      "country":"ID"
}
Body parameterTypeMandatoryDescription

customer.id

string

Conditional, mandatory to enable tokenized payments (Direct Debit, Credit Card tokenization) and Akulaku Paylater.

Unique customer identifier generated by merchant. Allowed chars: alphabetic, numeric, special chars Max Length: 50

customer.name

string

Conditional, mandatory for payment methods Jenius, Akulaku, Indodana

Customer name. Allowed chars: alphabetic Max Length: 255

customer.last_name

string

Optional

Customer last name. Max Length: 16

customer.email

string

Conditional, mandatory for payment method Indodana

Customer email. Allowed chars: alphabetic, numeric, special chars Max Length: 128

customer.phone

string

Conditional

Customer phone number. Format: {calling_code}{phone_number}. Example: 6281122334455 Max Length: 16

customer.address

string

Conditional, mandatory for payment method Akulaku

Customer address. Allowed chars: alphabetic, numeric, special chars Max Length: 400

customer.postcode

string

Conditional, mandatory for payment method Akulaku

Customer address' post code

customer.state

string

Conditional, mandatory for payment method Akulaku

Customer state or province.

customer.city

string

Conditional, mandatory for payment method Akulaku

Customer address' city

customer.country

string

Optional

2 alphabetic country code ISO 3166-1 Allowed chars: alphabetic Min-max Length: 2

Shipping Address Object

"shipping_address":{
  "first_name":"Joe",
  "last_name":"Doe",
  "address":"Jalan DOKU no 15",
  "city":"Jakarta",
  "postal_code":"11923",
  "phone":"081312345678",
  "country_code":"IDN"
}
Body ParameterTypeMandatoryDescription

shipping_address.first_name

string

Conditional, mandatory for payment method Kredivo and Indodana

Customer's first name used as shipping address

shipping_address.last_name

string

Optional

Customer's last name used as shipping address.

shipping_address.address

string

Conditional, mandatory for payment method Kredivo and Indodana

Customer's address used as shipping address.

shipping_address.city

string

Conditional, mandatory for payment method Kredivo and Indodana

City of customer's shipping address.

shipping_address.postal_code

string

Conditional, mandatory for payment method Kredivo and Indodana

Postal code of customer's shipping address.

shipping_address.phone

string

Conditional, mandatory for payment method Kredivo and Indodana

Customer's phone used as shipping address.

shipping_address.country_code

string

Conditional, mandatory for payment method Kredivo and Indodana

Country of customer's shipping address.

Billing Address Object

"billing_address":{
  "first_name":"Joe",
  "last_name":"Doe",
  "address":"Jalan DOKU no 15",
  "city":"Jakarta",
  "postal_code":"11923",
  "phone":"081312345678",
  "country_code":"IDN"
}
Body ParameterTypeMandatoryDescription

billing_address.first_name

string

Conditional, mandatory for payment method Indodana

Customer's first name used as billing address

billing_address.last_name

string

Conditional, mandatory for payment method Indodana

Customer's last name used as billing address.

billing_address.address

string

Conditional, mandatory for payment method Indodana

Customer's address used as billing address.

billing_address.city

string

Conditional, mandatory for payment method Indodana

City of customer's billing address.

billing_address.postal_code

string

Conditional, mandatory for payment method Indodana

Postal code of customer's billing address.

billing_address.phone

string

Conditional, mandatory for payment method Indodana

Customer's phone used as billing address.

billing_address.country_code

string

Conditional, mandatory for payment method Indodana

Country of customer's billing address.

Additional Info Object

"additional_info":{
  "allow_tenor" : [0,3,6,12],
  "close_redirect" : "www.doku.com",
  "doku_wallet_notify_url" : "https://dw-notify.free.beeceptor.com"
}
Body parameterTypeMandatoryDescription

additional_info.allow_tenor

number

Optional

The transaction exclusively supports installment tenors as per its current configuration. The allowed values are 0,3,6,12. To hide the "no installment" option, refrain from inputting 0 (zero) in the parameter.

additional_info.close_redirect

string

Optional

Merchants have the capability to configure the URL redirect for the checkout page iframe. The value inputted : URL form.

additional_info.doku_wallet_notify_url

string

Optional, only for payment method DOKU Wallet

Notification url set in this parameter

Response

Success Response

TypeValue

HTTP Status

200

{
    "message": [
        "SUCCESS"
    ],
    "response": {
        "order": {
            "amount": "20000",
            "invoice_number": "INV-20210231-0001",
            "currency": "IDR",
            "session_id": "d1a56f68e29d491385880d5db835e351"
        },
        "payment": {
            "payment_method_types": [
                "JENIUS_PAY",
                "ONLINE_TO_OFFLINE_INDOMARET",
                "CREDIT_CARD",
                "VIRTUAL_ACCOUNT_BANK_MANDIRI",
                "QRIS",
                "EMONEY_OVO",
                "DIRECT_DEBIT_BRI",
                "PEER_TO_PEER_BRI_CERIA",
                "KARTU_KREDIT_INDONESIA",
                "ONLINE_TO_OFFLINE_ALFA",
                "PEER_TO_PEER_AKULAKU",
                "VIRTUAL_ACCOUNT_BANK_CIMB",
                "EMONEY_LINKAJA",
                "EMONEY_SHOPEE_PAY",
                "VIRTUAL_ACCOUNT_BCA",
                "PEER_TO_PEER_KREDIVO",
                "EMONEY_DOKU",
                "VIRTUAL_ACCOUNT_MAYBANK",
                "PEER_TO_PEER_INDODANA",
                "VIRTUAL_ACCOUNT_BRI",
                "OCTO_CLICKS",
                "VIRTUAL_ACCOUNT_BANK_SYARIAH_MANDIRI",
                "VIRTUAL_ACCOUNT_BNI",
                "VIRTUAL_ACCOUNT_BANK_DANAMON",
                "VIRTUAL_ACCOUNT_BANK_PERMATA",
                "VIRTUAL_ACCOUNT_DOKU"
            ],
            "payment_due_date": 60,
            "token_id": "d1a56f68e29d491385880d5db835e35120231311131337654",
            "url": "https://app-uat.doku.com/checkout-link-v2/d1a56f68e29d491385880d5db835e35120231311131337654",
            "expired_date": "20231211141336"
        },
        "additional_info": {
            "origin": {
                "product": "CHECKOUT",
                "system": "mid-jokul-checkout-system",
                "source": "direct",
                "standardApiVersion": "2.0"
            }
        },
        "uuid": 2225231211131337622107117821086006733340,
        "headers": {
            "request_id": "0532e08b-995f-402b-8ab0-c5fbe028c625",
            "signature": "HMACSHA256=5PKucK4YvU1VUBw1rsNdup1rdAhAdKZvMDLLctI932c=",
            "date": "2023-12-11T06:13:36Z",
            "client_id": "MCH-0003-8279340109246"
        }
    }
}

Response Body Explanation

Body ParameterTypeMandatoryDescription

message

array

Mandatory

Message will display the result of the request. If there are some errors on your request, they will be diplayed in this parameter.

response.order.amount

number

Mandatory

Same as the request

response.order.invoice_number

string

Mandatory

Same as the request

response.order.currency

string

Optional

Same as the request

response.order.session_id

string

Optional

Unique session ID generated by DOKU

response.order.callback_url

string

Optional

Same as the request

response.order.callback_url_cancel

string

Optional

Same as the request

response.order.line_items.name

string

Optional

Same as the request

response.order.line_items.quantity

number

Optional

Same as the request

response.order.line_items.price

number

Optional

Same as the request

response.order.line_items.sku

string

Optional

Same as the request

response.order.line_items.category

string

Optional

Same as the request

response.order.line_items.url

string

Optional

Same as the request

response.order.line_items.image_url

string

Optional

Same as the request

response.order.line_items.type

string

Optional

Same as the request

response.order.language

string

Optional

Same as the request

response.order.disable_retry_payment

boolean

Optional

Same as the request

response.order.auto_redirect

boolean

Optional

Same as the request

response.payment.payment_method_types

array

Optional

Payment method that will be displayed on the Checkout Page

response.payment.payment_due_date

number

Mandatory

Same as the request

response.payment.token_id

string

Mandatory

Token generated by DOKU for the Checkout Page

response.payment.url

string

Mandatory

Checkout page URL to display for the customer

response.payment.expired_date

string

Mandatory

Date time of payment page will be expired with the format of yyyyMMddHHmmss. The expired date uses UTC+7 time. Use this to set the expiry order on merchant side

response.customer.id

string

Optional

Same as the request

response.customer.state

string

Optional

Same as the request

response.customer.city

string

Optional

Same as the request

response.customer.postcode

string

Optional

Same as the request

response.customer.email

string

Optional

Same as the request

response.customer.phone

string

Optional

Same as the request

response.customer.name

string

Optional

Same as the request

response.customer.last_name

string

Optional

Same as the request

response.customer.address

string

Optional

Same as the request

response.customer.country

string

Optional

Same as the request

response.additional_info.allow_tenor

string

Optional

Same as the request

response.additional_info.close_redirect

string

Optional

Same as the request

response.additional_info.doku_wallet_notify_url

string

Optional

Same as the request

response.uuid

string

Optional

Unique number generated by DOKU

response.headers.requestId

string

Optional

Same as the request

response.headers.signature

string

Optional

Same as the request

response.headers.date

string

Optional

Same as the request

response.headers.clientId

string

Optional

Same as the request

response.shipping_address.address

string

Optional

Same as the request

response.shipping_address.city

string

Optional

Same as the request

response.shipping_address.phone

string

Optional

Same as the request

response.shipping_address.first_name

string

Optional

Same as the request

response.shipping_address.last_name

string

Optional

Same as the request

response.shipping_address.postal_code

string

Optional

Same as the request

response.shipping_address.country_code

string

Optional

Same as the request

response.billing_address.address

string

Optional

Same as the request

response.billing_address.city

string

Optional

Same as the request

response.billing_address.phone

string

Optional

Same as the request

response.billing_address.first_name

string

Optional

Same as the request

response.billing_address.first_name

string

Optional

Same as the request

response.billing_address.postal_code

string

Optional

Same as the request

response.billing_address.country_code

string

Optional

Same as the request

Failed Response

TypeValue

HTTP Status

400

{
    "error_messages": [
        "order.invoice_number must be filled",
        "order.amount must greater than 0"
    ]
}


List Category

List category can be used as reference. But this is part of payment channel Indodana with mandatory value need to set in order.line_items.category.

NoCategory

1

airlines

2

arts-crafts-and-collectibles

3

automotive

4

baby

5

beauty-and-fragrances

6

biller

7

books-and-magazines

8

business-to-business-including-mlm

9

charity-and-non-profit

10

clothing

11

community

12

digital-content

13

electronics-and-telecom

14

entertainment-and-media

15

fee

16

financial-services-and-products

17

financial-services-and-technology

18

food-and-beverage

19

food-retail-and-service

20

games-voucher

21

gifts-and-flowers

22

government

23

health-and-personal-care

24

home-and-garden

25

hotel-and-travel

26

insurance

27

marketplace

28

nonprofit

29

offline-store

30

others

31

over-the-air

32

overseas

33

pets-and-animals

34

property

35

public-services

36

religion-and-spirituality

37

retail

38

services

39

sports-and-outdoors

40

telco

41

ticketing

42

toys-and-hobbies

43

transportation

45

travel

46

vehicle-sales

47

vehicles-service-and-accessories

Last updated