Skip to content
API reference

Create checkout session

Hosted-checkout flow — two modes: SELECTOR (customer picks the method) and ONE-SHOT (you pick the method).

POST/api/v1/checkout/sessions
Context and key considerations

Dedicated endpoint for the hosted checkout flow. It has two modes depending on whether you send paymentMethodId in the body or not — both end on a hosted page where the customer pays.

The amount is in USD by default; ledger credits and settlement follow the shop balance model (USD or local currency). Optionally pass acurrency to price in a presentment currency (e.g. "EUR"): we convert to a USD headline at our rate minus the FX markup, return your presentment values as inputCurrency + inputAmount (the response currency stays "USD"), and convert to the buyer's local currency automatically.
SELECTOR mode (recommended) — without paymentMethodId. We mint a cs_xxx session and return a /checkout/<token>. The customer sees the premium grid with ALL of the shop's methods (logo, flag, limits, fee), picks one, and the payment starts automatically against the provider. Zero lines of UI on your side.
ONE-SHOT mode (back-compat) — with paymentMethodId. You skip the selector. We create the tx directly and return /c/<txId> which redirects to the provider's hosted form. Useful when you already know which method the customer wants and don't want to show the grid.
1 / 9

SELECTOR mode (recommended)

The integrator sends only amount + currency + (optional) country + (optional) pre-filled customer data. Do NOT send paymentMethodId. The response carries checkoutUrl = /checkout/<token> — you redirect the customer there and we show the premium grid.

bash
curl https://sandbox.key2pay.ai/api/v1/checkout/sessions \
  -H "Authorization: Bearer sk_test_51N8mP...exampleK3Y" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 100.00,
    "currency": "USD",
    "country": "MX",
    "customer": {
      "firstName": "Carlos",
      "lastName": "Pérez",
      "email": "carlos@example.com",
      "phone": "+52 55 1234 5678"
    },
    "merchantOrderId": "ORD-12345",
    "returnUrl": "https://your-store.com/orders/1234"
  }'
Key2Pay Developer documentationAPI v1
Documentation
Dashboard