---
title: "Create a Payment Session"
method: POST
path: "/checkout/v1/sessions"
tags: ["Hosted Checkout"]
---

# Create a Payment Session

`POST /checkout/v1/sessions`

Creates a new Hosted Checkout session. Tonder returns a URL for you to redirect your customer to complete the payment.
The session tracks the overall payment state and can handle multiple payment attempts if the first one fails.

## Request body

- CreateSessionRequest
  - `customer` object, required
    - `first_name` string, required — Customer's first name
    - `last_name` string, required — Customer's last name
    - `email` string, email, required — Customer's email address
  - `amount_total` number, required — Total charge amount
  - `currency` 'MXN', required — Currency code
  - `line_items` object[], required — List of order items
    - `name` string, required — Name or title of the product or service being purchased
    - `quantity` number, required — Quantity of the item to be purchased (must be >= 1)
    - `unit_price` number, required — Unit price of the item
    - `product_id` string — Optional product identifier used by the merchant's internal system
  - `external_id` string — Unique order reference from the merchant. Used to visually identify/filter the order in dashboard
  - `expires_at` integer — Unix timestamp (seconds). Must be 30 min to 24h in future. Default 24h
  - `metadata` object — Additional metadata
  - `success_url` string, uri — Redirect after successful payment
  - `return_url` string, uri — Required if success_url is not set. If specified, used as fallback for all redirects
  - `pending_url` string, uri — Redirect if payment is under review. Only applicable for future APM support
  - `payment_method_types` string[] — Defaults to ["card"]. Currently only card is supported
  - `checkout_type` 'hosted' — Defaults to "hosted"
  - `session_type` 'payment' — Defaults to "payment"
  - `ui_config_version` string — Version of the UI config. Defaults to "V1"
  - `ui_config` UIConfig — UI configuration for Hosted Checkout customization
    - `branding` object
      - `brand_color` string — Primary brand color (hex code)
    - `theme` object
      - `shapes` 'rounded' | 'square' — Shape style for UI elements

## Response `201`

Session created successfully

- CheckoutSession
  - `id` string — Unique session identifier
  - `url` string, uri — Redirect your customer to this URL to begin the payment
  - `status` 'pending' | 'completed' | 'expired' — Session status
  - `payment_id` number — Associated payment ID
  - `amount_total` number — Total amount to be charged
  - `currency` string — Currency used
  - `expires_at` integer — Expiration time (Unix timestamp in seconds)
  - `external_id` string — Order reference from the merchant
  - `session_type` string — Type of session
  - `checkout_type` string — Checkout method
  - `success_url` string, uri, nullable — Success redirect URL
  - `return_url` string, uri — Return/fallback redirect URL
  - `pending_url` string, uri, nullable — Pending redirect URL
  - `metadata` object — Custom data sent by the merchant
  - `payment_method_types` string[] — Allowed payment methods
  - `ui_config` object — UI configuration applied
  - `ui_config_version` string — Version of UI config
  - `created_at` integer — Creation timestamp in milliseconds
  - `modified_at` integer — Last modification timestamp in milliseconds
  - `paid_at` integer, nullable — Payment completion timestamp in milliseconds
  - `customer` object
    - `first_name` string
    - `last_name` string
    - `email` string
  - `line_items` object[]
    - `name` string
    - `quantity` number
    - `unit_price` number
    - `product_id` string
  - `transaction_status` 'Pending' | 'Success' | 'Declined' | 'Expired' — Result of transaction
  - `provider` string — Gateway used

---

[API](https://skmtc.net/tonderio/apis/tonder.md) · [All operations](https://skmtc.net/tonderio/apis/tonder/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/tonderio/tonder/versions/aface34fb9b2/schema)
