Create Checkout Session
Changed onCreates 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
- Base URLhttps://api.sellauth.com
- AuthHTTP bearer
- TypeScriptA function with typed inputs. Its response is checked against the schema.
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": [
"tjqotbhpzwonwlzospqcs"
],
"attribution": {
"utm_source": "newsletter",
"utm_medium": "email",
"utm_campaign": "spring_sale"
}
}Response
Example response
{
"success": true,
"invoice_id": 3,
"invoice_url": "https://demo-shop.sellauth.com/checkout/98b3f45d848c5-0000000000003",
"url": "https://checkout.stripe.com/c/pay/cs_test_a139AH1zApQWCLRABDj7fBVDZ0puTeWxKQMeOENUVAv0NzDmBVbCwSKYTX"
}Changes
- breaking
added
subschema #1subschema #2to the response bodyoneOflist for the response status - breaking
added
subschema #1subschema #2subschema #3subschema #4subschema #5to the response bodyoneOflist for the response status - breaking
the response's body type changed from
objectto no type for status - breaking
the response's body type changed from
objectto no type for status - warning
removed the optional property
from the response with the status - warning
removed the optional property
from the response with the status - warning
removed the optional property
from the response with the status - warning
removed the optional property
from the response with the status - warning
removed the optional property
from the response with the status - info
the request property
became nullable - info
the request property
became nullable - info
the request property
became nullable - info
the request property
/became nullable - info
the request property
/became nullable - info
the request property
/became nullable - info
the request property
/became nullable - info
the request property
/became nullable - info
the request property
/became nullable - info
the request property
became nullable - info
the request property
became nullable - info
the request property
became nullable - info
the request property
became nullable - info
the request property
became nullable - info
the request property
became nullable - info
the request property
became nullable - info
the request property
///became nullable - info
the request property
//became nullable - info
the request property
//became nullable - info
the request property
//became nullable - info
the request property
//became nullable - info
the request property
//became nullable - info
the request property
//became nullable - info
the request property
//became nullable - info
the request property
//became nullable - info
the request property
became nullable - info
the request property
became nullable - info
the request property
became nullable - info
the request property
became nullable - info
the request property
became nullable - info
the request property
became nullable - info
the request property
became nullable - info
the request property
became nullable - info
the request property
became nullable - info
the request property
became nullable - info
the request property
/became nullable - info
the request property
became nullable - info
the request property
became nullable - info
the request property
became nullable - info
the request property
became nullable - info
the request property
became nullable - info
the request property
became nullable - info
the request property
became nullable - info
the request property
became nullable - info
the request property
became nullable - info
the request property
became nullable - info
the request property
became nullable
- breaking
- breaking
added the new required request property
// - info
added the new optional request property
// - info
added the new optional request property
// - info
added the new optional request property
//
- breaking