Quickstart
Collect your first mobile money payment in the sandbox in under five minutes — then flip your keys to go live.
1. Get your API keys
Sign up on the NamibraPay dashboard and open Settings → API Keys. You'll get a test public key and secret immediately — you can build and test everything with them before your compliance application is approved.
# Every request is authenticated with two headers:
X-API-Key: pk_test_xxxxxxxxxxxxxxxx
X-API-Secret: sk_test_xxxxxxxxxxxxxxxxTreat your secret like a password
2. Create a transaction
The fastest way to get paid is the hosted checkout: you create a transaction, receive a hosted payment URL, and redirect your customer there. Amounts are in minor units — pesewas — so GHS 25.00 is 2500.
curl -X POST "https://api.namibrapay.com/api/v1/transactions/initialize" \
-H "X-API-Key: pk_test_xxxxxxxxxxxxxxxx" \
-H "X-API-Secret: sk_test_xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"amount": 2500,
"currency": "GHS",
"reference": "ORDER-12345",
"email": "customer@example.com",
"callbackUrl": "https://yourapp.com/order/12345"
}'The response contains an authorizationUrl. Send your customer there — the hosted page lets them pick their channel (MTN MoMo, Telecel Cash, AirtelTigo Money or bank transfer) and approve the prompt on their phone.
3. Test the payment
In the sandbox, no real money moves. You can drive any outcome you need — success, failure, timeout — with the sandbox simulator:
curl -X POST "https://api.namibrapay.com/api/v1/merchant/sandbox/simulate" \
-H "X-API-Key: pk_test_xxxxxxxxxxxxxxxx" \
-H "X-API-Secret: sk_test_xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{ "reference": "ORDER-12345", "scenario": "collection.success" }'4. Listen for the webhook
When the transaction settles, NamibraPay POSTs a signed event to your webhook endpoint. Verify the X-Webhook-Signature header before trusting the payload:
# You can replay a delivery from the dashboard:
# Webhooks → Logs → Retry, or via the API:
curl -X POST "https://api.namibrapay.com/api/v1/merchant/webhooks/logs/<log-id>/retry" \
-H "X-API-Key: pk_test_xxxxxxxxxxxxxxxx" \
-H "X-API-Secret: sk_test_xxxxxxxxxxxxxxxx"Next steps
- Charge momo wallets directly with Collections.
- Send money out with Payouts.
- Sell without writing payment code using Payment Links.
- Learn the full event catalogue in Webhooks.