Guides
Virtual accounts
Give every customer or order its own account number, so transfers match themselves.
A virtual account is a 10-digit account number that belongs to one customer, order or invoice. Money sent to it lands in your CSwitch balance, and you know exactly who paid.
Permanent or one-time
- Permanent accounts suit regular customers, like a distributor's retailers. Leave out
expires_at. - One-time accounts suit single orders or invoices. Set
expires_atand the number stops accepting money after that.
Create an account
Create a virtual account
curl https://sandbox.cswitchcba.com/v1/virtual-accounts \
-H "Authorization: Bearer $CSWITCH_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Ngozi Eze", "customer": "cus_8Fq2"}'Show the account_number and account_name to your customer. They can pay from any Nigerian bank app.
Know when money arrives
Every credit triggers a virtual_account.credited webhook with the amount, the payer's name and your customer ID, so you can update the order straight away.
To check the total received at any time, look the account up with GET /virtual-accounts/{account_number}.