Permanent Virtual Accounts
KingsPay supports two types of virtual accounts. Before going further, make sure you need a Permanent one:
| Permanent VA | One-Time VA | |
|---|---|---|
| Use case | Top-ups, recurring payments, open-amount transfers | Fixed-amount checkout or invoice |
| Amount | Any amount, set by the payer | Fixed at charge creation |
| Reusable | Yes — active until you delete it | No — expires after one payment |
| Created via | POST /v1/virtual-accounts (this page) | POST /v1/payments/charges |
If you're looking to accept a one-time payment for a specific amount — for example, during a checkout flow — you want a charge with a virtual account payment method instead.
A Permanent Virtual Account is a fixed virtual account number that stays active until you delete it, or until the expiry you optionally set. It is not tied to a specific amount — your customer can transfer any amount at any time, and KingsPay will create a charge on your behalf when funds arrive.
Common use cases include:
- Wallet top-ups — assign each user a dedicated account number they can transfer to at any time.
- Recurring payments — let customers reuse the same number for repeat purchases without issuing a new VA each time.
- Open-amount payments — accept transfers of any amount without specifying a fixed charge upfront.
How it works
The diagram below shows the full lifecycle of a permanent virtual account payment.
- Create the virtual account — call
POST /v1/virtual-accountswith your chosen payment method, account number, and display name. Store the returned account details. - Share the number — give your customer the virtual account number. They can reuse it for every future payment.
- Customer transfers funds — the customer transfers any amount to the virtual account number via internet banking, mobile banking, or an ATM.
- KingsPay creates a charge — when funds arrive, KingsPay automatically creates a charge record on your behalf.
- Event is emitted — KingsPay sends a
payment_charge.succeededevent to your configured webhook destination with the charge and transfer details. - Process the payment — your application receives the event and updates its records (e.g. credits the user's wallet). The virtual account remains active and the customer can transfer again at any time.
Before you start
This walkthrough assumes you already have:
- An activated KingsPay account (see Getting Started if you still need to complete activation).
- An API key with the
VirtualAccounts.ManageandVirtualAccounts.Readpermissions enabled. Your key must be sent as a Bearer token — see Authentication. - A webhook destination configured to receive virtual account events.
- A virtual account payment method enabled for your account. Virtual account payment methods are not enabled by default — contact KingsPay support to enable one. Once activated, you will be assigned a VA allocation: the leading digits that all your virtual account numbers must begin with. The
numberyou provide must start with them.
Create a permanent virtual account
Call POST /v1/virtual-accounts authenticated with your secret API key.
| Field | Type | Description |
|---|---|---|
payment_method | string | The virtual account payment method to issue the account on (e.g. mandiri_va, permata_va, maybank_va). |
number | string | The virtual account number to assign, up to 20 characters. Must begin with your VA allocation for the chosen payment method. |
name | string | The name shown on the customer's bank transfer screen, up to 20 characters. |
min_amount | number | The smallest transfer the account accepts. Greater than 0. |
max_amount | number | The largest transfer the account accepts. Greater than 0, and not less than min_amount. |
expires_at | string | (Optional) When the virtual account stops accepting transfers, in the future. Leave it out to keep it active until you delete it. |
Use the code of a virtual account payment method enabled for your account, such as maybank_va, mandiri_va or permata_va.
Example
curl -X POST "https://api.kingsplatform.net/api/api/v1/virtual-accounts" \
-H "Authorization: Bearer YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"payment_method": "mandiri_va",
"number": "12345678901",
"name": "Acme Wallet",
"min_amount": 10000,
"max_amount": 100000000
}'The response includes the virtual account id, number, and payment_method you can store and display to your customer.
Delete a permanent virtual account
When you no longer need a virtual account number, delete it by calling DELETE /v1/virtual-accounts/{id}. After deletion, any incoming transfers to that number will not be processed.