Skip to content

Search API reference

Find an endpoint or a guide of the Sovgate API reference and jump straight to it.

Create a checkout session

Open a session with what you sell, and send your customer to its url.

POST/v1/checkout/sessions

Opens a checkout session. Your server reads the cart from your own records, never prices sent by the browser, and names each line's name, description, image, amount and quantity. Nothing is added to your product catalog. The answer carries the session's url: redirect your customer to it.

The url is shown once

The url comes back only when the session is created. Repeating the request with the same idempotency key returns a fresh url, and the earlier unused one stops working.

Endpoint

http
POST /v1/checkout/sessions

Request body

NameTypeRequiredDescription
modeenumRequiredpayment, subscription or setup.
ui_modeenumOptionalhosted_page, the default.
line_itemsarrayRequiredWhat it sells, up to 100 lines (20 recurring and 20 one-time in subscription mode; none in setup mode). Each has a quantity from 1 to 10,000 and a price_data with currency, unit_amount (in cents, up to 99,999,999), product_data (name, and optional description and images, up to 8 https addresses) and, in subscription mode, recurring (unit: day, week, month or year, and count).
success_urlstringRequiredWhere the page sends the customer once they've paid. It may carry {CHECKOUT_SESSION_ID}, replaced by the session's ID. In live mode, its domain must be on your allowed return addresses.
cancel_urlstringOptionalThe page's way back to your site.
customerstringOptionalA customer of yours, cust_.... Leave it out for a guest.
customer_emailstringOptionalA guest's email, filled in on the page. Only without customer.
client_reference_idstringOptionalYour own reference, such as an order or a cart, to find it again.
metadataobjectOptionalUp to 50 keys of your own: keys up to 40 characters, values up to 500.
collectobjectOptionalWhat the page asks for: billing_address (auto, only what the card needs, or required), shipping_address (boolean) with shipping_countries, phone, tax_id and terms_of_service (booleans).
payment_descriptionstringOptionalWhat its payment says it's for. Default: its lines.
integration_identifierstringOptionalA tag of yours that groups sessions by integration, shown in the Dashboard.
expires_attimestampOptionalWhen it stops taking a payment: from 30 minutes to 24 hours from now. Default: 24 hours.

Example request

bash
curl -X POST https://api.sovgate.com/v1/checkout/sessions \  -H "Authorization: Bearer sov_sk_test_your_key" \  -H "Idempotency-Key: 8ff323b7-4b2a-4c1d-9e3f-c2c63c7134b7" \  -H "Content-Type: application/json" \  -d '{  "mode": "payment",  "ui_mode": "hosted_page",  "line_items": [    {      "quantity": 1,      "price_data": {        "currency": "usd",        "unit_amount": 4000,        "product_data": {          "name": "Pottery workshop",          "description": "Saturday, 10 am, all materials included"        }      }    }  ],  "success_url": "https://shop.example.com/thanks?session_id={CHECKOUT_SESSION_ID}",  "cancel_url": "https://shop.example.com/cart",  "customer_email": "jenny@example.com",  "client_reference_id": "order_8812",  "metadata": {    "cart": "c_1042"  }}'

Example response

json
{  "id": "cs_test_8a34998a7056ac775cff7b78",  "object": "checkout_session",  "livemode": false,  "mode": "payment",  "status": "open",  "payment_status": "unpaid",  "ui_mode": "hosted_page",  "currency": "usd",  "amount_total": 4000,  "line_item_count": 1,  "customer": null,  "client_reference_id": "order_8812",  "metadata": {    "cart": "c_1042"  },  "url": "https://pay.sovgate.com/...",  "payment_link": null,  "payment": null,  "attempts": 0,  "created": "2026-11-27T14:00:00Z",  "expires_at": "2026-11-28T14:00:00Z",  "completed_at": null,  "expired_at": null}

Errors

CodeWhen
parameter_invalidA field isn't valid: an amount out of bounds, a return address that isn't https, or a domain not on your allowed list (live mode).
request_refusedYour business can't take live payments yet.