Checkout
Create a checkout session and poll it until it's paid or expires.
A checkout session is one payment: either for a product, or for an amount your server chooses. Create it from your server, then collect it one of two ways:
- Direct push: send
gatewayand the buyer'scustomer.emailandcustomer.phone. Jami pushes the prompt to their phone; no page is involved. - Payment link: leave out
gateway. You get a Jami link incheckoutUrlto send the buyer; they pick the method and pay there, and can retry until it expires.
Confirm the result by polling or with a webhook. Guide: Collect the payment.
Create a checkout session
POST /api/jamidev/checkoutSend either an amount and a description (a custom amount, no product needed)
or a productId.
curl https://jami.bio/api/jamidev/checkout \
-H "Authorization: Bearer $JAMI_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"amount": 123700,
"description": "Order #1042 — 3 prints",
"metadata": { "orderId": "1042" },
"customer": { "email": "buyer@example.com", "phone": "251911223344" },
"gateway": "telebirr"
}'With the SDK: jami.createCheckout({ amount, description, customer, gateway }).
Guide: Charge any amount.
curl https://jami.bio/api/jamidev/checkout \
-H "Authorization: Bearer $JAMI_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"productId": "p_x7Kf3mQz9aBc",
"customer": { "email": "buyer@example.com", "phone": "251911223344" },
"gateway": "telebirr"
}'With the SDK: jami.createCheckout({ productId, customer, gateway }).
Body
Fields for both kinds of checkout:
Prop
Type
Custom amount (no productId; API token required):
Prop
Type
Product:
Prop
Type
Response
200 with one of three shapes.
{ "sessionId": "6710c2e8b1a2f0012ab34c00", "orderId": "6710c2e8b1a2f0012ab34c11" }{ "sessionId": "6710c2e8b1a2f0012ab34c00", "checkoutUrl": null, "mode": "direct" }{ "sessionId": "6710c2e8b1a2f0012ab34c00", "checkoutUrl": "https://jami.bio/jamidev/pay/cs_Xk2…", "mode": "redirect" }| You sent | Environment | Result |
|---|---|---|
A token and a gateway | Production | direct: the prompt is on the buyer's phone |
A token and a gateway | Sandbox | redirect to the simulator |
A token, no gateway | Either | redirect to a payment link (/jamidev/pay/cs_…). Nothing is charged until the buyer pays there |
| No token (your product's own page) | Either | Unchanged: direct with a gateway, or ArifPay's hosted page without one |
A free product completes immediately in every case, and needs customer.email.
Keep sessionId. Webhooks carry it as data.sessionId, and you poll with it. Sessions
expire after 30 minutes without a payment.
Errors
| Status | When |
|---|---|
400 | Invalid email, missing phone for a direct push, unsupported gateway, invalid metadata, or invalid successUrl. For a custom amount: missing or too-long description, or an amount below 100 or not an integer (messages). For a product: bad amount for pwyw or a missing required checkout field. Without a token, a missing productId. |
401 | Bad token |
404 | Product not found, not published, or not in your organization |
429 | Rate limited; see limits |
502 | The payment provider refused to start the payment; the message says why |
Poll session status
GET /api/jamidev/checkout/{sessionId}No authentication. While a session is open, each call also asks the payment provider for the real status (at most every few seconds per session), so polling resolves even if the provider's notification is late. Expired sessions are closed automatically. Polling every 2 to 3 seconds is fine.
{
"sessionId": "6710c2e8b1a2f0012ab34c00",
"status": "expired",
"expiresAt": "2026-10-16T10:00:00.000Z",
"amount": 15000,
"currency": "ETB",
"orderId": null,
"orderStatus": null,
"failure": {
"code": "payment_timed_out",
"message": "The buyer didn't respond to the payment prompt in time."
}
}Prop
Type
404 means the id isn't a session.
Failure codes
failure.code | What happened | What to tell the buyer |
|---|---|---|
payment_rejected | The provider refused it within seconds; no prompt reached the phone | Try again in a few minutes, or use another method |
payment_failed | Failed after the prompt (wrong PIN, canceled on the phone, low balance), or the provider gave no detail | Check your wallet and try again |
payment_canceled | The buyer canceled | Nothing, or offer to try again |
payment_timed_out | The buyer didn't answer the prompt in time | Try again and confirm the prompt when it appears |
initiate_failed | The payment couldn't be started; message has the provider's reason, such as an unregistered number | Depends on message |
session_expired | 30 minutes passed without a payment | Start a new checkout |
New codes may be added. Treat unknown ones like payment_failed. message is safe to log
or show to the buyer.
Payment link endpoint
POST /api/jamidev/pay/{payToken}Used by the Jami payment page; you don't call it. It starts one attempt on a link with
{ gateway, phone, email?, name? }, where gateway is telebirr, mpesa, cbe or
arifpay (ArifPay's page with every method). For reference, it answers 409 while a prompt
from the previous attempt is still out (up to 150 seconds) or when the link is already paid,
410 once it has expired, and 429 after 30 attempts in 5 minutes from one IP.
