Payment Charge API


The following endpoint charges the payment for all payment methods

/payments/charge

Basic Request Payload

Fieldis required?Description
typemandatorystring type of payment, possible values - "VA", "EWALLET", "CARD", "RETAILSTORE", "ONLINE_BANKING", "QRIS", "BNPL"
requestmandatoryobject The payload object depending on the payment type

Virtual Account (VA) or Bank Transfer

Request Payload

Fieldis required?Description
typemandatorystring "VA"
requestmandatoryobject The payload object depending on the payment type

Request object

Fieldis required?Description
order_idmandatorystring The id returned from create order api
bank_codemandatorystring Bank codes for the relevant bank. Available banks: BCA, BNI, BRI, MANDIRI, PERMATA, CIMB, BTPN, SAHABAT_SAMPOERNA, SINARMAS, MAYBANK, SYARIAH, DANAMON, OTHERS
namemandatorystring Name that should appear in ATM
amountmandatorystring Payment amount

Example Request for VA

# for VA
curl -X POST \
  https://api.durianpay.id/v1/payments/charge \
  -H 'authorization: [Base64({Your_Server_Key}:)]' \
  -H 'content-type: application/json' \
  -d '{
    "type": "VA",
    "request": {
        "order_id": "ord_mJH2hKOSYb3514",
        "bank_code": "MANDIRI",
        "name": "Name Appear in ATM",
        "amount": "20000"
    }
}'

Response for VA

{
  "type": "VA",
  "response": {
    "payment_id": "pay_XUwAkgIoru9966",
    "order_id": "ord_Zwcd3aNiZR5608",
    "account_number": "889089999561424",
    "expiration_time": "2021-05-01T15:12:14.437734082Z",
    "paid_amount": "1000.00",
    "metadata": {}
  }
}

E-Wallet

Request Payload

Fieldis required?Description
typemandatorystring "EWALLET"
requestmandatoryobject The payload object depending on the payment type

Request object

Fieldis required?Description
order_idmandatorystring The id returned from create order api
mobilemandatorystring Mobile number linked to the wallet
amountmandatorystring Payment amount
wallet_typemandatorystring Wallet type.

Example Request for E-Wallet

curl -X POST \
  https://api.durianpay.id/v1/payments/charge \
  -H 'authorization: [Base64({Your_Server_Key}:)]' \
  -H 'content-type: application/json' \
  -d '{
  "type": "EWALLET",
  "request": {
      "order_id": "ord_mJH2hKOSYb3514",
      "amount": "20000.00",
      "mobile": "08123456789",
      "wallet_type": "DANA"
  }
}'

Example Response for E-Wallet

{
  "type": "EWALLET",
  "response": {
    "payment_id": "pay_dAM0lqkVuk0074",
    "order_id": "ord_TVZ6EYuBJ85268",
    "mobile": "08123123123",
    "status": "processing",
    "expiration_time": "2021-04-02T15:08:57.800297779Z",
    "checkout_url": "https://link.to/ewallet-checkout-url",
    "paid_amount": "1000.00",
    "metadata": {}
  }
}

Retail Store

Request Payload

Fieldis required?Description
typemandatorystring "RETAILSTORE"
requestmandatoryobject The payload object depending on the payment type

Request object

Fieldis required?Description
order_idmandatorystring The id returned from create order api
bank_codemandatorystring Available values: ALFAMART, INDOMARET
namemandatorystring Name that should appear in ATM
amountmandatorystring Payment amount

Example Request for RETAILSTORE

bank_code can be ALFAMART or INDOMARET.

curl -X POST \
  https://api.durianpay.id/v1/payments/charge \
  -H 'authorization: [Base64({Your_Server_Key}:)]' \
  -H 'content-type: application/json' \
  -d '{
    "type": "RETAILSTORE",
    "request": {
        "order_id": "ord_mJH2hKOSYb3514",
        "bank_code": "ALFAMART",
        "name": "Name Appear in ATM",
        "amount": "20000.00"
    }
}'

Response for RETAILSTORE

{
  "type": "RETAILSTORE",
  "response": {
    "payment_id": "pay_XUwAkgIoru9966",
    "order_id": "ord_Zwcd3aNiZR5608",
    "account_number": "889089999561424",
    "expiration_time": "2021-05-01T15:12:14.437734082Z",
    "paid_amount": "1000.00",
    "metadata": {}
  }
}

ONLINE BANKING

Request Payload

Fieldis required?Description
typemandatorystring "ONLINE_BANKING"
requestmandatoryobject The payload object depending on the payment type

Request object

Fieldis required?Description
order_idmandatorystring The id returned from create order api
typemandatorystring Available values: JENIUSPAY
namemandatorystring Name
mobilemandatorystring Mobile
amountmandatorystring Payment amount
customer_infooptionalstring Customer Info

