Skip to content

How do I accept a first Wave or Orange Money payment through an API?

Create a test key, send POST /v1/payments in cURL, Node.js, PHP, Python or Go, redirect the customer to checkout_url, then receive the webhook.

Create a test key in the dashboard, then send POST /v1/payments from the server with rail set to sn_wave (Wave) or sn_orange (Orange Money). The response contains checkout_url, the address to redirect the customer to; in test mode no real money moves.

1. Create a test key

Open the 221 Pay dashboard (create an account if needed, no NINEA or RCCM), then Developers > API keys: create a key with the payments scope. A test key starts with sk_221_pay_test_; its secret is shown only once. Base URL: https://apps.orvlabs.com

Terminal
export API_KEY="sk_221_pay_test_…"
export API_URL="<base URL above>"

2. Create the payment

Idempotency-Key prevents a duplicate if the request is sent again. amount is a string in whole XOF: "5000" means 5,000 CFA francs.

Terminal
curl -X POST "$API_URL/v1/payments" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: commande-1042" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": "5000",
    "currency": "XOF",
    "rail": "sn_wave",
    "merchant_reference": "commande-1042",
    "return_url": "https://boutique.example/paiement/retour",
    "customer_phone": "77 123 45 67"
  }'

Redirect the customer to checkout_url. For Orange Money in Senegal, rail is sn_orange. Fields and statuses: Payments.

3. Receive the result

On confirmation, 221 Pay sends the signed payment.succeeded event to the project's webhook endpoint. The server verifies the signature on the raw body, ignores an event id already processed, then reads the payment again with GET /v1/payments/{id}. Verification examples and the event catalogue: Webhooks.

Next

Last updated on