TeakOS integration guide

Offer your refund protection with the TeakOS Widget and submit orders from your server.

This guide takes you from a blank checkout to a live integration. You add the TeakOS Widget to your checkout page, and your server tells Teak when the customer completes their purchase.

Already live with Teak's Legacy API integration?

Follow Migrate from the Legacy API instead. It maps each part of your current integration to this one.

How it works

IN THE BROWSERAT CHECKOUTAFTER CHECKOUTCustomerin their browserCheckout pageTeakOS WidgetYour servercheckout backendTeakPartner API1Load widget with the cart2Quote and session ID3Opts in to protection4Widget saves the choice5Places the order6Order and session ID7POST /auth/token8Access token9POST /orders/{id}/submit10202 Accepted11Contract Issued webhook12teak('clearSession')

Prefer a step-by-step view? Step through the life of an order.

  1. The widget quotes and records the choice. When the widget loads, Teak prices protection for the items you pass in and creates a session. The session holds the quote and the customer's opt-in or opt-out. The widget keeps it up to date as the customer changes their choice or you update the cart.
  2. Your server submits the order. When the customer completes checkout, your page sends the session ID to your server along with the order. Your server calls Submit an order with the session ID, your order number, and the customer's details.
  3. Teak issues the protection. Teak creates the order and issues protection for each item the customer opted in to. Teak then sends you a Contract Issued webhook for each one.

You never send prices to Submit: the session already holds them, so what the customer saw in the widget is what Teak issues.

Prefer to start from code? The quickstart shows the whole flow, from your checkout page to your server, in Node.js or Python:

Or run the complete checkout example from teak-examples, in Node.js or Python, with Docker.

Steps

  1. Before you start: get your keys and set up your sandbox.
  2. Add the widget to your checkout page.
  3. Handle the customer's choice: callbacks, cart updates, and errors.
  4. Submit the order from your server.
  5. After checkout: reset the widget, confirm issuance, and show the customer their links.
  6. Go live.

Current limitations

  • One protection product per checkout. Support for offering several products together is coming.
  • The widget session is shared between pages on the same domain only. If your cart and checkout run on different domains, show the widget on the checkout domain.

Next steps

Start with step 1:


Did this page help you?