NamibraPay

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

  1. Your server calls POST /transactions/initialize with the amount and your own reference.
  2. You redirect the customer to the returned authorizationUrl.
  3. On the hosted page the customer picks a channel — MTN MoMo, Telecel Cash, AirtelTigo Money or bank transfer — and approves the payment prompt.
  4. We notify you with a signed webhook and redirect the customer back to your callbackUrl.

Initialize a transaction

POST/api/v1/transactions/initialize
Create a transaction and get a hosted checkout URL for it.

Authenticates with your API keys.

Body parameters

ParameterDescription
amountrequiredintegerAmount in minor units (pesewas), whole cedis only. GHS 25.00 = 2500. Minimum GHS 1.
currencydefault: GHSrequiredstringISO currency code.
referencerequiredstringYour unique reference for this payment, e.g. your order id. Use it later to verify.
feeBeareroptionalstringWho pays the transaction fee: payer (added to what the customer is charged) or merchant (deducted from your settlement). Overrides your account default.
emailoptionalstringCustomer's email — shown on the hosted checkout page. Not required to charge.
callbackUrloptionalstringWhere to send the customer once checkout completes. The reference is appended as a query parameter.
metadataoptionalobjectArbitrary 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-8fj29dk1

Never 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.