Get started
Quickstart
From a test key to your first successful charge, in about ten minutes.
Take a test payment with one request. No real money moves, and you do not need a verified business to try it.
Key requirements
- A test key, beginning
sk_test_, with thepayments:writescope. curl, or any HTTP client.
How it works
- You create a key in the dashboard.
- You create a charge with it.
- A test key skips the payer's phone, so the charge settles in the same request.
Step 1 — Get a test key
Sign in to the dashboard and create one under Settings → API & developer.
A live key begins sk_live_ and moves real money. Test and live never see
each other's data: a test key cannot read a live charge, and a live key cannot
read a test one.
Step 2 — Take a payment
curl -X POST https://api.inversepay.app/api/b/v1/charges \
-H "Authorization: Bearer $INVERSEPAY_TEST_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"idempotency_key": "order-1001",
"amount_minor": 500000,
"currency": "RWF",
"payer": {
"phone_number": "250788123456",
"network": "MTN",
"country_code": "RW"
}
}'{
"id": "3f1c...",
"amount_minor": 500000,
"currency": "RWF",
"status": "succeeded",
"is_test": true
}amount_minor is 5,000 RWF: amounts are in minor units, so multiply francs by
100.
In live mode the payer approves a prompt on their phone before the charge
succeeds. is_test tells you which mode you are in.
Step 3 — Send it again
Send the same request with the same idempotency_key: you get the original
charge back, not a second one. When a request times out and you do not know
whether it landed, retry it with the same key.
Webhooks
Register an endpoint with the same test key and each test
charge sends charge.created and charge.succeeded within seconds.
Errors
| Status | code | |
|---|---|---|
401 | UNAUTHENTICATED | The key is missing or wrong. |
403 | INSUFFICIENT_AUTHORITY | The key lacks payments:write. |
422 | VALIDATION_FAILED | A field is missing or malformed. errors says which. |
All codes are on Errors.
Testing
A test charge's outcome is decided by its amount:
amount_minor | Result |
|---|---|
999999 | failed, failure_reason: insufficient_funds |
999998 | pending, and it stays there |
| anything else | succeeded |
Build your failure handling against these before you go live. More on Testing.
Developer notes
- Two idempotency keys. The
Idempotency-Keyheader replays the response to a repeated request; theidempotency_keyfield returns the original charge. Send both. See Authentication.