Accept payments
Create a checkout session
A checkout session represents one customer’s attempt to finance one order. Create it from your server with whatever customer details you already have — Pay with ARAF pre-fills them and only asks for what is missing — then open the checkout on your page (or redirect).
Create a session#
/api/v1/checkout/sessionsscope checkout:writeThe Idempotency-Key header is required (8–128 characters from A–Z a–z 0–9 _ - : .). Use one key per logical attempt — for example your order reference plus an attempt counter — and reuse it when retrying after a timeout. See idempotency.
curl -X POST https://pay-with-araf.onrender.com/api/v1/checkout/sessions \
-H "Authorization: Bearer $ARAF_SECRET_KEY" \
-H "Idempotency-Key: order-ORD-10045-attempt-1" \
-H "Content-Type: application/json" \
-d '{"merchant_order_reference":"ORD-10045","currency":"NGN","amount":45000000,"items":[{"sku":"PHONE-001","name":"Sandbox Smartphone X","quantity":1,"unit_amount":45000000,"category":"smartphones","vendor_reference":"VENDOR-LEKKI-ELEC"}],"customer":{"email":"customer@example.com","phone":"+2348030000001"},"return_url":"https://shop.example.com/orders/ORD-10045","cancel_url":"https://shop.example.com/cart"}'Request body#
JSON, snake_case. Unknown fields are rejected. All monetary values are integer kobo (₦1 = 100 kobo).
merchant_order_referencestring (1–64)required- Your order ID. Letters, digits and
. _ : - /only. Unique per order in your store. currency"NGN"required- Only Nigerian naira is supported.
amountinteger (kobo)required- Cart total. Must equal the sum of unit_amount × quantity across items and fall within your configured minimum and maximum.
itemsarray (1–50)required- Cart lines, see below.
items[].skustring (1–64)required- Your SKU. Same character rules as merchant_order_reference.
items[].namestring (1–200)required- Product name shown to the customer and on the financing documents.
items[].quantityinteger (1–1000)required- Quantity.
items[].unit_amountinteger (kobo)required- Unit price in kobo (positive).
items[].categorystring (1–64)required- Product category, matched case-insensitively against your eligible categories and the vendor’s approved categories (e.g. smartphones, laptops, appliances).
items[].vendor_referencestring (1–64)required- The approved vendor that will be paid for this item.
customer.emailemailoptional- Customer contact for delivery and notifications. Shown to your fulfilment staff in the release queue.
customer.phonestringoptional- 10–15 digits, optional leading
+(e.g.+2348030000001). customer.first_name / last_namestring (≤80)optional- Send whatever you already collected — the hosted checkout pre-fills it and only asks the shopper for what is missing.
customer.address{ line1, city, state }optional- Delivery address. Pre-fills account opening for new-to-bank customers.
customer.date_of_birthYYYY-MM-DDoptional- If provided, the shopper is not asked for it. Identity is still confirmed with a one-time code to the BVN-linked phone.
customer.bvn11 digitsoptional- Only if you already hold it lawfully (e.g. KYC-regulated partners). Encrypted at rest, never returned to you, never put in URLs; the shopper sees only its last two digits and can replace it. If it does not match, the shopper is asked to enter it.
return_urlURL (≤2048)required- Where the customer is sent after the hosted checkout. Its origin must be on your approved list (HTTPS in production).
cancel_urlURL (≤2048)required- Where the customer is sent if they abandon checkout. Same origin rules as return_url.
revises_session_idstringoptional- Replace an active session for the same order with a revised cart. See revised carts.
metadataobjectoptional- Up to 64-character keys and 256-character string values. Validated and accepted; it is not currently stored or returned, so keep your own mapping.
Response#
201 Created. A replay with the same Idempotency-Key and body returns the same response with the header Idempotent-Replayed: true.
{
"object": "checkout_session",
"session_id": "cs_test_8jgcwIBR4vXwdvc093VF3lCD",
"application_reference": "ARAF-2026-000002",
"checkout_url": "http://localhost:3001/c/cs_test_8jgcwIBR4vXwdvc093VF3lCD",
"status": "CREATED",
"amount": 45000000,
"currency": "NGN",
"expires_at": "2026-11-26T09:09:03.998Z",
"livemode": false,
"partner": {
"id": "a5e7531d-2293-47f3-9a90-f4a326227a4f",
"name": "AltMall"
}
}session_idstringrequired- The session ID (
cs_test_…/cs_live_…). Store it against your order. application_referencestringrequired- The financing application reference (
ARAF-YYYY-NNNNNN). Use it withGET /applications/{reference}and to match webhooks. checkout_urlURLrequired- Redirect the customer here.
statusstringrequired- CREATED on creation; later OPEN, COMPLETED, EXPIRED, CANCELLED or SUPERSEDED.
expires_atISO 8601required- When the session expires if the customer does not progress (your configured application expiry).
livemodebooleanrequired- false in the sandbox.
Validation rules#
Schema errors — 422 VALIDATION_FAILED
Missing or malformed fields return VALIDATION_FAILED with details.fields[] (path, message) — for example a decimal amount, an unknown field, or a missing Idempotency-Key.
Cart errors — 422 CART_INVALID
The cart is validated server-side; details.errors[] lists every problem found:
| details.errors[] | Meaning |
|---|---|
| EMPTY_CART | items is empty. |
| INVALID_QUANTITY | A quantity is not an integer between 1 and 1000. |
| INVALID_UNIT_AMOUNT | A unit_amount is not a positive integer. |
| CATEGORY_NOT_ELIGIBLE | An item’s category is not in your partner configuration’s eligible categories. |
| CATEGORY_NOT_PERMITTED_FOR_VENDOR | The item’s category is not one the vendor is approved to sell (details.sku names the item). |
| AMOUNT_MISMATCH | amount ≠ Σ(unit_amount × quantity). The API recomputes the total; it never trusts the declared amount. |
| BELOW_PARTNER_MINIMUM | amount is below your configured minimum transaction. |
| ABOVE_PARTNER_MAXIMUM | amount is above your configured maximum transaction. |
| MULTIPLE_VENDORS_NOT_SUPPORTED | Items reference more than one vendor and your configuration does not allow multi-vendor carts. |
Vendors — 422 VENDOR_NOT_ELIGIBLE
Every vendor_reference must be one of your vendors, approved by the Bank, with an active and verified settlement account. Otherwise the request fails with details.vendor_reference.
Return URLs — 422 RETURN_URL_NOT_APPROVED
The origins (scheme + host + port) of return_url and cancel_url must exactly match an approved origin for your account — this prevents open redirects. Approved origins are listed in Partner portal → Integration and changed by the Bank’s onboarding team. Production requires HTTPS.
{
"error": {
"code": "CART_INVALID",
"message": "The cart failed validation.",
"retryable": false,
"details": {
"errors": [
"AMOUNT_MISMATCH"
]
},
"correlation_id": "0c5d7e7a-3c8f-4e0e-9b1e-2f3a8d7c1b20"
}
}Duplicate checkouts#
Only one live financing attempt is allowed per merchant_order_reference. Creating another returns 409 DUPLICATE_CHECKOUT:
- If an active session exists (created/open, not expired, and its application is not declined, cancelled or expired),
details.session_ididentifies it. Redirect the customer to that session, or revise it. - If the order’s application has already been submitted beyond the offer stage, the message is “A financing application for this order has already been submitted.” and
details.application_referenceidentifies it. - After a previous attempt was declined, cancelled or expired, you may create a new session for the same order.
Different Idempotency-Key values do not bypass this check — it is enforced per order, under a lock.
Revised carts#
If the customer changes their cart — or is eligible for less than the cart total (application.action_required with reason: "CART_REVISION_REQUIRED") — create a new session for the same order with revises_session_id set to the active session’s ID:
- The revised session gets a new
session_idandapplication_reference. - The old session becomes
SUPERSEDED(itssuperseded_bypoints to the new session) and its application is cancelled. revises_session_idmust reference an active session for the same order, and revision is only possible before the customer accepts an offer; otherwise you receive409 INVALID_STATE.
Retrieve a session#
/api/v1/checkout/sessions/{session_id}scope checkout:readcurl https://pay-with-araf.onrender.com/api/v1/checkout/sessions/cs_test_8jgcwIBR4vXwdvc093VF3lCD \
-H "Authorization: Bearer $ARAF_SECRET_KEY"{
"object": "checkout_session",
"session_id": "cs_test_8jgcwIBR4vXwdvc093VF3lCD",
"status": "CREATED",
"application_reference": "ARAF-2026-000002",
"application_status": "CUSTOMER_ACTION_REQUIRED",
"merchant_order_reference": "ORD-10045",
"amount": 45000000,
"currency": "NGN",
"checkout_url": "http://localhost:3001/c/cs_test_8jgcwIBR4vXwdvc093VF3lCD",
"expires_at": "2026-11-26T09:09:03.998Z",
"superseded_by": null
}404 NOT_FOUND.