Zenso Docs
Checkout sessions
The primary server-side API for accepting one-time payments with Hosted Checkout.
Create request
Minimal request
json
{
"amount": 3000,
"currency": "LKR",
"description": "Invoice 1001",
"success_url": "https://example.com/success",
"cancel_url": "https://example.com/cancel",
"metadata": {
"order_id": "order_123"
}
}Customer and line items
json
{
"amount": 3000,
"currency": "LKR",
"line_items": [
{
"name": "Invoice 1001",
"amount": 3000,
"quantity": 1,
"currency": "LKR"
}
],
"customer": {
"email": "customer@example.com",
"name": "Jane Perera",
"phone": "+94770000000"
},
"billing_details": {
"first_name": "Jane",
"last_name": "Perera",
"email": "customer@example.com",
"phone": "+94770000000",
"address": {
"line1": "123 Main Street",
"city": "Colombo",
"country": "LK"
}
},
"success_url": "https://example.com/success",
"cancel_url": "https://example.com/cancel",
"metadata": {
"order_id": "order_123"
}
}Fields
| Field | Required | Description |
|---|---|---|
| amount | Yes | Integer amount in the smallest currency unit. For LKR, Rs 30.00 is 3000. |
| currency | Yes | Three-letter currency code, such as LKR. |
| description | Optional | Simple customer-facing display fallback when line_items are not provided. |
| line_items | Optional | Recommended itemized customer-facing display. |
| customer | Optional | Prefills customer name, email, and phone. |
| billing_details | Optional | Prefills billing name, email, phone, and address. |
| success_url | Yes | Where the customer returns after successful payment. |
| cancel_url | Yes | Where the customer returns after canceling or abandoning checkout. |
| metadata | Optional | Non-sensitive merchant metadata, such as order_id. |
Retrieve session
curl
bash
curl "$ZENSO_API_BASE/api/v1/checkout/sessions/cs_.../" \
-H "Authorization: Bearer $ZENSO_SECRET_KEY"