Checkout API

Six operations: create a session, read it, hand the buyer to the acquirer, confirm what happened, and inspect the order. For the flow and the buyer's experience, see Hosted checkout.

POST /v1/checkout/sessions

FieldTypeNotes
merchant_iduuidThe selling merchant.
country_codestringBuyer billing country; checked for eligibility before routing.
currencystringCharge currency.
selected_mechanismstringCARD, ACH, SEPA, UPI, …
amountnumberPre-tax order value.
titlestring?Shown to the buyer on the hosted page.
descriptionstring?One line under the title.
customer_emailstring?Prefills the receipt address.
{
  "session": { "id": "…", "status": "OPEN", "expires_at": "…" },
  "routing": { "chain": ["<vendor-id>", "<fallback-id>"], "reason": "PRIORITY" },
  "checkoutLatencyBudgetMs": 300
}

Sessions expire after 15 minutes. Creation resolves the acquirer chain up front, so the buyer is never routed mid-payment. routing.reason is PRIORITY or OPTIMIZE_COST when a rule matched, and ENTITY_DEFAULT when none did — in that case the entity's own acquirers are used in country order (RAZORPAY, CASHFREE, STRIPE_IN for India; STRIPE_US, ADYEN, STRIPE elsewhere).

GET /v1/checkout/sessions/:id/public

The safe projection the hosted page renders: merchant name, title, subtotal, tax, total and status. It never exposes the vendor chain, the merchant id or the fee.

{
  "id": "…",
  "merchant": "Acme Inc",
  "title": "Pro plan",
  "status": "OPEN",
  "currency": "USD",
  "subtotal": 29,
  "tax": { "amount": 0, "rateBps": 0, "taxType": "SALES_TAX", "reverseCharge": false, "label": "No tax applies" },
  "total": 29,
  "expiresAt": "2026-12-03T10:15:00.000Z"
}

POST /v1/checkout/sessions/:id/hosted

Creates a checkout on the acquirer’s own domain and returns the URL to send the buyer to. Card data is entered there, so it never reaches Arilator.

{
  "email": "buyer@example.com",
  "return_url": "https://www.arilator.com/pay/<session-id>/return"
}
{ "url": "https://checkout.stripe.com/c/pay/cs_test_…",
  "provider": "STRIPE_US",
  "mode": "test",
  "total": 29,
  "currency": "USD" }

No acquirer, no charge. When the entity has no configured acquirer for the country and currency, the call returns 503 with ACQUIRER_NOT_CONFIGURED. It never falls back to a different entity's account and never simulates a success.

POST /v1/checkout/sessions/:id/complete

Called when the buyer returns. Arilator asks the acquirer what actually happened and writes the order and ledger only on a confirmed payment. It is safe to call repeatedly: one order per session, enforced by a unique index.

{ "hosted_session_id": "cs_test_…" }
{ "status": "PAID",
  "order": { "id": "…", "subtotal": "29.0000", "tax_amount": "0.0000",
             "total_charged": "29.0000", "currency": "USD", "status": "PAID" },
  "alreadyCompleted": false }

Possible statuses: PAID, PENDING (the network has not settled), EXPIRED.

POST /v1/checkout/sessions/:id/attempts

Simulated outcomes for exercising failover before live credentials exist. Body:{ "outcomes": [{ "status": "FAILED", "failure_code": "DO_NOT_HONOR" }] }. Not used by the hosted page.

Orders

An order carries subtotal, tax_amount, total_charged, commission_amount, vendor_fee_actual and merchant_net. merchant_net is what reaches your ledger — it is not a computed preview.

Order statuses: PENDING, PAID, FAILED, REFUNDED, DISPUTED. A refund returns the purchase price and tax; the Arilator fee is retained because acquiring was already paid.