Virtual Accounts Patch By ID API


The following endpoint is used to override Expiry Time of a single Virtual Account. It can either expire a VA(set expiry_minutes to 0) or override the expiry time.

/payments/va/:id

Path parameters

Fieldis required?Description
idmandatoryinteger Unique identifier of the Virtual Account to be retrieved

Request parameters

Fieldis required?Description
expiry_minutesoptionalType: integer

Number of minutes left till expiry from now. Set to 0 to expire VA

Example: 10000
min_amountoptionalType: integer

Modify minimum amount which can be paid to an open VA

Example: 10000
max_amountoptionalType: integer

Modify maximum amount which can be paid to an open VA

Example: 10000
amountoptionalType: integer

Modify maximum amount which can be paid to a closed VA

Example: 10000
is_disabledoptionalType: boolean

Modify enabling/disabling payments to a VA while still reserving it

Example: true
va_ref_idoptionalType: string

Modify a reference ID which the merchant wants to use for a specific VA

Example: "VA_XYZ_1234"

Error Codes

CodeDescription
DPAY_CANNOT_PATCH_PAID_VAcannot patch paid va
DPAY_PATCHING_VA_NOT_SUPPORTEDpatching va not supported
DPAY_INTERNAL_ERRORan unclassified error
DPAY_INVALID_REQUESTan error in form fields
DPAY_UNAUTHORIZED_ACCESSan unauthorized access error

Sample Request

curl --location --request PATCH 'https://api.durianpay.id/v1/payments/va/va_sample_EwCm3LrPqE5184' \
--header 'Authorization: [Base64({Your_Server_Key}:)]' \
--header 'Content-Type: application/json' \
--data-raw '{
    "expiry_minutes": 1440,
    "min_amount": 11000,
    "max_amount": 13000,
    "amount": 123456,
    "is_disabled": true,
    "va_ref_id": "1234412"
}'

Sample Response

{
    "data": {
        "virtual_account": {
            "id": "va_sample_EwCm3LrPqE5184",
            "bank_code": "PERMATA",
            "account_number": "88565004532522",
            "name": "Ardi Hanan Durian",
            "is_closed": true,
            "amount": 123456,
            "currency": "IDR",
            "customer_id": "cus_akA2FwrR5B2217",
            "is_sandbox": true,
            "created_at": "2022-06-27T02:52:30.236901Z",
            "expiry_at": "2022-06-29T05:40:59.795448Z",
            "metadata": {},
            "is_disabled": true,
            "is_paid": false,
            "is_reusable": true,
            "min_amount": 50000,
            "max_amount": null,
            "va_ref_id": "1234412",
            "auto_disable_after_payment": false
        },
        "virtual_account_status": "VirtualAccountSuccess",
        "customer": {
            "id": "cus_akA2FwrR5B2217",
            "customer_ref_id": "",
            "given_name": "",
            "middle_name": "",
            "sur_name": "",
            "email": "p.ardi.h@gmail.com",
            "mobile": "+628978678578"
        }
    }
}

Sample Error

Form Errors

The possible error status codes are: 400

{
    "error_code": "DPAY_INVALID_REQUEST",
    "request_id": "dp_Dzc8hMzkQU4826",
    "errors": [
        {
            "field": "expiry_minutes",
            "message": "can't be less than 0"
        }
    ]
}

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

The possible error status codes are: 404, 500

{
    "error": "sql: no rows in result set",
    "error_code": "DPAY_VA_NOT_FOUND",
    "request_id": "dp_d3HX9S5W0r4989"
}