Hosted payment page (Checkout)
A checkout is a payment page hosted by Senfenico. You create a checkout on your server, redirect the customer to its authorization_url, and the customer picks their operator and pays on that page.
There is no phone number form, OTP field or waiting screen to build. Checkout suits a website or an app that can open a web page. To keep the customer inside your own interface, or to collect payments in Benin, use direct charges.
How a payment works
Section titled “How a payment works”- Your server calls
POST /v1/payment/checkouts/initialize/with the amount and two return URLs. - You store the checkout
referencewith your order, then redirect the customer toauthorization_url. - On the page, the customer picks an operator, enters their number and confirms (OTP or approval on their phone).
- The page shows “payment done” with a Poursuivre (Continue) button leading to your
success_url?reference=…. - Your server confirms the payment (webhook or API call) before you fulfill the order.
Create a checkout
Section titled “Create a checkout”/v1/payment/checkouts/initialize/| Parameter | Type | Description |
|---|---|---|
amount |
integer, required | Amount in XOF, whole number. Minimum 100. Stay at 1000000 or below (see Limits). |
success_url |
URL, required | Page on your site the customer returns to after a successful payment. |
cancel_url |
URL, required | Page on your site the customer returns to if they give up after a failure. |
email |
email, optional | Customer email. Stored on the checkout and usable as a list filter. |
A checkout has no ext_id or metadata field. The returned reference links it to your order, so store it.
-
Initialize the checkout from your server
Fenêtre de terminal curl https://api.senfenico.com/v1/payment/checkouts/initialize/ \-H "X-API-KEY: $SENFENICO_KEY" \-H "Content-Type: application/json" \-d '{"amount": 1000,"email": "customer@example.com","success_url": "https://shop.example.com/thanks","cancel_url": "https://shop.example.com/cart"}'<?php// composer require guzzlehttp/guzzle$http = new GuzzleHttp\Client(['base_uri' => 'https://api.senfenico.com/v1/payment/','headers' => ['X-API-KEY' => getenv('SENFENICO_KEY')],'http_errors' => false,]);$res = $http->post('checkouts/initialize/', ['json' => ['amount' => 1000,'email' => 'customer@example.com','success_url' => 'https://shop.example.com/thanks','cancel_url' => 'https://shop.example.com/cart',]]);$body = json_decode((string) $res->getBody(), true);if ($res->getStatusCode() === 201 && $body['status']) {$checkout = $body['data'];// store $checkout['reference'] with the order}import osimport requestsAPI = "https://api.senfenico.com/v1/payment"HEADERS = {"X-API-KEY": os.environ["SENFENICO_KEY"]}res = requests.post(f"{API}/checkouts/initialize/",headers=HEADERS,json={"amount": 1000,"email": "customer@example.com","success_url": "https://shop.example.com/thanks","cancel_url": "https://shop.example.com/cart",},timeout=30,)body = res.json()if res.status_code == 201 and body["status"]:checkout = body["data"]# store checkout["reference"] with the orderconst API = 'https://api.senfenico.com/v1/payment';const res = await fetch(`${API}/checkouts/initialize/`, {method: 'POST',headers: {'X-API-KEY': process.env.SENFENICO_KEY,'Content-Type': 'application/json',},body: JSON.stringify({amount: 1000,email: 'customer@example.com',success_url: 'https://shop.example.com/thanks',cancel_url: 'https://shop.example.com/cart',}),});const body = await res.json();if (res.status === 201 && body.status) {const checkout = body.data;// store checkout.reference with the order}The Node.js examples use top-level
await. Run them as ES modules (a.mjsfile or"type": "module"inpackage.json), or wrap them in anasyncfunction.201 Createdresponse:{"status": true,"message": "Checkout initialized","data": {"reference": "CHK261126-101431--9f8e7d6c5b","authorization_url": "https://api.senfenico.com/v1/checkout_payment/payment_page/CHK261126-101431--9f8e7d6c5b/","live_mode": false}}Treat
referenceas an opaque string. Its format has already changed (older checkouts start withchk_) and may change again. -
Store the reference with your order
Before redirecting, save
referencein your orders table (for example asenfenico_checkout_refcolumn). It is the only way to find the order when the webhook or the customer comes back. -
Redirect the customer to
authorization_urlAn HTTP
302redirect, a link orwindow.locationall work. In a mobile app, open the URL in the browser or a WebView. -
Confirm the payment on your server
See Confirm the payment server-side below. Never fulfill an order just because the customer landed on
success_url.
What the customer sees
Section titled “What the customer sees”The page lists the operators enabled on your account among Orange Money, Moov Money, Coris Money and Sank Money (Burkina Faso). Benin (MTN, Moov) is not offered on the page; use direct charges.
| Operator picked | What the customer does on the page |
|---|---|
| Orange Money | Dials *144*4*6*amount#, gets an OTP by SMS and types it in. See Orange Money. |
| Moov Money | Gets an OTP by SMS and types it in. Depending on your account configuration, they may instead approve on their phone while the page waits. See Moov Money. |
| Coris Money | Gets an OTP by SMS and types it in. |
| Sank Money | Gets an OTP by SMS and types it in. |
Every attempt on the page creates a charge. After a failure, the page offers to retry (new charge, same checkout) or to go back to your site.
The page is in French.
Coming back to your site
Section titled “Coming back to your site”| Situation | What the page offers |
|---|---|
| Successful payment | A confirmation screen with a Poursuivre (Continue) button pointing to success_url?reference=<checkout reference>. There is no automatic redirect, and the customer may close the page without clicking. |
| Failure | A Réessayer (Retry) button, or a link to cancel_url?reference=<checkout reference>. |
On your success_url page, read reference, find the order, then ask the API for the real state of the payment.
Confirm the payment server-side
Section titled “Confirm the payment server-side”Never fulfill an order because the customer came back to success_url. Anyone can open that URL with any reference, and a customer can also pay without ever coming back.
The checkout status is updated by the payment page. If the customer approves on their phone and then closes the page early, the charge becomes success while the checkout stays pending, and the checkout.success webhook is not sent. So subscribe to both of these webhooks (see Webhooks):
| Webhook | When it arrives |
|---|---|
checkout.success |
The payment is confirmed while the page is still open. |
charge.success |
The charge created by the page succeeded, even if the customer closed the page. Find the checkout with the charge_reference filter of the checkout list. |
Before you fulfill the order, and to catch up on orders still waiting, check the state through the API:
- Fetch the checkout by its reference. If it is
success, checkamountandlive_mode, then fulfill the order. - If it is still
pendingorfailedandcharge_referenceis set, fetch that charge. If it issuccess, the customer has paid.
REF="CHK261126-101431--9f8e7d6c5b"curl "https://api.senfenico.com/v1/payment/checkouts/$REF/" \ -H "X-API-KEY: $SENFENICO_KEY"
# if status != success and charge_reference is set:curl "https://api.senfenico.com/v1/payment/charges/CH261126-101502-ORANGE_BF-4c1d2e3f4a/" \ -H "X-API-KEY: $SENFENICO_KEY"<?phpfunction checkoutIsPaid(GuzzleHttp\Client $http, string $ref, int $amount): bool{ $res = $http->get("checkouts/{$ref}/"); if ($res->getStatusCode() !== 200) return false; $chk = json_decode((string) $res->getBody(), true)['data'];
if ($chk['amount'] !== $amount) return false; if ($chk['status'] === 'success') return true; if (!$chk['charge_reference']) return false;
$res = $http->get("charges/{$chk['charge_reference']}/"); if ($res->getStatusCode() !== 200) return false; $charge = json_decode((string) $res->getBody(), true)['data']; return $charge['status'] === 'success';}def checkout_is_paid(ref: str, amount: int) -> bool: r = requests.get(f"{API}/checkouts/{ref}/", headers=HEADERS, timeout=30) if r.status_code != 200: return False chk = r.json()["data"]
if chk["amount"] != amount: return False if chk["status"] == "success": return True if not chk["charge_reference"]: return False
r = requests.get(f"{API}/charges/{chk['charge_reference']}/", headers=HEADERS, timeout=30) return (r.status_code == 200 and r.json()["data"]["status"] == "success")async function checkoutIsPaid(ref, amount) { const headers = { 'X-API-KEY': process.env.SENFENICO_KEY }; let r = await fetch(`${API}/checkouts/${ref}/`, { headers }); if (r.status !== 200) return false; const chk = (await r.json()).data;
if (chk.amount !== amount) return false; if (chk.status === 'success') return true; if (!chk.charge_reference) return false;
r = await fetch(`${API}/charges/${chk.charge_reference}/`, { headers }); if (r.status !== 200) return false; return (await r.json()).data.status === 'success';}An sk_test_ key only sees test checkouts, an sk_live_ key only live ones. A checkout created with the other key returns 404.
Retrieve a checkout
Section titled “Retrieve a checkout”/v1/payment/checkouts/{reference}/{ "status": true, "message": "Checkout details retrieved", "data": { "email": "customer@example.com", "reference": "CHK261126-101431--9f8e7d6c5b", "charge_reference": "CH261126-101502-ORANGE_BF-4c1d2e3f4a", "amount": 1000, "success_url": "https://shop.example.com/thanks", "cancel_url": "https://shop.example.com/cart", "phone": "76000000", "provider": "orange_bf", "live_mode": false, "created_at": "2026-11-26T10:14:31.208411Z", "updated_at": "2026-11-26T10:15:40.517093Z", "status": "success" }}Checkout fields
Section titled “Checkout fields”| Field | Type | Description |
|---|---|---|
reference |
string | Checkout identifier. Store it with your order. |
status |
string | pending, success or failed. See Statuses. |
amount |
integer | Requested amount, in XOF. |
charge_reference |
string or null |
Reference of the latest charge attempted on the page. null until the customer submits the form. |
provider |
string | Operator picked by the customer (orange_bf, moov_bf, coris_bf, sank_bf). Empty before the choice. |
phone |
string | Number entered by the customer. Empty before the choice. |
email |
string or null |
Email sent at initialization. |
success_url, cancel_url |
URL | Return URLs sent at initialization. |
live_mode |
boolean | true in live mode, false in test mode. |
created_at, updated_at |
ISO 8601 date (UTC) | Creation and last update. |
Checkout statuses
Section titled “Checkout statuses”pendingCreated, waiting for the customersuccessPaidfailedAttempt failed, customer can retry
| Status | Meaning | Webhook | What to do |
|---|---|---|---|
pending |
Checkout created, payment not yet confirmed on the page. | checkout.pending (sent at creation) |
Wait. Check the linked charge if the order stays pending. |
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. After a rejected OTP, the checkout usually stays pending. |
checkout.failed |
Don’t cancel right away. The customer can retry on the same page, and the checkout can then become success. |
Each status, for both charges and checkouts, is detailed in Payment lifecycle.
List checkouts
Section titled “List checkouts”/v1/payment/checkouts/The list returns 10 results per page (page parameter, for example ?page=2). Available filters:
| Filter | Example | Effect |
|---|---|---|
status |
success |
pending, success or failed. |
reference |
CHK2611 |
Reference containing this value. |
charge_reference |
CH261126-… |
Finds the checkout of a charge (handy when a charge.success arrives). |
provider, phone, email |
orange_bf |
Exact match (email is case-insensitive). |
date_from, date_to |
2026-11-01 |
Creation date, inclusive, YYYY-MM-DD. |
amount_min, amount_max |
5000 |
Amount in XOF. |
order_by |
-amount |
created_at, -created_at (default), amount, -amount, status, -status. |
curl "https://api.senfenico.com/v1/payment/checkouts/?status=success&date_from=2026-11-01" \ -H "X-API-KEY: $SENFENICO_KEY"{ "status": true, "message": "Checkout list retrieved", "data": [ { "reference": "CHK261126-101431--9f8e7d6c5b", "status": "success", "amount": 1000, "…": "…" } ], "pagination": { "count": 1, "total_pages": 1, "current_page": 1, "page_size": 10, "has_next": false, "has_previous": false }}With an sk_test_ key, the payment page works end to end with the numbers below. Create the checkout with the amount paired with the number you will enter.
Errors
Section titled “Errors”| HTTP | error_code |
Cause |
|---|---|---|
400 |
INVALID_DATA |
Missing or invalid field, for example an amount below 100 or an invalid URL. Details in errors. |
403 |
none | Missing or invalid API key (No API key provided. or Invalid API Key.). status is a string here, see Missing or invalid key. |
404 |
none | Checkout not found. The reference is unknown, or the checkout was created with the other key (test or live). |
{ "status": false, "message": "Invalid data provided. Please check the input and try again.", "error_code": "INVALID_DATA", "errors": { "amount": ["Ensure this value is greater than or equal to 100."] }}Limits
Section titled “Limits”| Limit | Consequence |
|---|---|
| Maximum amount | Initialization accepts more than 1,000,000 XOF, but the payment then fails on the page, because charges are capped at 1,000,000. Stay at 1,000,000 or below. |
| No idempotency | Calling initialize twice creates two checkouts. Reuse the stored reference if the customer comes back to pay the same order. |
| No expiry | The authorization_url link stays usable. If you canceled an order, don’t fulfill it when a payment arrives later; refund it if needed (see Refunds). |
| One charge reference | charge_reference only holds the latest attempted charge. |
| Webhook mode | Check the live_mode field received in checkout.* events before acting. |