Checkout sessions · Create a session
API reference / Checkout sessions
Create a session
POST/api/v1/checkout/sessionsno app scope
Starts a hosted checkout: Inkress prices the cart, runs the fraud check and returns the page to show. The order is made only when the payment succeeds.
A session needs the customer's browser. For a server-to-server flow, create an order or a payment link.
Body
totalnumber
Amount in the major unit. Leave out when products set it.
customerobjectrequired
Who is paying. Matched to an existing customer by email.
emailstringrequired
Receipts go here.
first_namestringrequired
First name.
last_namestringrequired
Last name.
phonestring
With country code.
currency_codestring
JMD or USD.
reference_idstring
Your own ID. Made for you if you leave it out.
titlestring
Shown on the payment page.
productsarray
Items with id and quantity.
discount_codestring
Checked when the session is made; an invalid code refuses the session.
Headers
Authorizationheaderrequired
Bearer with your secret key, or the merchant's OAuth token.
Returns
The session: session_id, status pending, totals (sub_total, customer_total, fees, shipping, tax, discount), frame_url for the payment page and expires.
| status | Meaning |
|---|---|
pending | Created. |
awaiting_payment | The customer is paying. |
payment_pending | The bank hasn't answered yet. |
completed | Paid; order_id is set. |
payment_failed | Declined. |
payment_cancelled | The customer backed out. |
cancelled | You cancelled it. |
expired | Timed out. |
Errors
402 | payment_declined: the fraud check declined it (data.outcome says why), or merchant_unavailable: the merchant can't take payments. |
422 | A customer field is missing (Customer email is required), a product is unknown or out of stock, or the discount code doesn't apply. |