Create checkout
jami_create_checkoutCreate a checkout for a published product or custom amount in Ethiopian birr, returning a payment link or direct mobile payment prompt via Telebirr, M-Pesa, or CBE Birr.
Instructions
Start a checkout and get back how the buyer pays — either for one of the organization's published products, or for ANY amount with no product ("charge this buyer 1,237 ETB for order #1042").
Buyers pay in ETB via Telebirr, M-Pesa or CBE Birr; nothing is added on top. In LIVE mode a "direct" checkout pushes a real payment prompt to the buyer's phone, so only call this when the user actually wants to charge someone.
What to charge:
Product: product_id (p_… token or 24-char id, must be published). amount_minor only for flexible-price (pwyw) products.
Custom amount: omit product_id, pass amount_minor (≥ 100 = 1.00 ETB) and description (what the buyer sees, ≤ 120 chars).
How to collect it:
Direct push: pass gateway + customer_email + customer_phone. The prompt goes straight to the buyer's phone (kind 'direct').
Payment link: omit gateway. You get a Jami link in checkout_url (kind 'redirect') to send the buyer by SMS/Telegram/email; they pick the method and enter their details there, and can retry a failed attempt until the link expires (30 min). customer_* is optional.
Args:
customer_email / customer_phone: required for a direct push; optional for a link. Phone like "251911223344" or "0911223344". Sandbox magic numbers: 251900000001 = instant success, 251900000002 = instant failure.
gateway: 'telebirr' | 'mpesa' | 'cbe'. Omit for a payment link.
amount_minor: integer santim. 123700 = 1,237.00 ETB.
metadata: optional string map (e.g. { "orderId": "1042" }) stored on the order and sent back on order webhooks.
Returns: { session_id, kind: 'free' | 'redirect' | 'direct', checkout_url, order_id }.
free: completed instantly; order_id is set.
redirect: send the buyer to checkout_url.
direct: the buyer confirms on their phone; call jami_wait_for_checkout next.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| gateway | No | Payment method for paid products | |
| metadata | No | Your own key/values, returned on order webhooks (max 20 keys) | |
| product_id | No | Product token (p_…) or id. Omit for a custom-amount checkout. | |
| description | No | Custom amount only: what the buyer is paying for, e.g. "Order #1042" | |
| success_url | No | Where to send the buyer after paying | |
| amount_minor | No | Integer santim. Required for custom amounts (≥ 100) and pay-what-you-want products; ignored for fixed prices | |
| checkout_link | No | Checkout link token (cl_…) to attribute this session to | |
| customer_name | No | ||
| customer_email | No | Buyer email for the receipt. Required with gateway; optional for a payment link | |
| customer_phone | No | Buyer phone, e.g. "251911223344" | |
| collected_fields | No | Answers to the product's checkout fields, keyed by field id | |
| customer_external_id | No | Your own user id, stored on the customer record |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | Yes | ||
| order_id | Yes | ||
| session_id | Yes | ||
| checkout_url | Yes |