Create Checkout Session
Creates a checkout session (invoice) server-side and returns the URL to send the buyer to. Requires an API key; call it from your backend, never from a browser. Cart items are either <b>catalog items</b> (<code>productId</code> + <code>variantId</code>) or <b>custom items</b> (<code>name</code> + <code>price</code>, for one-off charges that are not in your catalog); both kinds can be mixed. If you pass both <code>email</code> and a payment method, the invoice is created as <code>pending</code> and a payment session is started immediately, so the returned <code>url</code> goes straight to the payment provider; otherwise it opens the hosted checkout where the buyer completes those steps. Available on plans with the Checkout API feature.
Request body
Example request
{
"cart": [
{
"productId": 1,
"variantId": 1,
"quantity": 1
}
],
"currency": "USD",
"ip": "203.0.113.10",
"country_code": "US",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
"asn": 64496,
"email": "customer@example.com",
"coupon": "SAVE10",
"gateway": "STRIPE",
"payment_method_id": 1,
"affiliate": "PARTNER10",
"billing_name": "John Doe",
"billing_address_line1": "123 Main St",
"billing_address_line2": "Apt 4",
"billing_city": "Springfield",
"billing_state": "IL",
"billing_postcode": "62701",
"billing_country": "US",
"shipping_name": "John Doe",
"shipping_address_line1": "123 Main St",
"shipping_address_line2": "Apt 4",
"shipping_city": "Springfield",
"shipping_state": "IL",
"shipping_postcode": "62701",
"shipping_country": "US",
"shipping_phone": "+1 555 0100",
"metadata": [
"pasyzwszwtxpeqq"
]
}Response
Without a preselected payment method: url opens the hosted checkout
Example response
{
"success": true,
"invoice_id": 3,
"invoice_url": "https://demo-shop.sellauth.com/checkout/98b3f45d848c5-0000000000003",
"url": "https://demo-shop.sellauth.com/checkout/98b3f45d848c5-0000000000003"
}Changes
No recorded changes to this endpoint across all 1 revision of this API.