Example Request for JENIUSPAY

curl -X POST \
  https://api.durianpay.id/v1/payments/charge \
  -H 'authorization: [Base64({Your_Server_Key}:)]' \
  -H 'content-type: application/json' \
  -d '{
    "type": "ONLINE_BANKING",
    "request": {
        "order_id": "ord_mJH2hKOSYb3514",
        "type": "JENIUSPAY",
        "name": "Name Appear in ATM",
        "amount": "20000.00",
    "customer_info": {
      "email": "jude_kasper@koss.in",
      "given_name": "Jude Kasper",
      "id": "cus_aGn5UD0m7F0994"
    },
    "mobile": "+6285722173217"
    }
}'

Response for ONLINE_BANKING

{
  "type": "ONLINE_BANKING",
  "response": {
    "expiration_time": "2021-08-25T04:54:02.512309995Z",
    "metadata": {},
    "mobile": "+6285722173217",
    "order_id": "ord_QKglAxhyXs7798",
    "paid_amount": "925002.00",
    "payment_id": "pay_LbsD6MZmbn0052",
    "status": "processing",
    "unique_id": "JENIUSPAY",
    "web_url": "https://test-url.com"
  }
}

Note: web_url is the redirect url which merchant should open to move on to the Jenius pay payment confirmation page.

Note: the minimum amount needed for transaction using JENIUSPAY is Rp. 10000 and you will be provided with a external redirect url to complete the payment. order_id, type, amount and mobile are mandatory fields.

BCA Aggregator

Example Request for BCA Aggregator

Merchant need to have neither BCA Bank account nor BCA approval - while merchant will be able to go live very quickly with Aggregator account.

Example Request for BCA Aggregator

# for BCA VA
curl -X POST \
  https://api.durianpay.id/v1/payments/charge \
  -H 'authorization: [Base64({Your_Server_Key}:)]' \
  -H 'content-type: application/json' \
  -d '{
    "type": "VA",
    "request": {
        "order_id": "ord_WqiDi4ffuQ6751",
        "bank_code": "BCA",
        "name": "Name Appear in ATM",
        "amount": "20000.00",
    "customer_info": {
      "email": "jude_kasper@koss.in",
      "given_name": "Jude Kasper",
      "id": "cus_aGn5UD0m7F0994"
    }
    }
}'

Please note that the minimum amount needed for transaction using BCA Aggregator is Rp. 10.000 NOTE: order_id, type, amount, bank_code (BCA) are mandatory fields.

Response for VA Aggregator

{
  "type": "VA",
  "response": {
      "account_number": "1900800000003154",
      "expiration_time": "2021-08-25T04:47:03.258854515Z",
      "metadata": {},
      "order_id": "ord_PDZ1PzH5Iv3914",
      "paid_amount": "925002.00"
  }
}

QRIS

Request Payload

Fieldis required?Description
typemandatorystring "QRIS"
requestmandatoryobject The payload object depending on the payment type

Request object

Fieldis required?Description
order_idmandatorystring The id returned from create order api
typemandatorystring Available values: QRIS
namemandatorystring Name
amountmandatorystring Payment amount

Please note that the maximum limit for QRIS is 5.000.000 IDR and minimum limit is 1.500 IDR

Example Request for QRIS

curl -X POST \
  https://api.durianpay.id/v1/payments/charge \
  -H 'authorization: [Base64({Your_Server_Key}:)]' \
  -H 'content-type: application/json' \
  -d '{
    "type": "QRIS",
    "request": {
        "amount": "80001.00",
        "order_id": "ord_ZSHipeBgUd4740",
        "name": "Name Appear in ATM",
        "type": "QRIS"
    }
}'

Response for QRIS

{
  "type": "QRIS",
  "response": {
    "payment_id": "pay_s2sSBlDSWv4167",
    "order_id": "ord_QETgbs2UGL3100",
    "status": "processing",
    "expiration_time": "2021-09-15T15:44:37Z",
    "creation_time": "2021-09-12T15:44:37ZZ",
    "qr_string": "data:image/png;base64, long_qr_string",
    "unique_id": "QRIS",
    "metadata":{
      "merchant_name": "Durianpay",
      "merchant_id" : "sample_national_merchant_id" 
    },
    "amount": "80001.00",
    "qr_code": "00020101021226590013ID.CO.BNI.WWW011893600009150002286002092107061320303UME51470015ID.OR.GPNQR.WWW0217ID2107271315771960303UME520454995303360540880001.005802ID5905Ajesh6013JAKARTA PUSAT6105101406214011038291492856304E1F"
  }
 }

CARD

