How Teak works
The four steps of every Teak integration, the pieces involved, and how to choose your path.
Every TeakOS integration follows the same four steps, whichever way you connect. What changes is who makes each call.
The four steps
| Step | What happens |
|---|---|
| 1. Offer | Teak prices protection for one item or many, for example a cart or a page of search results, and starts a session for the purchase. |
| 2. Confirm | The customer accepts or declines optional protection, and the price is locked. Embedded protection is included in the price, so there's nothing to ask. |
| 3. Submit | Your systems place the order with the customer's details. Teak issues protection for each protected item at the confirmed price. |
| 4. Notify | Teak sends your systems webhooks as protection is issued, and whenever it changes after purchase. |
The parts of an integration
A Teak integration has three parts: the widget in your checkout, your server, and Teak. On the server-to-server path, your server does the widget's job too.
| 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 | Places the order with Teak when checkout completes, using your secret key, and receives webhooks. On the server-to-server path, it also gets protection prices and sends the customer's choices. |
| Teak | Prices protection, issues it for each protected item, emails the customer about optional protection, and sends webhooks as protection changes. |
Choose your path
| TeakOS Widget | Server to server | |
|---|---|---|
| Offer | The widget prices the cart when it loads, and shows the offer. | Your server calls the Programs API, and you show the offer in your own interface. |
| Confirm | The widget saves the customer's choice. | Your server sends the customer's choices when it confirms the order. |
| Submit | Your server calls Teak's Order Submit endpoint. | Your server places the order. See Confirm the order. |
| Notify | Webhooks to your server. | Webhooks to your server. |
| Best for | A web checkout you control. | Booking tools, apps, AI agents, and checkouts that can't run the widget. |
| Start here | TeakOS integration guide | Server-to-server guide |
Server-to-server and AI integrations are for enterprise partners only. Teak Solutions Team works with partners to determine the appropriate integration solution.
The life of an order
Step through an order from the first price to issued protection.
With the TeakOS Widget
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", ... } }Server to server
Your server sends items and the customer's location to the Programs API: a page of search results, or the cart at checkout. Teak returns a protection price for each item and creates a session for the purchase.
POST /v1/programs
{ "currency": "USD", "locale": "en_US", "location": { "country": "US", "region": "TX" }, "items": [ ... ] }
200 OK
{ "session_id": "3f1c9a2e-...", "items": [ { "reference_id": "ITEM-1", "estimated_premium": "4.60", ... } ] }You show the offer in your own interface, using the prices from the Programs API. For optional protection, the customer accepts or declines. Embedded protection is already included in the price.
When the customer completes their purchase, your server confirms the order with the customer's choices, the person booking, and your order number. Teak responds 202 and starts issuing, or 204 if nothing is protected.
Teak issues a contract for each protected item and sends your server a Contract Issued webhook for each one. For embedded protection, Teak doesn't email the customer, so you send them their protection details.
Notifications after purchase
Teak sends a signed, asynchronous webhook each time protection changes after checkout, on both paths:
| Events | When Teak sends them | What you do |
|---|---|---|
| Contract Issued | Teak issues protection for an item, once per item. | Record the protection against your order. Required. |
| Contract Void | Protection is removed: the customer voids it within its look period, or the order doesn't pass Teak's checks. | Refund the customer the protection price. Required. |
| Contract Canceled, On Hold, Chargeback | Protection is canceled, paused, or disputed. | Update the protection's status in your system. Don't refund a cancellation. |
| Contract Upgraded, Downgraded, Exchanged | An item changes after purchase, for example an exchange. | Update the protection and its price. Downgraded is required if customers can exchange items. |
| Refund request events | A customer files a refund request, and as Teak reviews and decides it. | Keep your support team informed. |
Verify each webhook's signature, and respond 2xx to every event, including ones you don't act on.
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 TeakOS integration guide or the server-to-server guide step by step, from sandbox to live.
Updated about 12 hours ago
