Skip to content

Payment lifecycle: statuses and webhooks

A Senfenico payment is always a charge, that is, the debit of the customer’s mobile money account. If you use the hosted page, a checkout groups one or more charges, one per customer attempt.

  1. send_otpWaiting for the OTP
    pay_offlineWaiting for the phone
  2. successPaid
    failedFailed
Charge status lifecycle

A charge is created in a waiting state that depends on the operator, then moves to success or failed.

Status Meaning Webhook Final What to do
send_otp The charge waits for an OTP. Orange, Coris, Sank, and Moov in OTP mode. charge.send_otp No Ask the customer for the OTP, then call POST /charges/submit.
pay_offline The customer must approve on their phone. Moov in USSD mode, MTN Mobile Money and Moov Money in Benin. charge.pay_offline No Show display_text and wait for charge.success. Set your own timeout.
success The operator confirmed the debit. charge.success Yes Check the amount, then fulfill the order.
failed The operator rejected it, for example because of an OTP rejected at Orange in live mode, an insufficient balance or an invalid number. charge.failed Treat as final Don’t fulfill the order. Offer to pay again with a new charge.
pending Reserved. No charge gets this status today. charge.pending — Treat as waiting.
canceled Reserved. The API does not cancel charges automatically today. charge.canceled Yes Don’t fulfill the order.

The charge.send_otp or charge.pay_offline webhook is sent as soon as the charge is created. It only confirms that the request is in progress.

If a response contains a status value you don’t know (for example waiting_webpayment, used for an operator outside Burkina and Benin), treat it as waiting and don’t fulfill the order.

There is no automatic expiry. A send_otp charge whose OTP never arrives stays send_otp. A pay_offline charge that the customer ignores or declines can stay pay_offline without ever receiving charge.failed.

So decide yourself when an order is abandoned (for example after 15 minutes without success), and release the stock or cart at that point. Before offering a new charge, re-read the status of the old one to avoid a double debit.

  1. pendingCreated
  2. successPaid on the page
    failedPhone approval failed
Checkout status lifecycle
Status Meaning Webhook What to do
pending Checkout created, no payment confirmed on the page. A checkout often stays pending after a failed attempt. checkout.pending, sent at creation Wait. If the order stays pending, check the linked charge (charge_reference).
success The payment was confirmed on the page. checkout.success Check the amount and live_mode, then fulfill the order.
failed The page saw a phone approval fail. checkout.failed Wait. The customer can retry on the same page, and the checkout can then become success.

A checkout status is updated by the payment page itself. If the customer closes the page before the end, the charge can be success while the checkout is still pending, and checkout.success is not sent. Also subscribe to charge.success (see Confirm the payment server-side).

Here are sample sequences your server receives. Each event carries the full object in data (a JSON string to decode, see Webhooks).

Scenario Events received
Successful Orange Money charge charge.send_otp → charge.success
Orange Money charge, OTP rejected in live mode charge.send_otp → charge.failed
Successful Moov Money charge in USSD mode charge.pay_offline → charge.success
Successful Benin charge (MTN or Moov) charge.pay_offline → charge.success
Checkout paid with Orange on the first try checkout.pending → charge.send_otp → charge.success → checkout.success
Checkout: one failure, then a success checkout.pending → charge.send_otp → charge.failed → charge.send_otp (new charge) → charge.success → checkout.success

You only receive the events you subscribed to in the dashboard. For most shops, charge.success, charge.failed and checkout.success are enough.

Arrival order is not guaranteed, because of retries and the network. Rely on the object’s status, not on the order of events.

Only fulfill an order after reading status: "success" from the Senfenico API, with your secret key, from your server. The customer landing on success_url, a message from your mobile app or a screenshot of the SMS prove nothing.

  1. Find the order using the reference you stored (charge reference, checkout reference or your ext_id).
  2. Read the object from the API with GET /v1/payment/charges/{reference}/ or GET /v1/payment/checkouts/{reference}/.
  3. Check the object. status must be success, amount must match the order, live_mode must match your environment and the reference must be the order’s.
  4. Fulfill only once. Mark the order paid inside a transaction, and ignore later confirmations (duplicate webhooks, retries).
Fenêtre de terminal
curl https://api.senfenico.com/v1/payment/charges/CH261126-101431-ORANGE_BF-1a2b3c4d5e/ \
-H "X-API-KEY: $SENFENICO_KEY"
# fulfill only if data.status == "success"
# and data.amount == the order amount

For a checkout, the full check (checkout, then linked charge) is in Confirm a checkout payment.

A webhook is fast, but it can arrive twice, late, or not at all if your server is down for more than an hour. Verify its signature. The API is always up to date, but you have to call it.

Suggested messages for each error are in Error codes. While a charge is send_otp or pay_offline, show display_text.