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 the payments:write scope.
  • curl, or any HTTP client.

How it works

  1. You create a key in the dashboard.
  2. You create a charge with it.
  3. 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"
    }
  }'
201 Created
{
  "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

Statuscode
401UNAUTHENTICATEDThe key is missing or wrong.
403INSUFFICIENT_AUTHORITYThe key lacks payments:write.
422VALIDATION_FAILEDA 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_minorResult
999999failed, failure_reason: insufficient_funds
999998pending, and it stays there
anything elsesucceeded

Build your failure handling against these before you go live. More on Testing.

Developer notes

  • Two idempotency keys. The Idempotency-Key header replays the response to a repeated request; the idempotency_key field returns the original charge. Send both. See Authentication.

What's next

On this page