Payments Quickstart
Your first payment — initialize, redirect, verify, and listen for the webhook. The Payments-specific quickstart, in under 5 minutes.
Need an account or API keys first?
This page assumes you already have a Wajub account and test API keys. If not, start with the platform quickstart — it covers account creation, keys, and SDK install, then lands you back here for the payment-specific steps.
1. Initialize a payment
Server-side, create a payment with the public key — it's the one operation safe to call with
pk_test.…:
curl https://api.wajub.com/payments \
-H "Authorization: pk_test.8f2b91c4d7e6a0f3" \
-H "Content-Type: application/json" \
-d '{
"amount": 5000,
"currency": "XAF",
"email": "client@example.com",
"callback": "https://example.com/return"
}'Wajub returns an id (trx_…) and a hosted authorization_url — redirect your customer there
to complete payment.
2. Pick how the customer pays
The call above always works, but it's the "API direct" path — full control, most code. Three other modes exist:
Related pages
3. Verify the payment server-side
Never trust the browser return alone — the customer can close the tab before it fires. Confirm
status with a GET before you fulfill the order:
https://api.wajub.com/payments/{id}curl https://api.wajub.com/payments/trx_01JXXXXXXXXXXXXX \
-H "Authorization: pk_test.8f2b91c4d7e6a0f3"{
"status": "OK",
"code": 200,
"transaction": {
"id": "trx_01JXXXXXXXXXXXXX",
"status": "succeeded",
"amount": 5000,
"currency": "XAF",
"channel": "cm.mtn"
}
}4. Listen for the webhook
The browser return isn't reliable in production — webhooks are the source of truth. Wajub sends
payment.succeeded, payment.failed, and related events the moment status changes.
Webhooks are documented once, not here
Endpoint setup, signature verification, retries, and the full event catalog live in Webhooks — this page only tells you which events matter for Payments.
| Event | Fires when |
|---|---|
payment.succeeded | Funds captured — safe to fulfill the order |
payment.failed | Customer's attempt was declined or errored |
payment.pending → payment.succeeded/payment.failed | Mobile Money confirmation is async |
5. This is sandbox — test every outcome
Test-mode payment pages accept magic phone number suffixes to simulate each result. See sandbox test numbers for the full table.
What's next?
Related pages
Was this page helpful?