After checkout

Reset the widget, confirm protection was issued, and give the customer their links.

Reset the widget session

Once an order is submitted, its session is closed and can't change. Clear it in the customer's browser as soon as checkout completes, for example on your order confirmation page:

teak('clearSession');

The customer's next purchase then starts a new session. If you skip this, a second purchase from the same browser within 120 minutes reuses the closed session, and the widget fails with an error when the customer makes their choice.

Confirm the protection was issued

After a 202 from Submit, Teak creates the order and issues protection, usually within a few seconds. Teak then sends a Contract Issued webhook for each protected item.

In your webhook handler:

  1. Match the webhook to your order with data.order_number, which is the reference_id you submitted.
  2. Store data.policy_number against the item, matching data.reference_number to the item's referenceNumber.
  3. Mark the protection as active in your system.

Teak invoices you for issued contracts, so these records let you reconcile your invoice.

If a Contract Issued webhook doesn't arrive within a few minutes, look the order up with Retrieve order details. Each item's status shows whether its protection was issued.

Give the customer their links

Customers get an email from Teak with their protection details. You can also show their links, for example on your confirmation page, in your order email, or in the customer's account.

Call Retrieve order details with your order number and the customer's email:

curl "https://api.sandbox.helloteak.com/v1/orders/ORD-1001/details?email=ada%40example.com" \
  -H 'Authorization: Bearer <token>'

Each entry in primary_policies[].links includes the customer's certificate, the policy terms, and where to request a refund or cancel. Passing the customer's email returns links the customer can open directly.

The order is created a few seconds after Submit returns 202, so this call can return 404 at first. Call it from your Contract Issued webhook handler, or retry after a short wait.

Handle changes after checkout

Protection can change after the order: the customer can void it, or Teak can reject it. Handle Contract Void: you collected the protection price from the customer, so refund it. See the Contract events reference for the other events you can subscribe to.

You can also change protection yourself:

  • Void a contract within its look period, for example when the customer asks you to remove it. Refund them the protection price.
  • Cancel a contract when protection should end without a refund, for example when you refund the item after the look period, or the ticket is transferred or resold.

See Change a contract for which change fits each situation, including exchanges.

Next steps

Your integration is complete. Test it and switch to production:

  • Work through the go-live checklist to confirm your integration is ready for production.
  • Handle contract events when protection is issued, voided, canceled, or changed.

Did this page help you?