Checkout Session Request
Create an embedded checkout session
Once authenticated, make a request to create a new embedded checkout session. This generates an order and a checkout_session_url to embed as an iframe.
Make sure you've completed domain setup. The session URL won't load in an iframe on an unregistered domain.
Endpoint
POST /v2/partner/embedded-checkout/{shortcode}/sessionUse the production or sandbox base URL from API conventions.
Headers
| Header | Required | Value |
|---|---|---|
Authorization | Yes | Bearer <ACCESS_TOKEN> |
Content-Type | Yes | application/json |
Accept-Language | No | Language for the checkout. Defaults to en-GB. |
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
shortcode | String | Yes | The organisation's shortcode, for example example-school. |
Request parameters
| Parameter | Type | Char Limit | Required | Description | Example |
|---|---|---|---|---|---|
store_id | String | — | No* | The store this order belongs to. Required unless the organisation has only one store, in which case it defaults to that store. | a7881587-55e5-4a39-b75f-cfc5b39de5c3 |
email_address | String | max: 254 | Yes | The payer's email address | john@example.com |
description | String | max: 254 | No | The payment purpose | admissions payment |
amount | Integer | — | Yes | Payment amount in minor units (pence) | 100 |
country | String | max: 2 | No | Country code in ISO 3166-1 alpha-2 format | GB |
payer_first_name | String | max: 64 | No | The payer's first name | John |
payer_last_name | String | max: 64 | No | The payer's last name | Smith |
address_line_1 | String | max: 128 | No | First line of the payer's address | 1 Test House |
address_line_2 | String | max: 128 | No | Second line of the payer's address | Test Street |
city | String | max: 64 | No | The payer's city | London |
state | String | max: 32 | No | The payer's state | |
postal_code | String | max: 32 | No | The payer's postal code | LL33 0SN |
custom_data | Object | — | No | Any additional data used to identify the transaction | {"key": "value"} |
external_id | String | — | No | The partner's identifier for the order, such as an invoice ID. Returned on the order. Replaces reference. | INV-10432 |
line_items | Array | — | No | The items being paid for. If left out, the order has no line items. See line items. | — |
notification_url | String | max: 512 | No | URL for esenda to POST order status updates | https://partner.example.com/webhooks/esenda |
send_confirmation_email | Boolean | — | No | Send a confirmation email to the payer on success. Defaults to false | true |
allow_payment_retries | Boolean | — | No | Allow payers to retry after failure. Defaults to false | false |
*If not provided and multiple stores exist, the request will fail.
reference is deprecated. It's still accepted and returned, and will be
phased out by the end of 2026. New integrations use external_id.
Line items
Line items are optional. If you leave out line_items, the order has no line
items. Orders without line items can't be refunded through the
Refunds API.
When an order contains line items that use payout routes from different stores, the order will fail. All line items in an order must use payout routes that belong to the same store as the order.
Each entry in line_items has these fields:
| Field | Type | Required | Description |
|---|---|---|---|
external_id | String | Yes | The partner's identifier for the line item. |
description | String | Yes | Shown to the payer. |
amount | Integer | Yes | Amount in minor units (pence). Must be greater than 0. |
payout_route_id | String | Yes | The payout route this line item is paid into. Required when line items are supplied. See payout routes. |
When you supply line items:
- Line-item amounts must add up to the order's
amount. - You can send up to 10 line items.
- All line items must use payout routes from the same store as the order. If a line item uses a payout route from a different store, the request will fail.
A request that breaks any of these rules, or uses an unknown payout_route_id, returns 400 Bad Request.
Example request
{
"store_id": "a7881587-55e5-4a39-b75f-cfc5b39de5c3",
"email_address": "parent@example.com",
"amount": 125000,
"description": "Autumn Term 2026 fees",
"external_id": "INV-10432",
"notification_url": "https://partner.example.com/webhooks/esenda",
"line_items": [
{
"external_id": "INV-10432-1",
"description": "Tuition",
"amount": 100000,
"payout_route_id": "8a1f3c52-6b0e-4f0e-9d4f-2f1c7f5b9a10"
},
{
"external_id": "INV-10432-2",
"description": "Year 9 trip",
"amount": 25000,
"payout_route_id": "7c2e9f4a-5b3d-4e8a-b5c6-3f1d2b3e4a5c"
}
]
}Responses
200 - Success
Store the request_id and order_id. Use checkout_session_url as the src of your iframe.
{
"checkout_session_url": "https://demo-checkout.esenda.com/shortcode/partner_link/8fa6c3e2-5f4b-4d3e-9f4e-2c3b5e6d7f80",
"request_id": "6c6b77ba-fc4a-4a18-a1d9-5b2cdc2f8cdf",
"order_id": "8fa6c3e2-5f4b-4d3e-9f4e-2c3b5e6d7f80"
}400 - Bad Request
{
"error": "Bad request",
"message": "No organisation with shortcode example-school"
}