Create a checkout session
deonpay_create_checkout_sessionCreates an ephemeral checkout session for one-time payments, returning a URL to redirect customers and a session ID for later lookup.
Instructions
Create an ephemeral checkout session (Stripe-style). Use this when integrating an e-commerce flow: the user wants a one-time payment URL tied to a specific cart and a success_url to land on after payment. The response contains url (where to redirect the customer) and session_id (used to look up the session later). Amounts are in CENTAVOS. Mode defaults to 'redirect' — use 'embedded' or 'modal' only if the calling app already supports those flows. The session expires by default in 30 minutes (override with expires_in, range 5..1440).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| line_items | Yes | At least one line item. Each item is either a catalog reference {product_id, quantity} or inline {name, quantity, unit_amount}. unit_amount is in centavos. | |
| success_url | Yes | Where the customer is redirected after a successful payment. Supports {session_id} as a placeholder, e.g. https://my-shop.com/order/done?session_id={session_id}. | |
| cancel_url | No | Where the customer is redirected if they abandon checkout. | |
| mode | No | Display mode. Defaults to 'redirect'. | |
| expires_in | No | Minutes until the session expires (default 30, max 1440). | |
| allow_msi | No | ||
| msi_options | No | ||
| customer_email | No | ||
| customer_name | No | ||
| customer_phone | No | ||
| client_reference_id | No | Your internal order/cart id for reconciliation. | |
| metadata | No | ||
| customization | No | Visual overrides for the hosted page. Only the keys you set are merged into the merchant defaults. | |
| custom_fields | No | ||
| locale | No | Checkout UI language. | |
| display_currency | No | ||
| exchange_rate | No | ||
| allow_save_card | No | Whether the customer can save their card for future use. |
Implementation Reference
- src/tools/checkout.ts:79-81 (handler)The actual handler for deonpay_create_checkout_session. It POSTs the sanitized args (with undefined/null/empty values removed via `compact`) to /checkout/sessions on the DeonPay API, wrapped in safeHandler for error handling.
safeHandler(async (args) => { return client.post("/checkout/sessions", compact(args)); }),