Virtual Accounts Payment Simulate API


The following endpoint to simulate a payment to a virtual account

/payments/va/simulate

This endpoint only works in sandbox mode using API Key which starts with dp_test

Request parameters

Following are the parameters to be sent in the request body:

Fieldis required?Description
account_numbermandatoryType: string

The account number to which money should be sent

Example: 1236170055
amountmandatoryType: string

Amount in IDR to be sent to account

Example: 12345.55

Sample Request

curl --location --request POST 'https://api.durianpay.id/v1/payments/va/simulate' \
--header 'Authorization: [Base64({Your_Server_Key}:)]' \
--header 'Content-Type: application/json' \
--data-raw '{
    "amount": "12333",
    "account_number": "88565004532522",
    "force_fail": false
}'

Sample Response

The status code returned would be 200.

{
    "data": {
        "status": "Payment Successful"
    }
}

Sample Error

Form Errors

Form errors are those which occur during form validation & contain an errors array and are thrown with status code 400.

{
    "error_code": "DPAY_INVALID_REQUEST",
    "request_id": "dp_JSN8xJULZ39583",
    "errors": [
        {
            "field": "account_number",
            "message": "can't be blank"
        },
        {
            "field": "amount",
            "message": "can't be blank"
        }
    ]
}

Authorization Errors

Authorization errors are errors that occur during authorization. The status code returned is usually 401

{
    "error": "invalid Authorization header in request",
    "error_code": "DPAY_UNAUTHORIZED_ACCESS"
}

Other Errors

Other errors are failures which occur after form validation. The status codes codes are usually 422.

{
    "data": {
        "status": "Payment Unsuccessful",
        "reason": "VA Not found"
    }
}