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/sessionsCreate a checkout session and return a hosted URL.
GET
/v1/checkout/sessions/{id}Retrieve a session's current state.
POST
/v1/checkout/sessions/{id}/expireForce-expire a session (idempotent).
Create
| Name | Type | Description |
|---|---|---|
amountrequired | integer | Minor units. |
currencyrequired | ISO 4217 | "DJF", "USD". |
allowed_provider_codes | array | Restrict which rails the customer can pick. Defaults to all your live providers. |
success_urlrequired | url | Customer lands here on success. We append ?session_id=cs_… for verification. |
cancel_urlrequired | url | Customer lands here if they back out. |
expires_at | datetime | Session expiry. Default: 1 hour from creation. Max 24h. |
customer_email | string | Pre-fill the email field; used for receipts. |
description | string | Order summary shown on the checkout page. |
metadata | map | Free-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.