Create Checkout Session
Creates a hosted checkout session for a customer and returns a checkoutUrl that the customer should be redirected to in order to complete payment. The session captures the merchant intent (amount, currency, merchant reference, customer details, and allowed payment channels) and is identified end-to-end by the merchant-supplied merchantReference.
checkoutUrl that you redirect the customer to so they can complete payment on Afriex’s hosted page.
How it works
- Call this endpoint with the amount you want to collect, the customer’s details, your
merchantReference, and aredirectUrl. - Afriex returns a
checkoutUrl. - Redirect the customer to that URL.
- After payment, Afriex redirects the customer back to your
redirectUrland fires aCHECKOUT_SESSION.CREATEDwebhook to your configured callback URL.
Identifying the session
ThemerchantReference you supply is the end-to-end identifier. Use it to look up the session, match webhook deliveries, and reconcile any resulting transaction in your system. It must be unique per session.
Amounts are in minor units
amount is denominated in the smallest unit of the currency. For example, kobo for NGN or cents for USD. To charge ₦5,000.00, pass 500000. Minimum value is 100 (one major unit).
Restricting payment channels
Usechannels to control which deposit rails the hosted page offers the customer. Supported values are VIRTUAL_BANK_ACCOUNT, MOBILE_MONEY, and CARD; pass at least one. For example, ["CARD", "MOBILE_MONEY"] shows only the card and mobile-money options and hides the rest.
If you omit channels, the session defaults to ["VIRTUAL_BANK_ACCOUNT"].Authorizations
Static business API key issued from the dashboard. A business can provision multiple API keys, each scoped to a configurable set of permissions (e.g. read transactions, create deposits, etc). Permissions are chosen per key at creation time in the dashboard and may be revoked by deleting the key. Requests made with a key that does not include the permission required by the target endpoint will be rejected with a 403 Forbidden response; an unrecognised, malformed or revoked key returns 401 Unauthorized. Manage your keys and their permissions under Developer → API keys in the dashboard.
Headers
API version in ISO 8601 format (e.g. 2025-12-28). Defaults to latest stable.
Body
The transaction amount in minor currency units (e.g. kobo for NGN, cents for USD). Minimum 100 (equivalent to 1 major currency unit).
x >= 100500000
Uppercase 3-letter ISO 4217 currency code (e.g. NGN, GHS). Must be a currency enabled for checkout sessions on the business.
"NGN"
Unique merchant-supplied reference for this session. Used end-to-end to look up the session and any resulting transaction.
1"order-2026-05-12-001"
HTTPS URL the customer is redirected to after the hosted checkout flow completes.
"https://merchant.example.com/checkout/return"
Payment channels the customer is allowed to use for this session. Defaults to [VIRTUAL_BANK_ACCOUNT] if omitted.
1VIRTUAL_BANK_ACCOUNT, MOBILE_MONEY, CARD Optional flat key/value metadata to attach to the session. Both keys and values must be strings. At most 50 entries; keys up to 128 characters, values up to 1024 characters.
Response
Checkout session created successfully.
