Get started
Quickstart
Start a test payment with a secret key and confirm it on your server.
This guide gets you from nothing to a test payment. You'll need a terminal with curl, or any HTTP client.
1. Get a test key
In the dashboard, open Developers, choose the test environment, and generate a secret key. It starts with sk_test_ and is shown once. Test keys only ever touch fake money.
2. Start a payment
Create a payment for ₦2,500. Amounts are always whole kobo, so that's 250000. reference is yours, and sending the same reference and amount again returns the same payment.
curl -X POST https://middleware.test.nextcba.com/api/v1/pg/v1/payments/initialize \
-H "Authorization: Bearer sk_test_your_key" \
-H "Content-Type: application/json" \
-d '{"amountKobo": 250000, "reference": "order_10023", "customerEmail": "ngozi@example.com", "customerName": "Ngozi Eze"}'The response body is wrapped in data. Send your customer to data.payUrl. The same object includes a one-time accountNumber they can transfer to. In test mode that account is simulated.
3. Mark it paid in test mode
Test payments are not paid by a real transfer. Call simulate to mark this reference paid and fire payment.success. No money moves.
curl -X POST https://middleware.test.nextcba.com/api/v1/pg/v1/test/payments/order_10023/simulate \
-H "Authorization: Bearer sk_test_your_key"4. Verify before you fulfil
Read the payment back and only fulfil when status is paid and amountKobo is 250000. See Accept payments.
5. Listen for webhooks
Set a webhook URL in the dashboard. The event is payment.success. See Webhooks to check the signature.
6. Go live
When test mode behaves the way you expect, follow the go-live checklist. You keep this base URL and switch the key to sk_live_.