Payments API
Webhooks (outbound to your server)
Configure an HTTPS webhook URL on each API client in the portal (Developers → API credentials). MojoPay POSTs events for API-created resources to that client’s URL (for example https://your-store.example.com/webhooks/mojopay — not a path on the MojoPay API host). Portal pay links and portal payouts do not send webhooks. Static VA inflows (no creating API client on the collection) fan out collection.succeeded to every active webhook-configured API client on the merchant. Events use this envelope:
id, type, api_version, created, data.object.
data.object uses the same resource shape as the matching GET/create response, including fee fields when they apply (fee_amount, fee_mode, amount_payable, merchant_settlement_amount on collections/checkout; fee_amount / amount_debited on payouts). There is no separate tax line-item breakdown.
Signature verification:
- Header:
MojoPay-Signaturecontainingt=<unix>,v1=<hex>(lowercase hex, 64 characters). - Digest: HMAC-SHA256 over
{t}.{raw_body}with webhook secret — use the exact raw body bytes received. - Reject timestamps outside ±300 seconds (5 minutes) of your server time.
- Compare signatures with a constant-time function (
hash_equalsin PHP,timingSafeEqualin Node). - See Integration quick start — Verify webhook signatures for copy-paste examples.
Example event:
{
"id": "EVT_01JQXYZABCDEFGHIJKLMNOPQR",
"type": "collection.succeeded",
"api_version": "2026-04-15",
"created": "2026-04-15T10:00:00Z",
"data": {
"object": {
"id": "CL_9K2ML0ABCDEF",
"object": "collection",
"status": "succeeded",
"currency": "GHS",
"amount": "200.00",
"fee_amount": "3.00",
"fee_mode": "on_top",
"amount_payable": "203.00",
"merchant_settlement_amount": "200.00",
"merchant_reference": "ORD-2026-001",
"mobile": "233544338841",
"payment_rail": "mobile_money",
"provider": "MTN"
}
}
}
Event types (v1.0 — emitted today):
collection.processing|succeeded|failed,
checkout_session.processing|succeeded|failed,
payout.processing|succeeded|failed,
mandate.processing|succeeded|cancelled,
mandate_debit.processing|succeeded|failed.
Subscription lifecycle events (subscription.created, subscription.active, subscription.cancelled, subscription.failed, subscription.charge_failed) are emitted when mandates are linked to subscription plans.
Delivery: treat webhook delivery as at-least-once. The same logical event may be retried; use the event id to deduplicate before updating order state. Always verify MojoPay-Signature first, then process.
Retries: up to 5 delivery attempts in total. Any non-2xx response, timeout (10s), or connection error is retried after 10s, 60s, 5m, and 15m, so the last attempt happens about 21 minutes after the first. There is no self-serve replay after that; recover missed events with the status endpoints (GET /v1/transactions/verify/{merchant_reference}, GET /v1/payouts/{merchant_reference}, GET /v1/mandate_debits/status) or ask MojoPay support.
Final statuses: succeeded, failed, cancelled, and expired are terminal. processing is not final.
Static VA inflows — what your webhook must do
When a payer transfers into a merchant standing or customer dedicated static account, MojoPay creates a new succeeded collection and POSTs collection.succeeded to every API client that has a webhook URL. That collection was not created by your POST /v1/collections call, so it will not match an open order you already stored.
| Field | What you should expect |
|---|---|
data.object.id |
Omni collection id (CL_…) — primary key for upsert / dedupe of the payment itself |
data.object.merchant_reference |
Platform-assigned VAIN-CL_… (not your order id) |
data.object.payment_rail |
bank_transfer |
data.object.fee_mode |
Always absorb for static inflows |
data.object.customer_id |
Present when the credit landed on a customer dedicated VA (MC_…); omit/absent for merchant standing VA |
data.object.virtual_account |
The static account details when included |
Do this:
- Verify
MojoPay-Signature, then parse the envelope. - If
typeiscollection.succeededandmerchant_referencestarts withVAIN-(orpayment_railisbank_transferand you have no local row for thatmerchant_reference), treat it as a static inflow, not a missing order. - Upsert a payment / ledger row keyed by Omni
data.object.id(or bymerchant_reference). Credit the matching customer whencustomer_idis present; otherwise credit your merchant standing / unallocated pool. - Respond with HTTP 2xx as soon as you have durably accepted the event (after signature check + idempotent write). Retries will stop.
Do not:
- Return 404 / 4xx (“transaction not found”) because
merchant_referenceis unknown in your order table — that only forces retries and can drop the event after the retry window. Never 404 a valid signed static inflow. - Require a prior local “create collection” / checkout session for static credits — there isn’t one.
- Ignore static events on secondary API clients: every webhook-configured client receives the same fan-out; each should either process or acknowledge with 2xx if that client is not responsible for money-in.
List past inflows for a dedicated customer with GET /v1/customers/{id}/collections. See Customers and static virtual accounts.