Checkout and orders
Your storefront collects the cart. Sevigram prices it, takes payment on its hosted checkout and creates the order.
-
Create a checkout.
POST /checkoutswith the cart lines and areturn_url:POST /v1/checkoutsAuthorization: Bearer sfpub_…Idempotency-Key: 6f1c2a3e-cart-v3Content-Type: application/json{ "return_url": "https://shop.example/orders/return", "lines": [] }The response is
201with the session and its hostedcheckout_url. -
Redirect the shopper to
checkout_url. It’s on the business’s Sevigram storefront, for examplehttps://acme.sevigram.biz/checkout/s/…. -
The shopper pays on the hosted checkout, which collects their details and payment. A session expires 30 minutes after it’s created, and it reserves no stock until it’s paid.
-
The shopper comes back to your
return_url, with the order’s guest token in the URL fragment. Store the token in the browser and remove it from the address bar. -
Show the order with
GET /orders/{id}and the token inX-Guest-Order-Token.
If the shopper abandons checkout and selects “Return to store”, they come back without an order. Keep the cart so they can try again.
The exact line shapes are in the API reference. In short:
- A product line names a variant, a quantity and the fulfilment method.
- A service line names the service and a booking time from
GET /services/{handle}/availability. A service line withoutpackage_idbooks the service’s first package. - A cart holds either products or one service booking, not both.
- Service checkout supports time-slot services only. Rate-priced and date-booked services answer
slot_unavailable, and services that need configured resources can’t be booked through checkout sessions.
- Return URL.
return_urlmust be on one of the storefront’s allowed origins, or you get422 return_url_not_allowed. - Idempotency. Send an
Idempotency-Keyof 8 to 160 printable ASCII characters. Retrying with the same key and body returns the same session with200. The same key with a different body is409 idempotency_key_reused, so use a new key whenever the cart changes. The key is echoed on the response. - Conflicts. If a line can’t be sold as it is, for example the price changed, it sold out or the time was taken, you get
409 checkout_conflict.details.linesgives each line’s reason. Let the shopper fix those lines and try again. - Demo shop. The read-only demo shop answers
403 demo_shop_read_only.
Check a session
Section titled “Check a session”GET /checkouts/{id} returns a session created by this storefront. IDs that aren’t UUIDs get 404.
Signed-in checkout
Section titled “Signed-in checkout”To place the order as a signed-in customer, create the checkout from your server with the private token and the customer’s session in X-Sevigram-Customer-Session. See Customer accounts.
Contact form
Section titled “Contact form”POST /contact with { name, email, message } returns 202 and sends the message to the business. It’s limited to 5 a minute per shopper IP.