Create a 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).
The response carries the checkoutId and checkoutUrl directly, and no webhook is sent when a session is created. Track the payment with transaction events. Every transaction the customer's payment produces carries your merchantReference as merchantReference, and your metadata as meta, in transaction webhooks and in the transaction responses.
Available in sandbox and production. Create a session with a sandbox API key to try the full flow in test mode, and with a production API key to take real payments.
Request
- Base URLhttps://sandbox.api.afriex.com
- AuthAPI key in header x-api-key
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Request body
Example request
{
"amount": 500000,
"currency": "NGN",
"merchantReference": "order-2026-05-12-001",
"redirectUrl": "https://merchant.example.com/checkout/return",
"name": "Order 2026-05-12-001",
"customer": {
"name": "John Doe",
"email": "john.doe@example.com",
"phone": "+2348192837465",
"countryCode": "NG"
}
}Response
Checkout session created successfully.
Example response
{
"data": {
"checkoutId": "394102",
"checkoutUrl": "https://pay.afriex.com/pay/394102",
"channels": [
"MOBILE_MONEY"
]
}
}Changes
No recorded changes to this operation across all 1 revision of this API.