Generate Dynamic Account
Generate a temporary virtual account for a customer payment. The generated account details can be shared with the customer, and the payment should be verified using the returned reference or verification link.
Endpoint
POST https://api.cashonrails.com/api/v1/banktransfer/initialize
Headers
| Header | Type | Description |
|---|---|---|
| Authorization | string | Bearer token with your secret key |
| Content-Type | string | application/json |
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| string | Yes | Customer’s email address | |
| amount | string | Yes | Amount the customer should pay |
| currency | string | Yes | Currency code, for example NGN |
| reference | string | Yes | Unique transaction reference |
| provider | string | Yes | Provider code from Get Dynamic Account Providers |
| first_name | string | No | Customer’s first name |
| last_name | string | No | Customer’s last name |
Sample Payload for New Customers
{
"email": "ayomide.owolana@cashonrails.co.za",
"first_name": "ayomide",
"last_name": "fka",
"amount": "100",
"currency": "NGN",
"reference": "ref_habibi_go_away",
"provider": "wema"
}Sample Payload for Existing Customers
{
"email": "test@email.com",
"amount": "100",
"currency": "NGN",
"reference": "ref_12121121",
"provider": "wema"
}Sample Request
curl --location 'https://api.cashonrails.com/api/v1/banktransfer/initialize' \
--header 'Authorization: Bearer YOUR_SECRET_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "test@email.com",
"amount": "100",
"currency": "NGN",
"reference": "ref_12121121",
"provider": "wema"
}'Sample Response
{
"success": true,
"message": "Account generated successfully",
"data": {
"total_amount": "101.6",
"account_name": "ayomide fka",
"account_number": "8880078297",
"bank_name": "Wema Bank",
"expires": "2025-04-05T09:01:51.8093947+00:00",
"_links": {
"url": "https://api.cashonrails.com/api/v1/checkout/verify-transaction/ref_habibi_go_away",
"method": "GET"
}
}
}Error Response
{
"success": false,
"message": "Reference Already Exist"
}Best Practices
- Use a unique
referencefor every generated account. - Verify the transaction before confirming value to the customer.
- Use provider codes returned by the providers endpoint.
- Treat generated account details as temporary when an
expiresvalue is returned.
Last updated on