Static VA Create API
Request parameters
Following are the parameters to be sent in the request body:
Field | is required? | Description | Example |
---|---|---|---|
bank_code | mandatory | string The bank code for the Virtual Account | BRI , BCA , MANDIRI , PERMATA , CIMB |
name | mandatory | string The name of virtual account | "John's Virtual Account" |
is_closed | mandatory | boolean Whether account can accept open(any amount) or fixed(specific amount) | true or false (default) |
customer | mandatory | json object with fields (id , email , mobile , first_name , given_name , customer_ref_id ). One of (id , mobile , email ) is mandatory field and given_name is mandatory. | { "email": "jane.doe@gmail.com", "given_name": "Jane" } |
expiry_minutes | optional | integer number of minutes left till expiry from now (default 1440), maximum(15768000) | 10000 |
account_number | optional | string account number which includes bank prefix, if not specified a random one is generated using bank prefix (refer below table for bank wise length) | 1236270056514331 |
The following table contains prefixes
for each bank
in sandbox
mode:
Bank Code | Bank Prefixes |
---|---|
MANDIRI | 890229004 |
BCA | 190061002 |
BRI | 123617005 |
PERMATA | 88565004 |
CIMB | 18991001 |
The following table has the maximum account number lengths
for each bank:
Bank Code | Max Length (Bank Prefix + Remaining Digits) |
---|---|
MANDIRI | 16 |
BCA | 23 |
BRI | 18 |
PERMATA | 16 |
CIMB | 16 |
Sample Request
Example
curl -X POST \
https://api.durianpay.id/v1/payments/va/static \
-H 'authorization: [Base64({Your_Server_Key}:)]' \
-H "content-type: application/json" \
-d '{
"bank_code": "BRI",
"name": "Hello Virtual Account",
"is_closed": false,
"amount": "12345.55",
"customer": {
"customer_ref_id": "27aa09d7-dd63-4053-94a4-d3ebb0e1e68b",
"given_name": "Paul",
"middle_name": "K",
"sur_name": "Rudd",
"email": "paulrudd@gmail.com",
"mobile": "999999999",
},
"expiry_minutes": 1000000,
"account_number": "123617005036344328"
}'
Sample Response
The status code
returned would be 201
.
{
"data": {
"customer_id": "cus_vS2R7NX08l7424",
"virtual_account": {
"id": "va_njZ2xTwr4s8660",
"bank_code": "BRI",
"account_number": "123617005036344328",
"name": "Hello Virtual Account",
"is_closed": true,
"amount": 12346,
"currency": "IDR",
"customer_id": "cus_vS2R7NX08l7424",
"is_sandbox": false,
"created_at": "2022-03-01T07:23:59.889904Z",
"expiry_at": "2024-01-24T12:33:59.952814Z",
"metadata": {}
}
}
}
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": "bank_code",
"message": "can't be blank"
},
{
"field": "name",
"message": "can't be blank"
},
{
"field": "customer",
"message": "can't be blank needs either ID, Email or Mobile"
},
{
"field": "customer.given_name",
"message": "given name cannot be empty"
},
{
"field": "expiry_minutes",
"message": "can't be less than equal to 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
Other errors are failures
which occur after form validation
. The status codes codes are usually 400
& 500
{
"error": "pq: VA Already Created",
"error_code": "DPAY_INTERNAL_ERROR",
"request_id": "dp_QMPB7IO53p6517"
}