Checkout
The fastest way to accept payments: create a transaction, redirect the customer to a payment page we host, and get a webhook when they've paid.
The flow
- Your server calls
POST /transactions/initializewith the amount and your own reference. - You redirect the customer to the returned
authorizationUrl. - On the hosted page the customer picks a channel — MTN MoMo, Telecel Cash, AirtelTigo Money or bank transfer — and approves the payment prompt.
- We notify you with a signed webhook and redirect the customer back to your
callbackUrl.
Initialize a transaction
POST
/api/v1/transactions/initializeCreate a transaction and get a hosted checkout URL for it.
Authenticates with your API keys.
Body parameters
| Parameter | Description | |
|---|---|---|
amount | required | integerAmount in minor units (pesewas), whole cedis only. GHS 25.00 = 2500. Minimum GHS 1. |
currencydefault: GHS | required | stringISO currency code. |
reference | required | stringYour unique reference for this payment, e.g. your order id. Use it later to verify. |
feeBearer | optional | stringWho pays the transaction fee: payer (added to what the customer is charged) or merchant (deducted from your settlement). Overrides your account default. |
email | optional | stringCustomer's email — shown on the hosted checkout page. Not required to charge. |
callbackUrl | optional | stringWhere to send the customer once checkout completes. The reference is appended as a query parameter. |
metadata | optional | objectArbitrary JSON you want echoed back on the transaction and webhooks. |
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",
"feeBearer": "payer",
"email": "ama@example.com",
"callbackUrl": "https://yourapp.com/order/12345/thanks",
"metadata": { "productId": "SKU-88" }
}'200
{
"success": true,
"data": {
"reference": "NPR-8fj29dk1",
"accessCode": "NPR-8fj29dk1",
"authorizationUrl": "https://pay.namibrapay.com/checkout/NPR-8fj29dk1"
}
}Redirect the customer
Send the customer to data.authorizationUrl. The hosted page shows your business name, the amount, and lets the customer choose how to pay. Nothing else is required from your side — we render and maintain the page.
Handle the callback
When checkout completes, we redirect the customer to your callbackUrl with the transaction reference appended:
https://yourapp.com/order/12345/thanks?reference=NPR-8fj29dk1Never fulfil an order from the redirect alone
The customer controls their browser — the callback can be intercepted or faked. Treat it purely as a UX signal and confirm payment server-side via webhook or the verify endpoint.
Verify before fulfilling
Confirm the payment from your server using the reference, then fulfil:
curl "https://api.namibrapay.com/api/v1/transactions/NPR-8fj29dk1" \
-H "X-API-Key: pk_test_xxxxxxxxxxxxxxxx" \
-H "X-API-Secret: sk_test_xxxxxxxxxxxxxxxx"See Verify a transaction for the full response shape.