Skip to content
Meem Payment

Accept payments

Hosted checkout sessions

Create a session on your server, redirect the customer to the Meem-hosted page in English or Arabic, and read the result when they come back. Card data is entered on the hosted page and never reaches your systems.

How the flow works

  1. Your server calls POST /api/v1/checkout/sessions and gets a session token and a checkoutUrl.
  2. Redirect the customer's browser to checkoutUrl.
  3. The hosted page shows the order summary, the methods you allowed and your checkout profile's branding, then processes the payment through your routing workflow.
  4. The customer returns to your successUrl or failureUrl with paymentId and status as query parameters.
  5. Your server confirms the outcome with GET /api/v1/payments/{paymentId} and/or the webhook before fulfilling the order.

Create a session

POST/api/v1/checkout/sessions
Bearer tokenPermission: checkout_sessions.manage
curl -X POST "https://api.sandbox.meem-dev.example/api/v1/checkout/sessions" \
  -H "Authorization: Bearer $MEEM_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 249.5,
    "currency": "SAR",
    "orderRef": "ORDER-2001",
    "successUrl": "https://shop.example.com/checkout/return",
    "failureUrl": "https://shop.example.com/checkout/return",
    "expiryMinutes": 30,
    "captureMode": "Automatic",
    "locale": "ar",
    "description": "Order #2001"
  }'

Request body

amountnumberrequired
Greater than zero.
currencystringrequired
ISO 4217, e.g. SAR.
orderRefstringoptional
Your order reference, shown on the page and kept with the session.
successUrl · failureUrlstringoptional
Absolute URLs the customer returns to.
expiryMinutesintegeroptional
Positive number of minutes. Default 30.
captureModestringoptional
Automatic (default) captures on approval; Manual leaves the payment authorized for you to capture.
checkoutProfileIdstring (uuid)optional
An active checkout profile of yours (branding, method order, copy). Without it, your default active profile applies, else platform defaults. Unknown or inactive profiles return 422.
workflowIdstringoptional
Pin a published routing workflow (id or code).
allowedPaymentMethodsarray<string>optional
Limit the methods offered, e.g. ["card", "mada"].
localestringoptional
Page language, e.g. ar or en.
description · customerName · customerEmailstringoptional
Shown on the hosted page.

Response (from the API contract)

{
  "sessionId": "ff2606f7-9ca8-4343-a2c4-018329ef501d",
  "token": "cs_<session_token>",
  "checkoutUrl": "https://checkout.sandbox.meem-dev.example/checkout?session=cs_<session_token>",
  "expiresAt": "2026-12-03T10:00:00+00:00",
  "amount": 249.5,
  "currency": "SAR",
  "orderRef": "ORDER-2001",
  "merchantName": "<your merchant name>"
}

Handle the return

GET https://shop.example.com/checkout/return?paymentId=6f1c2a9e-4b7d-4c1e-9a53-0d2b8f7e1c44&status=Captured

Read paymentId, then fetch the payment from your server and check status and amount against your order:

paymentId="<payment_id>"

curl -X GET "https://api.sandbox.meem-dev.example/api/v1/payments/$paymentId" \
  -H "Authorization: Bearer $MEEM_ACCESS_TOKEN"

Endpoints used by the hosted page

The hosted page calls these with the session token as its capability; they don't take your API token. You normally don't call them yourself, but they explain the status codes you may see in logs.

EndpointPurpose and statuses
GET /api/v1/checkout/sessions/{token}Order summary, branding and offered methods. 404 unknown, 410 expired.
POST /api/v1/checkout/sessions/{token}/payPays the session. 200, 402 declined, 409 already paid or closed, 410 expired, 422 invalid card, 502 no gateway could process it.
POST /api/v1/checkout/sessions/{token}/complete?paymentId=…Returns the redirect URL carrying paymentId and status.
POST /api/v1/checkout/sessions/{token}/expireEnforces expiry and voids any in-flight authorization.
POST /api/v1/checkout/3ds/callbackResumes the payment after the 3-D Secure challenge.
{
  "sessionId": "ff2606f7-9ca8-4343-a2c4-018329ef501d",
  "status": "Expired",
  "isExpired": true,
  "amount": 249.5,
  "currency": "SAR",
  "orderRef": "ORDER-2001"
}

Recovery after a decline

When recovery is enabled in Checkout Studio and on the workflow, a conclusive decline on the hosted page can lead to a branded recovery page where the customer chooses another card or another eligible method. The recovery payment is a new payment correlated to the first, on channel recovery, and runs its own workflow. Your order is paid exactly once.

  • There is no automatic retry of the customer's payment.
  • Recovery is refused for security or fraud declines, unresolved or unknown payments, orders already paid, or when it's disabled.
  • Recovery sessions are signed, expire, cap attempts (1–5) and prevent loops.
  • Server-to-server payments made with POST /api/v1/payments are not covered.

Listen for webhooks on both payments: a declined original can be followed by a captured recovery payment for the same order.

Methods on the hosted page

  • Cards (Visa, Mastercard, Amex) and mada

    Through the PSP adapters; live round-trips with your PSP credentials pending.

    Sandbox
  • Card entry on the hosted page

    Production card capture needs PSP tokenization, which is planned.

    Sandbox
  • Apple Pay, Google Pay, Samsung Pay, STC Pay

    Simulated
  • Tabby, Tamara (BNPL)

    Simulated

Documentation reflects the platform as verified on 3 December 2026. Placeholder hosts and credentials are used throughout; your real sandbox host and keys are provided at onboarding.