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

FieldRequiredDescription
amountYesInteger amount in the smallest currency unit. For LKR, Rs 30.00 is 3000.
currencyYesThree-letter currency code, such as LKR.
descriptionOptionalSimple customer-facing display fallback when line_items are not provided.
line_itemsOptionalRecommended itemized customer-facing display.
customerOptionalPrefills customer name, email, and phone.
billing_detailsOptionalPrefills billing name, email, phone, and address.
success_urlYesWhere the customer returns after successful payment.
cancel_urlYesWhere the customer returns after canceling or abandoning checkout.
metadataOptionalNon-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"