Get started
Quickstart
Make your first request to the CSwitch sandbox in five minutes.
This guide gets you from nothing to a working sandbox request. You'll need a terminal with curl, or any HTTP client.
1. Get a sandbox key
In the dashboard, open Developers and copy your secret key. Sandbox keys start with sk_test_ and only ever touch fake money.
2. Make your first request
Create a virtual account: a real-looking account number that belongs to one of your customers.
curl https://sandbox.cswitchcba.com/v1/virtual-accounts \
-H "Authorization: Bearer sk_test_your_key" \
-H "Content-Type: application/json" \
-d '{"name": "Ngozi Eze", "customer": "cus_8Fq2"}'You'll get back a 10-digit account_number. In live mode, any transfer to it lands in your CSwitch balance with Ngozi's name on it.
3. Start a payment
Create a payment for ₦42,000. Amounts are always in kobo, so that's 4200000.
curl https://sandbox.cswitchcba.com/v1/payments \
-H "Authorization: Bearer sk_test_your_key" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"amount": 4200000, "email": "ngozi@example.com", "reference": "order_2231"}'Send your customer to the checkout_url in the response. When they've paid, verify the payment on your server.
4. Listen for webhooks
Set a webhook URL in the dashboard to hear about payments as they happen. See Webhooks to check signatures.
5. Go live
When everything works in the sandbox, follow the go-live checklist.