SANDBOX — simulated integrations, synthetic data, no real money moves · Docs describe the sandbox build
Skip to content

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#

POST/api/v1/checkout/sessionsscope checkout:write

The 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_reference
string (1–64)required
Your order ID. Letters, digits and . _ : - / only. Unique per order in your store.
currency
"NGN"required
Only Nigerian naira is supported.
amount
integer (kobo)required
Cart total. Must equal the sum of unit_amount × quantity across items and fall within your configured minimum and maximum.
items
array (1–50)required
Cart lines, see below.
items[].sku
string (1–64)required
Your SKU. Same character rules as merchant_order_reference.
items[].name
string (1–200)required
Product name shown to the customer and on the financing documents.
items[].quantity
integer (1–1000)required
Quantity.
items[].unit_amount
integer (kobo)required
Unit price in kobo (positive).
items[].category
string (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_reference
string (1–64)required
The approved vendor that will be paid for this item.
customer.email
emailoptional
Customer contact for delivery and notifications. Shown to your fulfilment staff in the release queue.
customer.phone
stringoptional
10–15 digits, optional leading + (e.g. +2348030000001).
customer.first_name / last_name
string (≤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_birth
YYYY-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.bvn
11 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_url
URL (≤2048)required
Where the customer is sent after the hosted checkout. Its origin must be on your approved list (HTTPS in production).
cancel_url
URL (≤2048)required
Where the customer is sent if they abandon checkout. Same origin rules as return_url.
revises_session_id
stringoptional
Replace an active session for the same order with a revised cart. See revised carts.
metadata
objectoptional
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.

201 Created
{
  "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_id
stringrequired
The session ID (cs_test_… / cs_live_…). Store it against your order.
application_reference
stringrequired
The financing application reference (ARAF-YYYY-NNNNNN). Use it with GET /applications/{reference} and to match webhooks.
checkout_url
URLrequired
Redirect the customer here.
status
stringrequired
CREATED on creation; later OPEN, COMPLETED, EXPIRED, CANCELLED or SUPERSEDED.
expires_at
ISO 8601required
When the session expires if the customer does not progress (your configured application expiry).
livemode
booleanrequired
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:

Cart validation errors
details.errors[]Meaning
EMPTY_CARTitems is empty.
INVALID_QUANTITYA quantity is not an integer between 1 and 1000.
INVALID_UNIT_AMOUNTA unit_amount is not a positive integer.
CATEGORY_NOT_ELIGIBLEAn item’s category is not in your partner configuration’s eligible categories.
CATEGORY_NOT_PERMITTED_FOR_VENDORThe item’s category is not one the vendor is approved to sell (details.sku names the item).
AMOUNT_MISMATCHamount ≠ Σ(unit_amount × quantity). The API recomputes the total; it never trusts the declared amount.
BELOW_PARTNER_MINIMUMamount is below your configured minimum transaction.
ABOVE_PARTNER_MAXIMUMamount is above your configured maximum transaction.
MULTIPLE_VENDORS_NOT_SUPPORTEDItems 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.

422 Unprocessable Entity
{
  "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_id identifies 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_reference identifies 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_id and application_reference.
  • The old session becomes SUPERSEDED (its superseded_by points to the new session) and its application is cancelled.
  • revises_session_id must reference an active session for the same order, and revision is only possible before the customer accepts an offer; otherwise you receive 409 INVALID_STATE.

Retrieve a session#

GET/api/v1/checkout/sessions/{session_id}scope checkout:read
curl https://pay-with-araf.onrender.com/api/v1/checkout/sessions/cs_test_8jgcwIBR4vXwdvc093VF3lCD \
  -H "Authorization: Bearer $ARAF_SECRET_KEY"
200 OK
{
  "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
}
Sessions and every other resource are scoped to your partner account and environment: identifiers belonging to anyone else return 404 NOT_FOUND.