Order-based VA API for BIDV Business Accounts
The Order-based Virtual Account (VA) API is an automated payment confirmation solution for BIDV business bank accounts. Instead of using a fixed VA, each order is assigned a unique VA with an exact matching amount.
What can you do with this API?
SePay allows you to perform the following queries with order-based VAs:
- Get the list of orders
- Create a new order
- Get order details
- Create an additional VA for an order
- Cancel an order
- Cancel an order’s VA
Getting started
API URL
[https://my.sepay.vn/userapi/bidv/{bank_account_id}](https://my.sepay.vn/userapi/bidv/{bank_account_id})To use the order-based VA API, you need to:
- Create an API Token to authenticate your API requests.
- Obtain the
bank_account_idof the BIDV business account from the Bank Accounts API or directly from the bank account management interface on SePay.
Payment method screen
Partial Payment
SePay supports partial payments for orders via Virtual Accounts (VAs). When using this feature:
You can create an order with the full amount, but allow customers to pay in installments by:
- Setting the amount smaller than the order amount when creating a new VA
- Setting the amount to null so the VA can receive multiple payments with any amount until the total reaches the order amount
When the customer makes a partial payment, the order status changes to Partially
When the total paid amount reaches the full order amount, the order status automatically changes to Paid and the VA will no longer accept payments
This feature is especially useful for high-value orders or when customers need to pay in installments.
Get order list
/userapi/bidv/123456/ordersContent-Type: application/json
Authorization: Bearer {token}
Create a new order
/userapi/bidv/123456/ordersContent-Type: application/json
Authorization: Bearer {token}
Request parameters
Name Type Required Description amountnumber/null Required Order amount; set to null to allow unlimited payment amount.order_codestring Not required Order code.durationnumber/null Not required Order validity time (in seconds). Set to null to have no payment time limit. Default is 600 seconds (10 minutes), maximum is 31,536,000 seconds (1 year).va_holder_namestring Not required VA account holder name (only uppercase letters, digits and spaces, max 70 characters).with_qrcodeboolean Not required Request to generate a QR Code.NoteThe
va_holder_nameparameter is only supported for BIDV business accounts that have the custom display name feature enabled by SePay. Please contact SePay support to enable this feature.
Order details
/userapi/bidv/123456/orders/{order_id}Content-Type: application/json
Authorization: Bearer {token}
- Retrieve detailed information of an order by ID.
- Path parameters
Name Type Required Description order_idstring Required Order ID
Create an additional VA
/orders/{order_id}/vaContent-Type: application/json
Authorization: Bearer {token}
- Create an additional VA for an existing order.
- Path parameters
Name Type Required Description order_idstring Required Order ID - Request parameters
Name Type Required Description amountnumber/null Required VA amount: - Defaults to the order amount. - Can be set smaller than the order amount to allow partial payments. - Set to null so the VA can receive multiple payments until the order amount is fully paid.va_holder_namestring Not required VA account holder name (only uppercase letters, digits and spaces, max 70 characters).durationnumber/null Not required VA validity time (in seconds). Set to null for no payment time limit. - Default is 600 seconds (10 minutes). - Maximum is 31,536,000 seconds (1 year).
Cancel an order
/orders/{order_id}Content-Type: application/json
Authorization: Bearer {token}
- Path parameters
Name Type Required Description order_idstring Required Order ID
Cancel a VA
/orders/{order_id}/va/{va_number}Content-Type: application/json
Authorization: Bearer {token}
- Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
order_id | string | Required | ID của một đơn hàng |
va_number | string | Required | Số va |
Handle payment notification Webhooks
When a customer successfully pays into an order’s VA, SePay will send a webhook notification to your website. The webhook payload includes a
codefield that contains the order code of that VA.Example webhook payload when a VA is paid:
{
"id": 92704,
"gateway": "BIDV",
"transactionDate": "2024-01-07 14:02:37",
"code": "ORD123456789",
"transferAmount": 2277000,
"transferType": "in"
}Your website should check the
codefield to determine which order was paid and update its status accordingly.For details on how to set up and handle webhooks, see Webhook Creation Guide.
Status definitions
Order status
Status Description Pending Order not yet paid Paid Order has been paid Partially Order partially paid Cancelled Order has been cancelled VA status
Status Description Unpaid VA not yet paid Paid VA has been paid Cancelled VA has been cancelled
Request limits
SePay rate limits order-based API requests as follows:
- 2 requests/second per IP
- Exceeding the limit returns response code 429
- The
X-SePay-UserApi-Retry-Afterheader indicates how long to wait before retrying
Error codes
- SePay may return the following error codes:
HTTP Code Description Cause 400 Bad RequestInvalid or missing parameters401 UnauthorizedInvalid token404 Not FoundResource not found429 Too Many RequestsRate limit exceeded
Create an order with no amount and time limits
You can create an order with no limits on amount and payment time by:
- Setting
amounttonullso the order and its VAs can receive multiple payments - Setting
durationtonullso the order has no payment time limit
- Setting
Example:
bashAfter creating an order, you can create a new VA for the order by calling the Create an additional VA API.