Hosted Checkout
Payment Request
Create a hosted checkout payment request
Once authenticated, make a request to start a new transaction. This generates a payment link to redirect the user to and a request_id to track the payment status.
Production: POST https://api.esenda.com/v1/partner/payment-links/one-time-use
Sandbox: POST https://api-demo.esenda.com/v1/partner/payment-links/one-time-use
Headers
Accept-Language: <LANGUAGE> (optional, default en-GB)
Authorization: Bearer <ACCESS_TOKEN>
Content-Type: application/jsonRequest Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
shortcode | String | Yes | Your Esenda identifier | example_school |
email_address | String | Yes | The payer's email address | john@example.com |
description | String | Yes | The payment purpose | admissions payment |
amount | Integer | Yes | Payment amount in the lowest denomination of client currency (e.g. pence) | 100 |
country | String | No | Country code in ISO 3166-1 alpha-2 format | GB |
payor_first_name | String | No | The payor's first name | John |
payor_last_name | String | No | The payor's last name | Smith |
address_line_1 | String | No | First line of the payor's address | 1 Test House |
address_line_2 | String | No | Second line of the payor's address | Test Street |
city | String | No | The payor's city | London |
state | String | No | The payor's state | |
postal_code | String | No | The payor's postal code | LL33 0SN |
custom_data | Object | No | Any additional data used to identify the transaction | {"key": "value"} |
return_url | String | No | URL to redirect the payor after completing payment | https://your-site.com |
notification_url | String | No | URL for Esenda to POST a transaction status update | https://webhooks.com |
link_expiry_date | String | No | Expiry date for the payment link — defaults to 48 hours after creation | 2024-07-24 |
Payload Example
{
"shortcode": "example_school",
"email_address": "john@example.com",
"description": "admissions payment",
"amount": 100,
"country": "GB",
"payor_first_name": "John",
"payor_last_name": "Smith",
"address_line_1": "somestreet",
"address_line_2": "someplace",
"city": "London",
"state": "unsure",
"postal_code": "LL33 0SN",
"custom_data": {
"additionalProp1": "prop",
"additionalProp2": "PROP"
},
"return_url": "https://your-site.com",
"notification_url": "https://webhooks.com",
"link_expiry_date": "2024-07-24"
}Responses
200 — Success
Store the request_id and redirect the user to payment_link.
{
"payment_link": "https://epay.esenda.com/shortcode/b768c458-1f83-41c9-8147-6ac4ad153dfa",
"request_id": "6c6b77ba-fc4a-4a18-a1d9-5b2cdc2f8cdf"
}400 — Bad Request
{
"error": "Bad request",
"message": "No organisation with shortcode {GBC-1234}"
}Return URL Parameters
After payment, if a return_url was supplied, the user is redirected there with these query parameters:
| Parameter | Description | Values |
|---|---|---|
referenceId | UUID payment identifier | UUID |
paymentType | Payment method used | open_banking, card, bank_transfer |
Example:
https://your-site.com?referenceId=b768c458-1f83-41c9-8147-6ac4ad153dfa&paymentType=card