Request Payload

Fieldis required?Description
typemandatorystring "CARD"
requestmandatoryobject The payload object depending on the payment type

Request object

Fieldis required?Description
order_idmandatorystring The id returned from create order api
amountoptionalstring Payment amount
customer_infooptionalstring Customer Info

Response Payload

FieldDescription
payment_idstring Unique id for payment object
order_idstring The id returned from create order api
paid_amountstring Payment amount
statusstring Payment status
checkout_urlstring Redirect url which merchant should open to move on to the payment page

Example Request for CARD

curl -X POST \
  https://api.durianpay.id/v1/payments/charge \
  -H 'authorization: [Base64({Your_Server_Key}:)]' \
  -H 'content-type: application/json' \
  -d '{
    "type": "CARD",
    "request": {
        "order_id": "ord_1EcWGI2xSs7216",
        "amount": "10000.00",
        "customer_info": {
            "id": "cus_aGn5UD0m7F0994",
            "email": "jude_kasper@koss.in",
            "given_name": "Jude Kasper"
        }
    }
}'

Response for CARD

{
  "type": "CARD",
  "response": {
      "payment_id": "pay_1Ylb1r122v1860",
      "order_id": "ord_sipQEaBnkX0407",
      "payment_ref_id": "",
      "token_id": "",
      "status": "processing",
      "paid_amount": "10000.00",
      "metadata": {},
      "checkout_url": "https://link.to/card-checkout-url"
  }
}

Buy Now Pay Later (BNPL)

Request Payload

Fieldis required?Description
typemandatorystring "BNPL"
requestmandatoryobject The payload object depending on the payment type

Request object

Fieldis required?Description
order_idmandatorystring The id returned from create order api
payment_method_unique_idmandatorystring Available values: AKULAKU,INDODANA
amountmandatorystring Payment amount
customer_infooptionalstring Customer Info

Response payload

FieldDescription
payment_idstring Unique id for payment object
order_idstring The id returned from create order api
redirect_urlstring Redirect url which merchant should open to move on to the payment page
paid_amountstring Payment amount

Example Request for BNPL

curl -X POST \
  https://api.durianpay.id/v1/payments/charge \
  -H 'authorization: [Base64({Your_Server_Key}:)]' \
  -H 'content-type: application/json' \
  -d '{
    "type": "BNPL",
    "request": {
        "order_id": "ord_1EcWGI2xSs7216",
        "amount": "10000.00",
        "payment_method_unique_id" : "AKULAKU"
        "customer_info": {
            "id": "cus_aGn5UD0m7F0994",
            "email": "jude_kasper@koss.in",
            "given_name": "Jude Kasper"
        }
    }
}'

Response for BNPL

{
  "type": "BNPL",
  "response": {
    "payment_id": "pay_s2sSBlDSWv4167",
    "order_id": "ord_ZSHipeBgUd4740",
    "redirect_url": "https://redirect-url.com/"
    "paid_amount": "80001.00",
    "metadata":{},
  }
 }

Sandbox Mode

To simulate the charge API flow in sandbox mode, merchants can use dp_test_XXXXXXXXX key. By default we will simulate the success scenario. If you want to simulate the failure scenario, you should use the sandbox_options json field in the request. This contains force_fail and delay_ms fields.

FieldDescription
force_failbool Make this field as true in the request if you want to simulate failure scenario.
delay_msinteger If you want to simulate a delay in making the payment as success or failed, give a value in milliseconds in this field in the request.

Note: Currently sandbox_options is supported for VA, E-Wallet, RetailStore and BNPL.

Example request for charge API in sandbox

curl
-X POST https://api.durianpay.id/v1/payments/charge \
-H "content-type: application/json" \
-H "authorization: [Base64({Your_Server_Key}:)]" \
-d '{
    "type": "VA",
    "request": {
        "order_id": "ord_aiFBiqVWwk8596",
        "amount": "925002.00",
        "bank_code": "BCA",
        "name": "Bauch Leannon and Donnelly Jude Casper",
        "save_preferences": true,
        "address_id": 4028,
        "customer_info": {
            "id": "cus_lqbboIkqI80314",
            "given_name": "Jude Casper",
            "email": "jude.casper@testmail.com",
            "mobile": "+6285722173250"
        }
    },
    "sandbox_options": {
        "force_fail": true,
        "delay_ms": 10000
    }
}'

Example response for sandbox.

{
    "data": {
        "type": "VA",
        "response": {
            "payment_id": "pay_lZqgqy5mQz0234",
            "order_id": "ord_aiFBiqVWwk8596",
            "account_number": "1111111111",
            "expiration_time": "2022-01-11T09:01:18.083714Z",
            "paid_amount": ""
        }
    }
}