Authentication
Every request carries a bearer key. Which key you use decides what you can do and where it is safe to put it.
| Credential | Looks like | Where it belongs |
|---|---|---|
| Merchant ID | mch_7QWv2Kx9Lp | Anywhere. It identifies you, it does not authenticate you. |
| Publishable key | pk_live_... | Browser, mobile app. Can read an intent, cannot create a charge. |
| Secret key | sk_live_... | Your server only. |
The secret key is the whole account
.env you commit, not in a screenshot in a support thread, and never in a mobile app, where it can be pulled out of the binary.Test and live
You can create test keys the moment you sign up, before your business verification clears — Dashboard → Developers → New test key. Everything behaves identically except that no money moves and no prompts reach real handsets. Live keys are only issued once your verification is approved; asking for one before that returns403 live_not_available. One honest caveat: the mock rail only loads when the API server boots in test mode — the production server boots live, so test behaviour on the production URL is not the mock. Run a local server in test mode for mock testing and verify production with a real GH₵1 payment.
sk_test_... test mode — the mock rail, fake money sk_live_... real customers, real cedis
A test key cannot read or write live data. That is enforced in the database rather than by convention, so no configuration mistake can cross the boundary.
Idempotency
/v1/payment_intentsEvery mutating request needs an Idempotency-Key header. Send the same key with the same body and you get the stored response back rather than a second charge.
-H "Idempotency-Key: 8f14e45f-ea5b-4c0f-9b3a-2c1d4e5f6a7b"
Why this is required rather than optional
| Situation | What happens |
|---|---|
| Same key, same body | You get the stored response back, with an idempotent-replay header. No second charge. |
| Same key, different body | A 409 idempotency_key_reuse. We refuse rather than guess which body you meant, because guessing could charge an amount the customer never agreed to. |
| Key still in flight | A 409 request_in_flight. Retry shortly. |
| No key at all | A 400 idempotency_key_required. |
Rotating a key
Create a new key from Dashboard → Developers, deploy it, then switch traffic over. There is no revoke button yet — an old key keeps working until it is revoked, so treat a leaked key as compromised: create a new key, switch traffic, and ask support to revoke the old one.
