Esenda
Embedded Checkout

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}/session

Use the production or sandbox base URL from API conventions.

Headers

HeaderRequiredValue
AuthorizationYesBearer <ACCESS_TOKEN>
Content-TypeYesapplication/json
Accept-LanguageNoLanguage for the checkout. Defaults to en-GB.

Path parameters

ParameterTypeRequiredDescription
shortcodeStringYesThe organisation's shortcode, for example example-school.

Request parameters

ParameterTypeChar LimitRequiredDescriptionExample
store_idString—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_addressStringmax: 254YesThe payer's email addressjohn@example.com
descriptionStringmax: 254NoThe payment purposeadmissions payment
amountInteger—YesPayment amount in minor units (pence)100
countryStringmax: 2NoCountry code in ISO 3166-1 alpha-2 formatGB
payer_first_nameStringmax: 64NoThe payer's first nameJohn
payer_last_nameStringmax: 64NoThe payer's last nameSmith
address_line_1Stringmax: 128NoFirst line of the payer's address1 Test House
address_line_2Stringmax: 128NoSecond line of the payer's addressTest Street
cityStringmax: 64NoThe payer's cityLondon
stateStringmax: 32NoThe payer's state
postal_codeStringmax: 32NoThe payer's postal codeLL33 0SN
custom_dataObject—NoAny additional data used to identify the transaction{"key": "value"}
external_idString—NoThe partner's identifier for the order, such as an invoice ID. Returned on the order. Replaces reference.INV-10432
line_itemsArray—NoThe items being paid for. If left out, the order has no line items. See line items.—
notification_urlStringmax: 512NoURL for esenda to POST order status updateshttps://partner.example.com/webhooks/esenda
send_confirmation_emailBoolean—NoSend a confirmation email to the payer on success. Defaults to falsetrue
allow_payment_retriesBoolean—NoAllow payers to retry after failure. Defaults to falsefalse

*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:

FieldTypeRequiredDescription
external_idStringYesThe partner's identifier for the line item.
descriptionStringYesShown to the payer.
amountIntegerYesAmount in minor units (pence). Must be greater than 0.
payout_route_idStringYesThe 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"
}

On this page