How Teak works
The pieces of a Teak integration and how they fit together.
A Teak integration has three parts: the widget in your checkout, your server, and Teak.
| Part | What it does |
|---|---|
| TeakOS Widget | Shows the protection offer, prices it for the cart, and saves the customer's choice to Teak. Runs in the customer's browser with your public key. |
| Your server | Submits the order to Teak when checkout completes, using your secret key, and receives webhooks. |
| Teak | Issues protection for the items the customer opted in to, emails the customer, and sends webhooks as protection changes. |
The life of an order
Step through an order from quote to issued protection:
The widget loads with the items in the cart. Teak prices protection and creates a session that holds the quote. The widget shows the offer.
teak('configure', {
apiKey: 'pk_...',
items: [{ name: 'GA Ticket', referenceNumber: 'ITEM-1', productTypes: ['general-admission'], cost: 120, event: { location: 'Austin, TX' } }],
});The customer opts in or out. The widget saves the choice to the session and calls your callback, so you can update the order total.
optInCb: () => orderSummary.setProtection(teak.get('quote')),
optOutCb: () => orderSummary.setProtection(null),The customer places the order. Your page sends the session ID to your server with the rest of the order.
const teakSessionId = teak.get('token');Your server submits the order with the session ID and your order number. Teak responds 202 and starts issuing, or 204 if the customer opted out.
POST /v1/orders/{session_id}/submit
{ "reference_id": "ORD-1001", "customer": { ... }, "payment": { "type": "invoice" } }
202 Accepted
{ "session_id": "3f1c9a2e-...", "status": "submitted" }Teak issues a contract for each protected item, emails the customer, and sends your server a Contract Issued webhook for each one.
{ "resource": "Policy", "action": "Issued", "data": { "order_number": "ORD-1001", "policy_number": "4f527d2e-...", "status": "issued", ... } }After the purchase, if the protection changes, for example the customer voids it or files a refund request, Teak sends you webhooks.
Billing
The customer pays you for protection as part of their order. Teak bills you for issued contracts on your regular invoice. Teak doesn't take payment from your customers, so you don't send card or payment details to Teak.
Next steps
Get your sandbox keys, then build your integration step by step:
- Set up environments and keys for sandbox and production, and authenticate your server.
- Follow the integration guide step by step, from sandbox to live.
Updated 19 days ago
