const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
currency: 'NGN',
country: 'NG',
amount: 5000,
duration: 30,
reference: 'TXN_REF_DYNAMIC_12345678',
accountName: 'Spar Ikorodu'
})
};
fetch('https://sandboxapi.me-cash.com/v1/virtual-account/dynamic', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"message": "virtual account created successfully",
"status": "success",
"data": {
"id": "30fe4022-09da-46fb-bafa-xxxxxxxxxxxxx",
"reference": "<string>",
"account": {
"bankName": "<string>",
"sortCode": "<string>",
"number": "<string>"
},
"expiryTime": 123,
"status": "ACTIVE",
"currency": "<string>",
"country": "<string>",
"created": "2023-11-07T05:31:56Z"
}
}Virtual Account
Create Dynamic Virtual Account
Creates a temporary, single-use virtual account that is locked to a specific amount and expires after a set duration.
POST
/
v1
/
virtual-account
/
dynamic
const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
currency: 'NGN',
country: 'NG',
amount: 5000,
duration: 30,
reference: 'TXN_REF_DYNAMIC_12345678',
accountName: 'Spar Ikorodu'
})
};
fetch('https://sandboxapi.me-cash.com/v1/virtual-account/dynamic', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"message": "virtual account created successfully",
"status": "success",
"data": {
"id": "30fe4022-09da-46fb-bafa-xxxxxxxxxxxxx",
"reference": "<string>",
"account": {
"bankName": "<string>",
"sortCode": "<string>",
"number": "<string>"
},
"expiryTime": 123,
"status": "ACTIVE",
"currency": "<string>",
"country": "<string>",
"created": "2023-11-07T05:31:56Z"
}
}Error responses
Use this table as the source of truth for troubleshootingPOST /v1/virtual-account/dynamic.
| Status | Message | What it means | How to fix |
|---|---|---|---|
| 400 | Invalid Payload | Required fields are missing or the JSON body fails validation. | Rebuild the payload with the expected schema (currency, country, amount, duration, reference, etc.). |
| 400 | Duration must be an integer | duration was provided as a string/float or omitted. | Supply duration as an integer number of minutes (e.g., 30). |
| 401 | API key missing or incorrect | Authentication header is missing, invalid, or expired. | Include the correct x-api-key for the environment. |
| 409 | Reference must be unique | The reference value already exists from an earlier request. | Reuse the first response or generate a new reference. |
| 500 | Service temporarily unavailable | Temporary backend outage. | Retry later with exponential backoff; contact support if it persists. |
Authorizations
Body
application/json
- NGN Dynamic Virtual Account
- MWK Dynamic Virtual Account
Dynamic virtual account details for Nigeria (NGN).
Currency code (NGN).
Available options:
NGN Country code (NG).
Available options:
NG The exact amount expected for the transaction.
The time in minutes for which the account will remain active.
A unique reference for the transaction.
The name of the account.
Was this page helpful?
⌘I

