Build with the WunaPay API.Développez avec l’API WunaPay.
A simple REST API with JSON. Start a Mobile Money payment with one request, send the customer to a hosted checkout, refund, pay people out and hold money in escrow — safely retried with Idempotency-Key.Une API REST simple en JSON. Lancez un paiement Mobile Money en une requête, envoyez le client vers une page hébergée, remboursez, payez vos bénéficiaires et gardez l’argent en séquestre — avec des nouveaux essais sûrs grâce à Idempotency-Key.
Last updated: November 2026 (0.9.14)Dernière mise à jour : novembre 2026 (0.9.14)
Getting started
- Create a free account at app.wunapay.com. You start in test mode.
- In your dashboard, open Developers and copy your secret key (
sk_test_…). - Send your first payment request from your server (below), or use the hosted checkout.
- Add a webhook so your server learns about each payment automatically.
Keep your secret key on your server only. Never put it in a mobile app or in website code that visitors can see. If it leaks, replace it at once under Developers → Roll key (the old key stops working) and tell support@wunapay.com.
Choose your integration
| You want… | Use | Effort |
|---|---|---|
| To sell on WhatsApp, Facebook or by SMS | Payment links (dashboard) | No code |
| A WooCommerce shop | WunaPay plugin | 10 minutes |
| Your own website, quickest way | Hosted checkout | A few lines of code |
| Your own payment screen or app | Payments API (this page) | Developer |
| To pay suppliers, staff or customers | Payouts API or dashboard | No code or developer |
| Your app to use a customer’s WunaPay wallet | Partner wallet (approved apps) | Developer |
Keys & live mode
Send your secret key in the Authorization header of every request. Base URL: https://app.wunapay.com, HTTPS only.
Several businesses, one login (new in 0.9.16). Each business has its own keys, balance, team and verification. If you run several, sign in once and switch with the building icon at the top of the dashboard (Create another business is there too). Invited to another business? Open the invitation and sign in with your usual login: no new password.
curl https://app.wunapay.com/v1/balance \
-H "Authorization: Bearer sk_test_..." | Key | What it does | When you get it |
|---|---|---|
sk_test_… | Test mode: simulated money, the MTN sandbox and the Orange simulator. Everything else works as it will live. | At sign-up, under Developers. |
sk_live_… | Real money. Test and live data are fully separate: other balance, other ids, other webhook address. | Only after WunaPay approved your business (verification + go-live request) and you switch real payments on. Shown once. |
Today WunaPay is in test mode. Real payments stay switched off for everyone until WunaPay works with a licensed partner and the operators approve it. Until then, calls with a live key answer 503 live_not_available. Build and test everything with sk_test_.
Requests & livemode
- JSON in, JSON out. Send
Content-Type: application/json. Every answer, errors included, is JSON. - Amounts are whole numbers in XAF (FCFA): 100 to 1,000,000 per payment during the test phase.
- Phone numbers: 9 digits (
6XXXXXXXX) or with the country code (+2376XXXXXXXX). Numbers in answers are masked (last 4 digits). - Dates in objects are UTC, as
YYYY-MM-DD HH:MM:SS. Eventcreated_atis ISO 8601. livemode: every payment, payout, refund, session, balance and event says"livemode": true(real money) orfalse(test). Check it before you ship goods. A key only ever sees objects of its own mode: a test id gives404with a live key.- IDs have a prefix:
pay_payment,cs_checkout session,po_payout,re_refund,esc_escrow,evt_event,cus_customer.
Idempotency-Key: safe retries
Mobile networks drop. If your request times out you can’t know whether the payment or payout was created. Send an Idempotency-Key header with every POST and simply send the same request again: WunaPay does the work once and gives you the first answer.
curl https://app.wunapay.com/v1/payouts \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: salary_2026_11_ngono" \
-d '{"amount":50000,"method":"mtn_momo","phone":"+2376XXXXXXXX","reference":"salary_2026_11_ngono"}'
# Same key + same body again (a retry after a timeout):
HTTP/1.1 201 Created
Idempotent-Replayed: true
{ "id": "po_Lk9Jh3Gf5Ds1", "object": "payout", "status": "pending", ... } <- the first answer, nothing sent twice| Rule | Detail |
|---|---|
| Key | Any text of 1–255 characters, unique per operation (your order or salary line is perfect). Otherwise 400 invalid_idempotency_key. |
| Kept for | 24 hours, per business and per mode (test and live keys never share keys). |
| Same key, same body | The first answer again — same HTTP status and body — with the header Idempotent-Replayed: true. Nothing is done twice. The order of JSON fields does not matter. |
| Same key, other body or path | 422 idempotency_key_reused. Use a new key for a new request. |
| First request still running | 409 idempotency_in_progress. Wait a second and retry with the same key. New in 0.9.15: if the first request died (a restart on our side), a retry after 2 minutes runs it again instead of getting 409 for 24 hours. |
| Errors | Answers like 400 invalid_phone are kept too: after fixing the body, use a new key. Refusals before anything happened (401, 403, 429) and our own errors (5xx, new in 0.9.15) are not kept, so you can retry them with the same key. |
| Not covered | POST /v1/wallet/links/confirm (its answer holds a one-time secret) and the /v1/wallet/app/* calls. |
The Node.js and PHP libraries (0.5.0) and the WooCommerce plugin (1.3.0) send a key automatically.
Rate limits
Up to 300 requests a minute per server address and 300 a minute per API key, from any number of servers. Above that you get 429 too_many_requests and a Retry-After header (seconds). Partner wallet calls have their own limits (see Partner wallet). Don’t poll faster than every few seconds: use webhooks.
Lists & pagination
| List | Filters | Pages |
|---|---|---|
GET /v1/payments | status (pending, succeeded, failed, needs_review), reference, limit (1–100, default 20) | Newest first. has_more; next page with before=<last id> (new in 0.9.15). |
GET /v1/payouts | status, kind (payout, withdrawal, refund), reference, limit (1–100, default 20) | Newest first. has_more; next page with before=<last id>. |
GET /v1/events | type, since, limit (1–100, default 50) | Without since: newest first. With since=<event id>: the events after it, oldest first; repeat with the last id while has_more is true. |
IP allow-list
Under Developers → IP allow-list you can limit your key to your servers’ addresses (IPv4, or ranges like 203.0.113.0/24). When the list is not empty, calls from any other address get 403 ip_not_allowed with the address we saw in ip, so you know what to add. An empty list allows every address.
Real-money payouts by API need an allow-list (new in 0.9.15): with a live key, POST /v1/payouts is refused with 403 ip_allowlist_required until at least one address is in the list. Test keys are not affected.
API reference
| Method | Path | What it does |
|---|---|---|
POST | /v1/payments | Start a payment: the customer gets a prompt on their phone. |
GET | /v1/payments/{id} | A payment and its latest status. |
GET | /v1/payments | Your payments, newest first (filters, cursor – new in 0.9.15). |
POST | /v1/payments/{id}/cancel | Stop waiting for a pending payment (new in 0.9.15). |
POST | /v1/checkout/sessions | Create a hosted checkout page. |
GET | /v1/checkout/sessions/{id} | A session, its payment and escrow. |
POST | /v1/payouts | Send money to a Mobile Money wallet. |
GET | /v1/payouts/{id} | A payout, withdrawal or refund. |
GET | /v1/payouts | Money out, newest first (cursor). |
GET | /v1/name-enquiry | Name on a Mobile Money account, before a payout (new in 0.9.14). |
POST | /v1/refunds | Refund all or part of a payment. |
GET | /v1/refunds/{id} | A refund and its status. |
GET | /v1/escrows/{id} | An escrow (protected payment). |
POST | /v1/escrows/{id}/deliver | Mark the order delivered. |
POST | /v1/escrows/{id}/confirm | Buyer confirmed: release now (partner apps). |
POST | /v1/escrows/{id}/cancel | Cancel: full refund to the buyer. |
GET | /v1/events | Catch up on webhook events. |
GET | /v1/balance | Available balance and fee rates. |
POST | /v1/plans | Create a subscription or instalment plan (new in 0.9.16). |
GET | /v1/plans | Your plans. |
POST | /v1/subscriptions | Enrol a customer on a plan (new in 0.9.16). |
GET | /v1/subscriptions | Enrolments with their dues; pause, resume, cancel, collect, cash. |
GET | /v1/wallet/agents | Cash agents near a wallet holder (partner apps, new in 0.9.16). |
OpenAPI file (new in 0.9.15): every /v1 call, its fields and its answers in one machine-readable file, openapi.json (OpenAPI 3). Import it into Postman, Insomnia or a code generator.
Create a payment — POST /v1/payments
| Field | Type | Description |
|---|---|---|
amount | integer | Required. Price in XAF, 100 to 1,000,000. |
method | string | Required. mtn_momo or orange_money. |
phone | string | Required. The customer’s Mobile Money number. |
reference | string | Optional. Your order number (max 64). Defaults to the payment id. |
customer_name | string | Optional (max 120). Saved on your customer list. |
customer_email | string | Optional (max 200). For receipts. |
curl https://app.wunapay.com/v1/payments \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order_1042_pay" \
-d '{"amount":25000,"method":"mtn_momo","phone":"+2376XXXXXXXX","reference":"order_1042"}'
Answer: 201 Created with a payment object, status pending. The customer now sees a prompt on their phone and confirms with their PIN (WunaPay never sees it).
Get a payment — GET /v1/payments/{id}
curl https://app.wunapay.com/v1/payments/pay_8kQ2mZx1Lp7r \
-H "Authorization: Bearer sk_test_..."
Asking also makes WunaPay check with the operator (at most every few seconds). Better than polling: a webhook.
List payments — GET /v1/payments
curl "https://app.wunapay.com/v1/payments?status=succeeded&limit=50" \
-H "Authorization: Bearer sk_test_..."
{ "object": "list", "data": [ { "id": "pay_8kQ2mZx1Lp7r", "object": "payment", ... }, ... ], "has_more": true }
# next page: the payments before the last one you received
curl "https://app.wunapay.com/v1/payments?status=succeeded&limit=50&before=pay_Ab3Cd4Ef5Gh6" \
-H "Authorization: Bearer sk_test_..."
New in 0.9.15: pages. Newest first, 20 by default (limit 1–100). When has_more is true, ask again with before= the id of the last payment you received. Filters: status (pending, succeeded, failed, needs_review) and reference. An id that is not yours (or from the other mode) gives 400 invalid_cursor.
Cancel a pending payment — POST /v1/payments/{id}/cancel
New in 0.9.15. The customer left, or the order was cancelled: stop waiting. The payment becomes failed with failure_reason: "cancelled" and payment.failed is sent. Only a pending payment can be cancelled (otherwise 409 payment_not_cancellable).
The operator cannot take back a prompt already sent to the phone. If the customer still approves it, the payment becomes succeeded later and you receive payment.succeeded: always deliver on that event, and refund if you no longer want the order.
curl -X POST https://app.wunapay.com/v1/payments/pay_8kQ2mZx1Lp7r/cancel \
-H "Authorization: Bearer sk_test_..." \
-H "Idempotency-Key: cancel-order-1042"
{ "id": "pay_8kQ2mZx1Lp7r", "object": "payment", "status": "failed", "failure_reason": "cancelled", ... }The payment object
{
"id": "pay_8kQ2mZx1Lp7r",
"object": "payment",
"reference": "order_1042",
"method": "mtn_momo",
"phone": "••••••••0000",
"amount": 25000,
"fee": 500,
"net": 24500,
"currency": "XAF",
"status": "pending",
"failure_reason": null,
"checkout_session": null,
"invoice": null,
"customer": "cus_Xc4Vb5Nm6Qw7",
"source": "api",
"refunded": 0,
"livemode": false,
"created_at": "2026-11-01 09:30:00"
}| Field | Meaning |
|---|---|
amount | What the customer is asked to pay. If you chose “customer pays the fee” in Settings, the fee is included here. |
fee | WunaPay’s fee in XAF (2%, less with volume discounts; +0.5% for escrow). |
net | What reaches your balance when it succeeds: amount − fee. |
status | pending → succeeded or failed. needs_review: the operator could not be reached for 24 hours; our team checks it by hand and it then ends as succeeded or failed. |
failure_reason | When failed, e.g. declined_by_customer, expired, operator_unavailable. |
source | api, checkout, link or invoice. |
checkout_session / invoice / customer | Ids of the session, invoice and customer the payment belongs to, or null. |
refunded | Total refunded so far (refunds that did not fail). |
livemode | true real money, false test. |
Late answers from the operator. If a payment is still not confirmed after 30 minutes (the customer didn’t answer, or the operator gave no clear answer), it fails with expired. WunaPay keeps asking the operator for 48 hours: if it then confirms the money was taken, the payment becomes succeeded and you get a payment.succeeded event after the payment.failed one. Handle that case (for example, deliver or refund).
Checkout sessions — POST /v1/checkout/sessions, GET /v1/checkout/sessions/{id}
Full guide: Hosted checkout. Fields: amount and return_url (required), cancel_url, reference (max 64), description (max 120), and optionally:
| Field | Type | Description |
|---|---|---|
escrow | true or object | Hold the money until delivery (escrow). release_days 1–60 (default 7), description (max 300). |
splits | array | Test mode only. Up to 10 {phone, amount, label} paid into those WunaPay wallets when the escrow is released (turns escrow on). Each phone must have a wallet; the total can’t be more than you receive after the fee. With a live key: 409 splits_test_only. |
curl https://app.wunapay.com/v1/checkout/sessions \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order_1043_checkout" \
-d '{"amount":15000,"reference":"order_1043","description":"2 T-shirts",
"return_url":"https://yourshop.cm/order/1043/thanks","cancel_url":"https://yourshop.cm/cart"}'Answer 201 Created:
{
"id": "cs_Qw3rT9yUiOp1",
"object": "checkout_session",
"amount": 15000,
"currency": "XAF",
"reference": "order_1043",
"description": "2 T-shirts",
"status": "open",
"payment": null,
"url": "https://app.wunapay.com/checkout/cs_Qw3rT9yUiOp1",
"return_url": "https://yourshop.cm/order/1043/thanks",
"cancel_url": "https://yourshop.cm/cart",
"created_at": "2026-11-01 09:30:00",
"expires_at": "2026-11-01 10:30:00",
"escrow": null,
"livemode": false
}# Test mode only: a marketplace order held in escrow, with part of it for the rider when it is released
curl https://app.wunapay.com/v1/checkout/sessions \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{"amount":15000,"reference":"order_1044","return_url":"https://yourshop.cm/thanks",
"escrow":{"release_days":3,"description":"Grilled fish, delivered"},
"splits":[{"phone":"+2376XXXXXXXX","amount":1500,"label":"Rider"}]}'curl https://app.wunapay.com/v1/checkout/sessions/cs_Qw3rT9yUiOp1 \
-H "Authorization: Bearer sk_test_..."
# → "status": "paid", "payment": { "id": "pay_…", "status": "succeeded", ... }, "escrow": { ... } or null
Status: open, paid or expired (after 60 minutes). With GET, payment is the full payment object and escrow the full escrow object once paid.
Payouts — POST /v1/payouts, GET /v1/payouts/{id}, GET /v1/payouts
Full guide: Payouts. Fields: amount (what the recipient receives), method, phone, reference (max 64), name (recipient name, max 120), and from 0.9.14 expected_name + name_check (warn or require) to check the account name before paying (see name enquiry). The 1% fee is taken from your balance on top.
curl https://app.wunapay.com/v1/payouts \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: supplier_17_nov" \
-d '{"amount":50000,"method":"mtn_momo","phone":"+2376XXXXXXXX","reference":"supplier_17_nov","name":"Ets Fotso"}'{
"id": "po_Lk9Jh3Gf5Ds1",
"object": "payout",
"reference": "supplier_17_nov",
"method": "mtn_momo",
"phone": "••••••••0000",
"amount": 50000,
"fee": 500,
"total": 50500,
"currency": "XAF",
"status": "pending",
"failure_reason": null,
"payment": null,
"batch": null,
"beneficiary_name": "Ets Fotso",
"channel": "api",
"created_by": "api",
"approved_by": null,
"livemode": false,
"created_at": "2026-11-01 09:45:00"
}
object is payout, withdrawal (to your own wallet, from the dashboard) or refund. Status: pending → succeeded or failed (money and fee back on your balance). Also awaiting_approval / cancelled (dashboard payouts that need a second person), and needs_review: not confirmed after 24 hours, the money stays reserved while our team checks with the operator.
curl "https://app.wunapay.com/v1/payouts?kind=payout&status=failed&limit=50" \
-H "Authorization: Bearer sk_test_..."
{ "object": "list", "data": [ ... ], "has_more": true }
# next page: pass the id of the last item you received
curl "https://app.wunapay.com/v1/payouts?kind=payout&status=failed&limit=50&before=po_Lk9Jh3Gf5Ds1" \
-H "Authorization: Bearer sk_test_..."
Refunds — POST /v1/refunds, GET /v1/refunds/{id}
Fields: payment (required, a succeeded payment), amount (optional; default: everything not refunded yet; min 100), reason (optional, max 64). The money goes back to the customer’s number from your balance; refunds are free. Several partial refunds are possible up to the payment amount. A payment held in escrow is refunded with escrow cancel instead.
curl https://app.wunapay.com/v1/refunds \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: refund_order_1042" \
-d '{"payment":"pay_8kQ2mZx1Lp7r","amount":5000,"reason":"Out of stock"}'
{ "id": "re_Hj6Kl7Mn8Pq9", "object": "refund", "reference": "Out of stock", "method": "mtn_momo",
"amount": 5000, "fee": 0, "total": 5000, "status": "pending", "payment": "pay_8kQ2mZx1Lp7r",
"livemode": false, ... }curl https://app.wunapay.com/v1/refunds/re_Hj6Kl7Mn8Pq9 \
-H "Authorization: Bearer sk_test_..."
Escrows — /v1/escrows/{id}
An escrow is created by a checkout session (or a partner wallet payment) with escrow. WunaPay holds the money until the buyer confirms, or until release_days after delivery (or after payment if you never mark delivery) with no complaint. Its id is in GET /v1/checkout/sessions/{id} and in the escrow.* events.
| Call | What it does | Errors |
|---|---|---|
GET /v1/escrows/{id} | Read the escrow. | escrow_not_found |
POST …/deliver | Body {note} (max 300). Marks the order delivered; the automatic release is counted from now. | escrow_not_active |
POST …/confirm | The buyer confirmed in your app: release now and pay the splits. Approved partner apps only; for a wallet payment send the buyer’s WunaPay-Wallet link token. | wallet_partner_not_approved wallet_link_required not_the_buyer escrow_not_active |
POST …/cancel | Body {reason}. Order cancelled before delivery: the buyer gets all the money back, splits are not paid. | escrow_not_active |
curl https://app.wunapay.com/v1/escrows/esc_Zx8Cv7Bn6Ma5 -H "Authorization: Bearer sk_test_..."
curl https://app.wunapay.com/v1/escrows/esc_Zx8Cv7Bn6Ma5/deliver -H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" -d '{"note":"Delivered to the front desk"}'
curl https://app.wunapay.com/v1/escrows/esc_Zx8Cv7Bn6Ma5/cancel -H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" -d '{"reason":"Order cancelled"}'
# approved partner apps only; for a wallet payment add the buyer's link token
curl -X POST https://app.wunapay.com/v1/escrows/esc_Zx8Cv7Bn6Ma5/confirm -H "Authorization: Bearer sk_test_..." \
-H "WunaPay-Wallet: wlk_..." {
"id": "esc_Zx8Cv7Bn6Ma5",
"object": "escrow",
"status": "held",
"payment": "pay_8kQ2mZx1Lp7r",
"amount": 15000,
"fee": 375,
"net_to_seller": 14625,
"description": "Grilled fish, delivered",
"release_days": 3,
"buyer_name": "Ines",
"paid_at": "2026-11-01 09:31:00",
"delivered_at": null,
"delivery_note": null,
"auto_release_at": "2026-11-04 09:31:00",
"dispute_reason": null,
"dispute_opened_at": null,
"seller_response": null,
"resolution": null,
"resolution_note": null,
"released_amount": null,
"refunded_amount": null,
"closed_at": null,
"created_at": "2026-11-01 09:30:00",
"splits": [ ... ]
}
Status: awaiting_payment → held → released, refunded or split (part each, decided by our team after a dispute); disputed while the buyer’s complaint is open; cancelled if the payment failed. While an escrow is held, its money is not in your available balance.
Events — GET /v1/events
Every webhook event is kept, even when you have no webhook address for that mode. If your server was down, catch up: keep the id of the last event you handled and ask for the ones after it. delivery tells you whether the webhook got through.
curl "https://app.wunapay.com/v1/events?since=evt_Tg7Hk2LmN0pq&limit=100" \
-H "Authorization: Bearer sk_test_..."
{
"object": "list",
"has_more": false,
"data": [
{
"id": "evt_Ab1Cd2Ef3Gh4",
"object": "event",
"type": "payment.succeeded",
"livemode": false,
"created_at": "2026-11-01T09:30:12.000Z",
"data": { "id": "pay_8kQ2mZx1Lp7r", "object": "payment", "status": "succeeded", ... },
"delivery": { "delivered": false, "attempts": 3, "last_status": "timeout" }
}
]
}
Balance — GET /v1/balance
{
"object": "balance",
"available": 98000,
"currency": "XAF",
"livemode": false,
"fee_percent": 2,
"payout_fee_percent": 1
}
available is what you can pay out or withdraw now, in the key’s mode: successful payments minus fees, minus money out that is pending, awaiting approval or succeeded, minus money held in escrow.
Errors
Errors return an HTTP status and a JSON body with error. Some add details (or ip) to help you fix the request. Your code should read error; the list may grow.
HTTP/1.1 403 Forbidden
{ "error": "ip_not_allowed", "ip": "203.0.113.7" }
HTTP/1.1 400 Bad Request
{ "error": "splits_too_large", "details": { "max": 14625 } }| HTTP | error | Meaning | What to do |
|---|---|---|---|
| 400 | invalid_json | The body is not valid JSON. | Send Content-Type: application/json and a valid JSON body. |
| 400 | invalid_amount | Amount missing, not a whole number, or outside 100–1,000,000 FCFA (also when the fee added for the customer goes over the limit). | Send a whole number of FCFA in the range. |
| 400 | invalid_method | method is not mtn_momo or orange_money. | Fix the value. |
| 400 | invalid_phone | The phone number is not valid. | Send 9 digits (6XXXXXXXX) or the full number with 237. |
| 400 | invalid_return_url invalid_cancel_url | Checkout URL missing, not http(s) or longer than 500 characters. | Send a full https:// address. |
| 400 | invalid_idempotency_key | The Idempotency-Key header is empty or longer than 255 characters. | Send 1–255 characters, e.g. your order number. |
| 400 | insufficient_balance | Payout or refund amount (plus fee) is more than your available balance. | Check GET /v1/balance; wait for more payments. |
| 400 | daily_limit_reached | This payout would go over the daily payout limit set in your dashboard. | Try tomorrow (Cameroon time) or raise the limit. |
| 400 | api_daily_cap_reached | Real-money API payouts today would go over your API safety cap. details has cap and sent_today. | Pay from the dashboard or raise the cap. |
| 400 | invalid_name_check expected_name_required | Payout name_check is not off, warn or require, or require was sent without expected_name. New in 0.9.14. | Fix the fields. |
| 400 | payment_not_refundable | Only a succeeded payment can be refunded. | Check the payment status first. |
| 400 | invalid_refund_amount | Refund below 100 FCFA or more than what is left to refund. | Send a smaller amount, or none for the full rest. |
| 400 | invalid_since invalid_cursor | The since event id or before payment or payout id is not one of yours (or not in this mode). | Use an id you received from the same key. |
| 400 | invalid_release_days | Escrow release_days is not a whole number from 1 to 60. | Fix the value (default 7). |
| 400 | invalid_splits invalid_split_phone invalid_split_amount | splits is not a list of 1–10 items, or a phone or amount (min 100) is wrong. | Fix the list. |
| 400 | split_not_a_wallet | A split phone has no WunaPay wallet. details.phone says which (masked). | Ask that person to open a wallet first. |
| 400 | splits_too_large | Splits add up to more than what you receive after the fee. details.max is the most allowed. | Lower the split amounts. |
| 401 | invalid_api_key | Missing, wrong or replaced secret key — or an sk_live_ key while real payments are off for your account. | Copy the key again from Developers. |
| 403 | account_suspended | Your account is suspended. | Write to support@wunapay.com. |
| 403 | merchant_unavailable account_frozen | Your account is frozen by the WunaPay team: no money can move. | Write to support@wunapay.com. |
| 403 | payouts_on_hold | Money going out is on hold for your account (payments still come in). | Write to support@wunapay.com. |
| 403 | payouts_disabled_for_channel | Your payout rules allow payouts only from the dashboard (or not at all). | Change it under Settings → Payout rules. |
| 403 | recipient_not_saved | API payouts are limited to saved recipients, and this number is not saved. | Save the recipient in the dashboard first. |
| 403 | ip_not_allowed | Your IP allow-list is on and this server’s address is not in it. The answer includes ip. | Add that address under Developers → IP allow-list. |
| 403 | wallet_partner_not_approved | This call is only for apps the WunaPay team approved as wallet partners. | See Partner wallet. |
| 403 | not_the_buyer | Escrow confirm for a wallet payment was sent with someone else’s wallet token. | Send the buyer’s own link token. |
| 404 | payment_not_found payout_not_found refund_not_found session_not_found escrow_not_found | No object with this id in your account in this mode (a test id is not found with a live key). | Check the id and which key you use. |
| 404 | not_found | Unknown API path. | Check the method and path. |
| 409 | idempotency_in_progress | The first request with this Idempotency-Key is still running. | Wait a second and send it again with the same key. |
| 409 | payment_not_cancellable | Only a pending payment can be cancelled. New in 0.9.15. | Read it with GET /v1/payments/{id}; refund it if it succeeded. |
| 409 | escrow_active | This payment is held in escrow: refund it with POST /v1/escrows/{id}/cancel instead. | Use the escrow call. |
| 409 | escrow_not_active | The escrow is not held any more (already released, refunded or cancelled), or not in the right state. | Read it with GET /v1/escrows/{id}. |
| 409 | splits_test_only wallet_test_only | Splits and the WunaPay wallet work in test mode only (the wallet is not licensed for real money). | Use an sk_test_ key. |
| 413 | request_too_large file_too_large | The JSON body is too big (more than 200 KB), or an uploaded file is too big. request_too_large is new in 0.9.15 (before, both said file_too_large). | Send less data per request. |
| 422 | name_mismatch name_check_unavailable | Payout sent with name_check: "require": the account name does not match expected_name (or no account), or the operator could not be asked. Nothing was sent. New in 0.9.14. | Check the number with GET /v1/name-enquiry; see Name enquiry. |
| 422 | idempotency_key_reused | This Idempotency-Key was already used with a different body or path in the last 24 hours. | Use a new key for a new request. |
| 429 | too_many_requests | More than 300 requests a minute. The Retry-After header says how many seconds to wait. | Wait, then retry (with the same Idempotency-Key for a POST). |
| 500 | server_error | Something went wrong on our side. | Retry a GET. Retry a POST only with the same Idempotency-Key (5xx answers are not kept, so the retry really runs). |
| 503 | live_not_available method_not_live | Real payments are not switched on yet for WunaPay, or not for this operator (Orange Money live is not connected). | Stay in test mode; we will announce it in the changelog. |
Partner wallet calls have their own errors: see Partner wallet.
Testing
All accounts start in test mode: no real money moves. In test mode MTN payments go to MTN’s sandbox when it is connected on our side; otherwise both operators use WunaPay’s simulator.
| Method | Test numbers |
|---|---|
| MTN MoMo (MTN sandbox, when connected) | Normal numbers such as 237670000000 succeed. 46733123450 fails on purpose. |
| Orange Money, and MTN when the sandbox is not connected (simulator) | Ending in 01: declined. Ending in 02: expired. Anything else succeeds after a few seconds. |
If a test MTN payment behaves like the simulator (numbers ending in 01 declined, 02 expired), the sandbox is not connected at that moment: use those simulator rules for both operators. Test payments in the dashboard and API are clearly marked “test”.
Libraries for Node.js and PHP, and the WooCommerce plugin, are on the Plugins & SDKs page. Questions? Write to support@wunapay.com.
Démarrer
- Créez un compte gratuit sur app.wunapay.com. Vous commencez en mode test.
- Dans votre tableau de bord, ouvrez Développeurs et copiez votre clé secrète (
sk_test_…). - Envoyez votre première demande de paiement depuis votre serveur (ci-dessous), ou utilisez le paiement hébergé.
- Ajoutez un webhook pour que votre serveur soit informé de chaque paiement automatiquement.
Gardez votre clé secrète uniquement sur votre serveur. Ne la mettez jamais dans une application mobile ou dans le code d’un site visible par les visiteurs. En cas de fuite, remplacez-la tout de suite dans Développeurs → Renouveler la clé (l’ancienne cesse de fonctionner) et prévenez support@wunapay.com.
Choisir l’intégration
| Vous voulez… | Utilisez | Effort |
|---|---|---|
| Vendre sur WhatsApp, Facebook ou par SMS | Liens de paiement (tableau de bord) | Sans code |
| Une boutique WooCommerce | Plugin WunaPay | 10 minutes |
| Votre propre site, au plus vite | Paiement hébergé | Quelques lignes de code |
| Votre propre écran de paiement ou application | API Paiements (cette page) | Développeur |
| Payer fournisseurs, employés ou clients | API Transferts ou tableau de bord | Sans code ou développeur |
| Que votre app utilise le portefeuille WunaPay d’un client | Portefeuille partenaire (apps approuvées) | Développeur |
Clés & mode réel
Envoyez votre clé secrète dans l’en-tête Authorization de chaque requête. URL de base : https://app.wunapay.com, HTTPS uniquement.
Plusieurs entreprises, un seul compte (nouveau en 0.9.16). Chaque entreprise a ses propres clés, son solde, son équipe et sa vérification. Si vous en gérez plusieurs, connectez-vous une fois et changez avec l’icône immeuble en haut du tableau de bord (Créer une autre entreprise s’y trouve aussi). Invité dans une autre entreprise ? Ouvrez l’invitation et connectez-vous avec votre compte habituel : pas de nouveau mot de passe.
curl https://app.wunapay.com/v1/balance \
-H "Authorization: Bearer sk_test_..." | Clé | Rôle | Quand vous l’obtenez |
|---|---|---|
sk_test_… | Mode test : argent simulé, sandbox MTN et simulateur Orange. Tout le reste fonctionne comme en réel. | À l’inscription, dans Développeurs. |
sk_live_… | Argent réel. Les données test et réelles sont séparées : autre solde, autres identifiants, autre adresse de webhook. | Seulement après l’approbation de votre entreprise par WunaPay (vérification + demande de passage en réel) et l’activation du réel. Affichée une seule fois. |
Aujourd’hui, WunaPay est en mode test. Les paiements réels restent désactivés pour tous tant que WunaPay ne travaille pas avec un partenaire agréé et que les opérateurs ne l’ont pas approuvé. D’ici là, les appels avec une clé réelle répondent 503 live_not_available. Construisez et testez tout avec sk_test_.
Requêtes & livemode
- JSON en entrée et en sortie. Envoyez
Content-Type: application/json. Toutes les réponses, erreurs comprises, sont en JSON. - Montants : nombres entiers en XAF (FCFA), de 100 à 1 000 000 par paiement pendant la phase de test.
- Numéros : 9 chiffres (
6XXXXXXXX) ou avec l’indicatif (+2376XXXXXXXX). Dans les réponses, les numéros sont masqués (4 derniers chiffres). - Dates des objets en UTC, au format
YYYY-MM-DD HH:MM:SS. Lecreated_atdes événements est en ISO 8601. livemode: chaque paiement, transfert, remboursement, session, solde et événement indique"livemode": true(argent réel) oufalse(test). Vérifiez-le avant de livrer. Une clé ne voit que les objets de son mode : un identifiant test donne404avec une clé réelle.- Identifiants préfixés :
pay_paiement,cs_session,po_transfert,re_remboursement,esc_séquestre,evt_événement,cus_client.
Idempotency-Key : réessayer sans risque
Les réseaux mobiles coupent. Si votre requête expire, vous ne savez pas si le paiement ou le transfert a été créé. Envoyez un en-tête Idempotency-Key avec chaque POST et renvoyez simplement la même requête : WunaPay ne fait le travail qu’une fois et vous rend la première réponse.
curl https://app.wunapay.com/v1/payouts \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: salary_2026_11_ngono" \
-d '{"amount":50000,"method":"mtn_momo","phone":"+2376XXXXXXXX","reference":"salary_2026_11_ngono"}'
# Same key + same body again (a retry after a timeout):
HTTP/1.1 201 Created
Idempotent-Replayed: true
{ "id": "po_Lk9Jh3Gf5Ds1", "object": "payout", "status": "pending", ... } <- the first answer, nothing sent twice| Règle | Détail |
|---|---|
| Clé | Tout texte de 1 à 255 caractères, unique par opération (votre numéro de commande ou de ligne de salaire est parfait). Sinon 400 invalid_idempotency_key. |
| Durée | 24 heures, par entreprise et par mode (une clé test et une clé réelle ne partagent jamais leurs Idempotency-Key). |
| Même clé, même corps | La première réponse à nouveau — même statut HTTP et même corps — avec l’en-tête Idempotent-Replayed: true. Rien n’est fait deux fois. L’ordre des champs JSON ne compte pas. |
| Même clé, autre corps ou chemin | 422 idempotency_key_reused. Utilisez une nouvelle clé pour une nouvelle requête. |
| Première requête encore en cours | 409 idempotency_in_progress. Attendez une seconde et réessayez avec la même clé. Nouveau en 0.9.15 : si la première requête s’est arrêtée (redémarrage chez nous), un nouvel essai après 2 minutes la relance au lieu de recevoir 409 pendant 24 heures. |
| Erreurs | Les réponses comme 400 invalid_phone sont aussi gardées : après correction du corps, prenez une nouvelle clé. Les refus avant toute action (401, 403, 429) et nos propres erreurs (5xx, nouveau en 0.9.15) ne sont pas gardés : vous pouvez réessayer avec la même clé. |
| Exclu | POST /v1/wallet/links/confirm (sa réponse contient un secret unique) et les appels /v1/wallet/app/*. |
Les bibliothèques Node.js et PHP (0.5.0) et le plugin WooCommerce (1.3.0) envoient une clé automatiquement.
Limites de débit
Jusqu’à 300 requêtes par minute par adresse de serveur et 300 par minute par clé API, quel que soit le nombre de serveurs. Au-delà, vous recevez 429 too_many_requests et un en-tête Retry-After (secondes). Les appels du portefeuille partenaire ont leurs propres limites (voir Portefeuille partenaire). N’interrogez pas plus souvent que toutes les quelques secondes : utilisez les webhooks.
Listes & pagination
| Liste | Filtres | Pages |
|---|---|---|
GET /v1/payments | status (pending, succeeded, failed, needs_review), reference, limit (1–100, 20 par défaut) | Les plus récents d’abord. has_more ; page suivante avec before=<dernier id> (nouveau en 0.9.15). |
GET /v1/payouts | status, kind (payout, withdrawal, refund), reference, limit (1–100, 20 par défaut) | Les plus récents d’abord. has_more ; page suivante avec before=<dernier id>. |
GET /v1/events | type, since, limit (1–100, 50 par défaut) | Sans since : les plus récents d’abord. Avec since=<id d’événement> : les suivants, du plus ancien au plus récent ; recommencez avec le dernier id tant que has_more vaut true. |
IP autorisées
Dans Développeurs → Liste d’IP autorisées, vous pouvez limiter votre clé aux adresses de vos serveurs (IPv4, ou plages comme 203.0.113.0/24). Quand la liste n’est pas vide, les appels venant d’une autre adresse reçoivent 403 ip_not_allowed avec l’adresse vue dans ip, pour savoir quoi ajouter. Une liste vide autorise toutes les adresses.
Les virements en argent réel par API exigent une liste (nouveau en 0.9.15) : avec une clé live, POST /v1/payouts est refusé avec 403 ip_allowlist_required tant qu’aucune adresse n’est dans la liste. Les clés de test ne sont pas concernées.
Référence de l’API
| Méthode | Chemin | Rôle |
|---|---|---|
POST | /v1/payments | Lance un paiement : le client reçoit une demande sur son téléphone. |
GET | /v1/payments/{id} | Un paiement et son dernier statut. |
GET | /v1/payments | Vos paiements, les plus récents d’abord (filtres, curseur – nouveau en 0.9.15). |
POST | /v1/payments/{id}/cancel | Arrête d’attendre un paiement en attente (nouveau en 0.9.15). |
POST | /v1/checkout/sessions | Crée une page de paiement hébergée. |
GET | /v1/checkout/sessions/{id} | Une session, son paiement et son séquestre. |
POST | /v1/payouts | Envoie de l’argent vers un portefeuille Mobile Money. |
GET | /v1/payouts/{id} | Un transfert, retrait ou remboursement. |
GET | /v1/payouts | Sorties d’argent, les plus récentes d’abord (curseur). |
GET | /v1/name-enquiry | Nom d’un compte Mobile Money, avant un transfert (nouveau en 0.9.14). |
POST | /v1/refunds | Rembourse tout ou partie d’un paiement. |
GET | /v1/refunds/{id} | Un remboursement et son statut. |
GET | /v1/escrows/{id} | Un séquestre (paiement protégé). |
POST | /v1/escrows/{id}/deliver | Marque la commande comme livrée. |
POST | /v1/escrows/{id}/confirm | L’acheteur confirme : libère maintenant (apps partenaires). |
POST | /v1/escrows/{id}/cancel | Annule : remboursement total de l’acheteur. |
GET | /v1/events | Rattrape les événements webhook. |
GET | /v1/balance | Solde disponible et taux de frais. |
POST | /v1/plans | Crée une formule d’abonnement ou de paiement en plusieurs fois (nouveau en 0.9.16). |
GET | /v1/plans | Vos formules. |
POST | /v1/subscriptions | Inscrit un client à une formule (nouveau en 0.9.16). |
GET | /v1/subscriptions | Inscriptions et échéances ; pause, reprise, arrêt, encaissement, espèces. |
GET | /v1/wallet/agents | Agents cash près d’un titulaire de portefeuille (apps partenaires, nouveau en 0.9.16). |
Fichier OpenAPI (nouveau en 0.9.15) : tous les appels /v1, leurs champs et leurs réponses dans un seul fichier lisible par machine, openapi.json (OpenAPI 3). Importez-le dans Postman, Insomnia ou un générateur de code.
Créer un paiement — POST /v1/payments
| Champ | Type | Description |
|---|---|---|
amount | integer | Obligatoire. Prix en XAF, de 100 à 1 000 000. |
method | string | Obligatoire. mtn_momo ou orange_money. |
phone | string | Obligatoire. Le numéro Mobile Money du client. |
reference | string | Facultatif. Votre numéro de commande (64 max). Par défaut, l’identifiant du paiement. |
customer_name | string | Facultatif (120 max). Enregistré dans vos clients. |
customer_email | string | Facultatif (200 max). Pour les reçus. |
curl https://app.wunapay.com/v1/payments \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order_1042_pay" \
-d '{"amount":25000,"method":"mtn_momo","phone":"+2376XXXXXXXX","reference":"order_1042"}'
Réponse : 201 Created avec un objet paiement au statut pending. Le client voit alors une demande sur son téléphone et confirme avec son code PIN (WunaPay ne le voit jamais).
Consulter un paiement — GET /v1/payments/{id}
curl https://app.wunapay.com/v1/payments/pay_8kQ2mZx1Lp7r \
-H "Authorization: Bearer sk_test_..."
La consultation fait aussi vérifier WunaPay auprès de l’opérateur (au plus toutes les quelques secondes). Mieux que d’interroger : un webhook.
Lister les paiements — GET /v1/payments
curl "https://app.wunapay.com/v1/payments?status=succeeded&limit=50" \
-H "Authorization: Bearer sk_test_..."
{ "object": "list", "data": [ { "id": "pay_8kQ2mZx1Lp7r", "object": "payment", ... }, ... ], "has_more": true }
# next page: the payments before the last one you received
curl "https://app.wunapay.com/v1/payments?status=succeeded&limit=50&before=pay_Ab3Cd4Ef5Gh6" \
-H "Authorization: Bearer sk_test_..."
Nouveau en 0.9.15 : des pages. Les plus récents d’abord, 20 par défaut (limit 1–100). Quand has_more vaut true, redemandez avec before= l’identifiant du dernier paiement reçu. Filtres : status (pending, succeeded, failed, needs_review) et reference. Un identifiant qui n’est pas à vous (ou de l’autre mode) donne 400 invalid_cursor.
Annuler un paiement en attente — POST /v1/payments/{id}/cancel
Nouveau en 0.9.15. Le client est parti, ou la commande est annulée : on arrête d’attendre. Le paiement passe à failed avec failure_reason: "cancelled" et payment.failed est envoyé. Seul un paiement pending peut être annulé (sinon 409 payment_not_cancellable).
L’opérateur ne peut pas reprendre une demande déjà envoyée au téléphone. Si le client l’accepte quand même, le paiement devient succeeded plus tard et vous recevez payment.succeeded : livrez toujours sur cet événement, et remboursez si vous ne voulez plus la commande.
curl -X POST https://app.wunapay.com/v1/payments/pay_8kQ2mZx1Lp7r/cancel \
-H "Authorization: Bearer sk_test_..." \
-H "Idempotency-Key: cancel-order-1042"
{ "id": "pay_8kQ2mZx1Lp7r", "object": "payment", "status": "failed", "failure_reason": "cancelled", ... }L’objet paiement
{
"id": "pay_8kQ2mZx1Lp7r",
"object": "payment",
"reference": "order_1042",
"method": "mtn_momo",
"phone": "••••••••0000",
"amount": 25000,
"fee": 500,
"net": 24500,
"currency": "XAF",
"status": "pending",
"failure_reason": null,
"checkout_session": null,
"invoice": null,
"customer": "cus_Xc4Vb5Nm6Qw7",
"source": "api",
"refunded": 0,
"livemode": false,
"created_at": "2026-11-01 09:30:00"
}| Champ | Signification |
|---|---|
amount | Ce qui est demandé au client. Si vous avez choisi « le client paie les frais » dans Réglages, les frais y sont inclus. |
fee | Frais WunaPay en XAF (2 %, moins avec les remises de volume ; +0,5 % en séquestre). |
net | Ce qui arrive sur votre solde en cas de succès : amount − fee. |
status | pending → succeeded ou failed. needs_review : l’opérateur est injoignable depuis 24 heures ; notre équipe vérifie à la main, puis il se termine en succeeded ou failed. |
failure_reason | En cas d’échec, ex. declined_by_customer, expired, operator_unavailable. |
source | api, checkout, link ou invoice. |
checkout_session / invoice / customer | Identifiants de la session, de la facture et du client liés, ou null. |
refunded | Total remboursé jusqu’ici (remboursements non échoués). |
livemode | true argent réel, false test. |
Réponses tardives de l’opérateur. Si un paiement n’est toujours pas confirmé après 30 minutes (le client n’a pas répondu, ou l’opérateur n’a pas donné de réponse claire), il échoue avec expired. WunaPay continue d’interroger l’opérateur pendant 48 heures : s’il confirme ensuite que l’argent a été pris, le paiement devient succeeded et vous recevez un événement payment.succeeded après le payment.failed. Prévoyez ce cas (par exemple, livrer ou rembourser).
Sessions de paiement — POST /v1/checkout/sessions, GET /v1/checkout/sessions/{id}
Guide complet : Paiement hébergé. Champs : amount et return_url (obligatoires), cancel_url, reference (64 max), description (120 max), et en option :
| Champ | Type | Description |
|---|---|---|
escrow | true ou objet | Garder l’argent jusqu’à la livraison (séquestre). release_days 1 à 60 (7 par défaut), description (300 max). |
splits | array | Mode test uniquement. Jusqu’à 10 {phone, amount, label} versés sur ces portefeuilles WunaPay à la libération du séquestre (active le séquestre). Chaque numéro doit avoir un portefeuille ; le total ne peut dépasser ce que vous recevez après frais. Avec une clé réelle : 409 splits_test_only. |
curl https://app.wunapay.com/v1/checkout/sessions \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order_1043_checkout" \
-d '{"amount":15000,"reference":"order_1043","description":"2 T-shirts",
"return_url":"https://yourshop.cm/order/1043/thanks","cancel_url":"https://yourshop.cm/cart"}'Réponse 201 Created :
{
"id": "cs_Qw3rT9yUiOp1",
"object": "checkout_session",
"amount": 15000,
"currency": "XAF",
"reference": "order_1043",
"description": "2 T-shirts",
"status": "open",
"payment": null,
"url": "https://app.wunapay.com/checkout/cs_Qw3rT9yUiOp1",
"return_url": "https://yourshop.cm/order/1043/thanks",
"cancel_url": "https://yourshop.cm/cart",
"created_at": "2026-11-01 09:30:00",
"expires_at": "2026-11-01 10:30:00",
"escrow": null,
"livemode": false
}# Test mode only: a marketplace order held in escrow, with part of it for the rider when it is released
curl https://app.wunapay.com/v1/checkout/sessions \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{"amount":15000,"reference":"order_1044","return_url":"https://yourshop.cm/thanks",
"escrow":{"release_days":3,"description":"Grilled fish, delivered"},
"splits":[{"phone":"+2376XXXXXXXX","amount":1500,"label":"Rider"}]}'curl https://app.wunapay.com/v1/checkout/sessions/cs_Qw3rT9yUiOp1 \
-H "Authorization: Bearer sk_test_..."
# → "status": "paid", "payment": { "id": "pay_…", "status": "succeeded", ... }, "escrow": { ... } or null
Statut : open, paid ou expired (après 60 minutes). Avec GET, payment est l’objet paiement complet et escrow l’objet séquestre complet une fois payé.
Transferts — POST /v1/payouts, GET /v1/payouts/{id}, GET /v1/payouts
Guide complet : Transferts. Champs : amount (ce que reçoit le bénéficiaire), method, phone, reference (64 max), name (nom du bénéficiaire, 120 max), et depuis la 0.9.14 expected_name + name_check (warn ou require) pour vérifier le nom du compte avant de payer (voir vérification du nom). Les frais de 1 % sont pris en plus sur votre solde.
curl https://app.wunapay.com/v1/payouts \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: supplier_17_nov" \
-d '{"amount":50000,"method":"mtn_momo","phone":"+2376XXXXXXXX","reference":"supplier_17_nov","name":"Ets Fotso"}'{
"id": "po_Lk9Jh3Gf5Ds1",
"object": "payout",
"reference": "supplier_17_nov",
"method": "mtn_momo",
"phone": "••••••••0000",
"amount": 50000,
"fee": 500,
"total": 50500,
"currency": "XAF",
"status": "pending",
"failure_reason": null,
"payment": null,
"batch": null,
"beneficiary_name": "Ets Fotso",
"channel": "api",
"created_by": "api",
"approved_by": null,
"livemode": false,
"created_at": "2026-11-01 09:45:00"
}
object vaut payout, withdrawal (vers votre propre portefeuille, depuis le tableau de bord) ou refund. Statut : pending → succeeded ou failed (montant et frais reviennent sur votre solde). Aussi awaiting_approval / cancelled (transferts du tableau de bord qui demandent une deuxième personne), et needs_review : non confirmé après 24 heures, l’argent reste réservé pendant que notre équipe vérifie avec l’opérateur.
curl "https://app.wunapay.com/v1/payouts?kind=payout&status=failed&limit=50" \
-H "Authorization: Bearer sk_test_..."
{ "object": "list", "data": [ ... ], "has_more": true }
# next page: pass the id of the last item you received
curl "https://app.wunapay.com/v1/payouts?kind=payout&status=failed&limit=50&before=po_Lk9Jh3Gf5Ds1" \
-H "Authorization: Bearer sk_test_..."
Remboursements — POST /v1/refunds, GET /v1/refunds/{id}
Champs : payment (obligatoire, un paiement réussi), amount (facultatif ; par défaut tout le reste non remboursé ; min. 100), reason (facultatif, 64 max). L’argent retourne au numéro du client depuis votre solde ; les remboursements sont gratuits. Plusieurs remboursements partiels sont possibles jusqu’au montant du paiement. Un paiement en séquestre se rembourse avec l’annulation du séquestre.
curl https://app.wunapay.com/v1/refunds \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: refund_order_1042" \
-d '{"payment":"pay_8kQ2mZx1Lp7r","amount":5000,"reason":"Out of stock"}'
{ "id": "re_Hj6Kl7Mn8Pq9", "object": "refund", "reference": "Out of stock", "method": "mtn_momo",
"amount": 5000, "fee": 0, "total": 5000, "status": "pending", "payment": "pay_8kQ2mZx1Lp7r",
"livemode": false, ... }curl https://app.wunapay.com/v1/refunds/re_Hj6Kl7Mn8Pq9 \
-H "Authorization: Bearer sk_test_..."
Séquestres — /v1/escrows/{id}
Un séquestre est créé par une session de paiement (ou un paiement par portefeuille partenaire) avec escrow. WunaPay garde l’argent jusqu’à la confirmation de l’acheteur, ou jusqu’à release_days après la livraison (ou après le paiement si vous ne marquez jamais la livraison) sans réclamation. Son identifiant est dans GET /v1/checkout/sessions/{id} et dans les événements escrow.*.
| Appel | Rôle | Erreurs |
|---|---|---|
GET /v1/escrows/{id} | Lit le séquestre. | escrow_not_found |
POST …/deliver | Corps {note} (300 max). Marque la commande livrée ; la libération automatique compte à partir de maintenant. | escrow_not_active |
POST …/confirm | L’acheteur a confirmé dans votre app : libère maintenant et paie la répartition. Apps partenaires approuvées uniquement ; pour un paiement par portefeuille, envoyez le jeton WunaPay-Wallet de l’acheteur. | wallet_partner_not_approved wallet_link_required not_the_buyer escrow_not_active |
POST …/cancel | Corps {reason}. Commande annulée avant livraison : l’acheteur récupère tout, la répartition n’est pas payée. | escrow_not_active |
curl https://app.wunapay.com/v1/escrows/esc_Zx8Cv7Bn6Ma5 -H "Authorization: Bearer sk_test_..."
curl https://app.wunapay.com/v1/escrows/esc_Zx8Cv7Bn6Ma5/deliver -H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" -d '{"note":"Delivered to the front desk"}'
curl https://app.wunapay.com/v1/escrows/esc_Zx8Cv7Bn6Ma5/cancel -H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" -d '{"reason":"Order cancelled"}'
# approved partner apps only; for a wallet payment add the buyer's link token
curl -X POST https://app.wunapay.com/v1/escrows/esc_Zx8Cv7Bn6Ma5/confirm -H "Authorization: Bearer sk_test_..." \
-H "WunaPay-Wallet: wlk_..." {
"id": "esc_Zx8Cv7Bn6Ma5",
"object": "escrow",
"status": "held",
"payment": "pay_8kQ2mZx1Lp7r",
"amount": 15000,
"fee": 375,
"net_to_seller": 14625,
"description": "Grilled fish, delivered",
"release_days": 3,
"buyer_name": "Ines",
"paid_at": "2026-11-01 09:31:00",
"delivered_at": null,
"delivery_note": null,
"auto_release_at": "2026-11-04 09:31:00",
"dispute_reason": null,
"dispute_opened_at": null,
"seller_response": null,
"resolution": null,
"resolution_note": null,
"released_amount": null,
"refunded_amount": null,
"closed_at": null,
"created_at": "2026-11-01 09:30:00",
"splits": [ ... ]
}
Statut : awaiting_payment → held → released, refunded ou split (une part chacun, décidé par notre équipe après un litige) ; disputed tant que la réclamation de l’acheteur est ouverte ; cancelled si le paiement a échoué. Tant qu’un séquestre est actif, son argent n’est pas dans votre solde available.
Événements — GET /v1/events
Chaque événement webhook est conservé, même sans adresse de webhook pour ce mode. Si votre serveur était en panne, rattrapez-vous : gardez l’identifiant du dernier événement traité et demandez les suivants. delivery indique si le webhook est passé.
curl "https://app.wunapay.com/v1/events?since=evt_Tg7Hk2LmN0pq&limit=100" \
-H "Authorization: Bearer sk_test_..."
{
"object": "list",
"has_more": false,
"data": [
{
"id": "evt_Ab1Cd2Ef3Gh4",
"object": "event",
"type": "payment.succeeded",
"livemode": false,
"created_at": "2026-11-01T09:30:12.000Z",
"data": { "id": "pay_8kQ2mZx1Lp7r", "object": "payment", "status": "succeeded", ... },
"delivery": { "delivered": false, "attempts": 3, "last_status": "timeout" }
}
]
}
Solde — GET /v1/balance
{
"object": "balance",
"available": 98000,
"currency": "XAF",
"livemode": false,
"fee_percent": 2,
"payout_fee_percent": 1
}
available est ce que vous pouvez transférer ou retirer maintenant, dans le mode de la clé : paiements réussis moins frais, moins les sorties en attente, à approuver ou réussies, moins l’argent en séquestre.
Erreurs
Les erreurs renvoient un statut HTTP et un corps JSON avec error. Certaines ajoutent details (ou ip) pour vous aider à corriger. Votre code doit lire error ; la liste peut s’allonger.
HTTP/1.1 403 Forbidden
{ "error": "ip_not_allowed", "ip": "203.0.113.7" }
HTTP/1.1 400 Bad Request
{ "error": "splits_too_large", "details": { "max": 14625 } }| HTTP | error | Signification | Que faire |
|---|---|---|---|
| 400 | invalid_json | Le corps n’est pas du JSON valide. | Envoyez Content-Type: application/json et un corps JSON valide. |
| 400 | invalid_amount | Montant absent, non entier ou hors de 100 à 1 000 000 FCFA (aussi quand les frais ajoutés pour le client dépassent la limite). | Envoyez un nombre entier de FCFA dans la plage. |
| 400 | invalid_method | method n’est pas mtn_momo ou orange_money. | Corrigez la valeur. |
| 400 | invalid_phone | Le numéro n’est pas valide. | Envoyez 9 chiffres (6XXXXXXXX) ou le numéro complet avec 237. |
| 400 | invalid_return_url invalid_cancel_url | Adresse de retour absente, non http(s) ou de plus de 500 caractères. | Envoyez une adresse https:// complète. |
| 400 | invalid_idempotency_key | L’en-tête Idempotency-Key est vide ou fait plus de 255 caractères. | Envoyez 1 à 255 caractères, ex. votre numéro de commande. |
| 400 | insufficient_balance | Le montant du transfert ou du remboursement (plus frais) dépasse votre solde disponible. | Vérifiez GET /v1/balance ; attendez d’autres paiements. |
| 400 | daily_limit_reached | Ce transfert dépasserait la limite quotidienne fixée dans votre tableau de bord. | Réessayez demain (heure du Cameroun) ou relevez la limite. |
| 400 | api_daily_cap_reached | Les transferts API en argent réel du jour dépasseraient votre plafond de sécurité. details contient cap et sent_today. | Payez depuis le tableau de bord ou relevez le plafond. |
| 400 | invalid_name_check expected_name_required | name_check ne vaut pas off, warn ou require, ou require sans expected_name. Nouveau en 0.9.14. | Corrigez les champs. |
| 400 | payment_not_refundable | Seul un paiement succeeded peut être remboursé. | Vérifiez d’abord le statut du paiement. |
| 400 | invalid_refund_amount | Remboursement inférieur à 100 FCFA ou supérieur au reste à rembourser. | Envoyez un montant plus petit, ou rien pour tout le reste. |
| 400 | invalid_since invalid_cursor | L’identifiant since ou before (paiement ou transfert) n’est pas à vous (ou pas dans ce mode). | Utilisez un identifiant reçu avec la même clé. |
| 400 | invalid_release_days | release_days n’est pas un entier de 1 à 60. | Corrigez la valeur (7 par défaut). |
| 400 | invalid_splits invalid_split_phone invalid_split_amount | splits n’est pas une liste de 1 à 10 éléments, ou un numéro ou montant (min. 100) est faux. | Corrigez la liste. |
| 400 | split_not_a_wallet | Un numéro de la répartition n’a pas de portefeuille WunaPay. details.phone indique lequel (masqué). | Demandez à cette personne d’ouvrir d’abord un portefeuille. |
| 400 | splits_too_large | La répartition dépasse ce que vous recevez après frais. details.max est le maximum. | Baissez les montants. |
| 401 | invalid_api_key | Clé secrète absente, fausse ou remplacée — ou clé sk_live_ alors que le réel est désactivé pour votre compte. | Recopiez la clé depuis Développeurs. |
| 403 | account_suspended | Votre compte est suspendu. | Écrivez à support@wunapay.com. |
| 403 | merchant_unavailable account_frozen | Votre compte est gelé par l’équipe WunaPay : aucun mouvement d’argent. | Écrivez à support@wunapay.com. |
| 403 | payouts_on_hold | Les sorties d’argent sont suspendues pour votre compte (les paiements entrent toujours). | Écrivez à support@wunapay.com. |
| 403 | payouts_disabled_for_channel | Vos règles n’autorisent les transferts que depuis le tableau de bord (ou pas du tout). | Modifiez-le dans Réglages → Règles de virement. |
| 403 | recipient_not_saved | Les transferts API sont limités aux bénéficiaires enregistrés, et ce numéro ne l’est pas. | Enregistrez d’abord le bénéficiaire dans le tableau de bord. |
| 403 | ip_not_allowed | Votre liste d’IP autorisées est active et l’adresse de ce serveur n’y est pas. La réponse contient ip. | Ajoutez cette adresse dans Développeurs → Liste d’IP autorisées. |
| 403 | wallet_partner_not_approved | Cet appel est réservé aux apps approuvées comme partenaires portefeuille. | Voir Portefeuille partenaire. |
| 403 | not_the_buyer | Confirmation d’un séquestre payé par portefeuille avec le jeton d’une autre personne. | Envoyez le jeton de l’acheteur. |
| 404 | payment_not_found payout_not_found refund_not_found session_not_found escrow_not_found | Aucun objet avec cet identifiant dans votre compte dans ce mode (un identifiant test n’existe pas avec une clé réelle). | Vérifiez l’identifiant et la clé utilisée. |
| 404 | not_found | Chemin d’API inconnu. | Vérifiez la méthode et le chemin. |
| 409 | idempotency_in_progress | La première requête avec cette Idempotency-Key est encore en cours. | Attendez une seconde et renvoyez-la avec la même clé. |
| 409 | payment_not_cancellable | Seul un paiement pending peut être annulé. Nouveau en 0.9.15. | Lisez-le avec GET /v1/payments/{id} ; remboursez-le s’il a réussi. |
| 409 | escrow_active | Ce paiement est en séquestre : remboursez-le avec POST /v1/escrows/{id}/cancel. | Utilisez l’appel séquestre. |
| 409 | escrow_not_active | Le séquestre n’est plus actif (déjà libéré, remboursé ou annulé), ou pas dans le bon état. | Lisez-le avec GET /v1/escrows/{id}. |
| 409 | splits_test_only wallet_test_only | La répartition et le portefeuille WunaPay ne marchent qu’en mode test (pas d’agrément pour l’argent réel). | Utilisez une clé sk_test_. |
| 413 | request_too_large file_too_large | Le corps JSON est trop gros (plus de 200 Ko), ou un fichier envoyé est trop gros. request_too_large est nouveau en 0.9.15 (avant, les deux disaient file_too_large). | Envoyez moins de données par requête. |
| 422 | name_mismatch name_check_unavailable | Transfert envoyé avec name_check: "require" : le nom du compte ne correspond pas à expected_name (ou pas de compte), ou l’opérateur n’a pas pu être interrogé. Rien n’a été envoyé. Nouveau en 0.9.14. | Vérifiez le numéro avec GET /v1/name-enquiry ; voir Vérification du nom. |
| 422 | idempotency_key_reused | Cette Idempotency-Key a déjà servi avec un autre corps ou chemin dans les dernières 24 heures. | Utilisez une nouvelle clé pour une nouvelle requête. |
| 429 | too_many_requests | Plus de 300 requêtes par minute. L’en-tête Retry-After indique combien de secondes attendre. | Patientez puis réessayez (avec la même Idempotency-Key pour un POST). |
| 500 | server_error | Un problème de notre côté. | Relancez un GET. Relancez un POST seulement avec la même Idempotency-Key. |
| 503 | live_not_available method_not_live | Les paiements réels ne sont pas encore ouverts chez WunaPay, ou pas pour cet opérateur (Orange Money réel n’est pas connecté). | Restez en mode test ; nous l’annoncerons dans les nouveautés. |
Les appels du portefeuille partenaire ont leurs propres erreurs : voir Portefeuille partenaire.
Tests
Tous les comptes commencent en mode test : aucun argent réel ne circule. En mode test, les paiements MTN passent par la sandbox de MTN quand elle est connectée chez nous ; sinon, les deux opérateurs passent par le simulateur WunaPay.
| Moyen | Numéros de test |
|---|---|
| MTN MoMo (sandbox MTN, quand elle est connectée) | Les numéros normaux comme 237670000000 réussissent. 46733123450 échoue volontairement. |
| Orange Money, et MTN quand la sandbox n’est pas connectée (simulateur) | Se terminant par 01 : refusé. Par 02 : expiré. Tout autre numéro réussit après quelques secondes. |
Si un paiement MTN de test se comporte comme le simulateur (numéros finissant par 01 refusés, 02 expirés), la sandbox n’est pas connectée à ce moment : appliquez ces règles du simulateur aux deux opérateurs. Les paiements de test sont clairement marqués « test » dans le tableau de bord et l’API.
Les bibliothèques Node.js et PHP, ainsi que le plugin WooCommerce, sont sur la page Plugins & SDK. Des questions ? Écrivez à support@wunapay.com.