API · Money movement

Hosted Checkout

Redirect your customer to a MerasPay-hosted payment page on checkout.merashub.com. They pick the rail, complete payment, return to your return_url. SAQ-A PCI scope, multi-language, branded per merchant.

3 endpointscs_

Endpoints

POST/v1/checkout/sessions

Create a checkout session and return a hosted URL.

GET/v1/checkout/sessions/{id}

Retrieve a session's current state.

POST/v1/checkout/sessions/{id}/expire

Force-expire a session (idempotent).

Create

NameTypeDescription
amount
required
integerMinor units.
currency
required
ISO 4217"DJF", "USD".
allowed_provider_codesarrayRestrict which rails the customer can pick. Defaults to all your live providers.
success_url
required
urlCustomer lands here on success. We append ?session_id=cs_… for verification.
cancel_url
required
urlCustomer lands here if they back out.
expires_atdatetimeSession expiry. Default: 1 hour from creation. Max 24h.
customer_emailstringPre-fill the email field; used for receipts.
descriptionstringOrder summary shown on the checkout page.
metadatamapFree-form key/value.

Sample

bashbash
curl -X POST https://api.merashub.com/v1/checkout/sessions \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 50000,
    "currency": "DJF",
    "allowed_provider_codes": ["waafi", "cac", "sabapay"],
    "success_url": "https://yoursite.example/orders/42/done",
    "cancel_url":  "https://yoursite.example/orders/42",
    "description": "Order #42 — 2× espresso"
  }'
201 Createdjson
{
  "id": "cs_01HZ...",
  "url": "https://checkout.merashub.com/cs_01HZ...",
  "status": "open",
  "expires_at": "2026-05-25T11:15:30Z",
  "created_at": "2026-05-25T10:15:30Z"
}

Hosted vs Direct

Use Hosted Checkout when you don't want to host the payment UI yourself — you redirect, we render, customer pays, returns. Use Payment Intents + the JS SDK when you want to embed the flow in your own app.

Verify on the return

The success_url hit is not a signed callback — it's just a redirect. Always re-fetch the session via GET /v1/checkout/sessions/{id} on your server, or listen for the checkout.session.completed webhook before fulfilling the order.