Preview. The API is shared with design partners and may change before launch. Register interest for sandbox access.
Build with the API
If you want full control of the experience, build it yourself on the Checkout API. Phew still does the hard parts: classifying each item, deciding whether it can be covered, pricing it, issuing the policy and handling claims. You design how the offer looks and where it appears: in a checkout, an app, a receipt, a bank’s purchase overview, or somewhere we haven’t thought of.
The whole integration is three server-side calls. Your frontend only ever talks to your own backend; the Phew secret key stays on the server.
Browser ──▶ your backend ──▶ POST /v1/offers (cart ready)Browser ◀── plans, prices, documentsBrowser ──▶ your backend ──▶ POST /v1/policies (order paid) ──▶ POST /v1/policies/{id}/cancel (item returned)-
Request an offer when the cart is ready. Call
POST /v1/offerswith the items, currency and market. Cache the response against the cart untilexpires_at(30 minutes); request a new one if the cart changes. -
Show the offer. For each eligible item, show the plans with their price and the links in
documents. Let the customer choose one plan or none. -
Add the premium to the order. If you collect the premium (the usual model), add it as its own line on the order so it appears on the receipt and can be refunded separately.
-
Create the policy when payment succeeds. Call
POST /v1/policiesfrom the same place you mark the order as paid, with anIdempotency-Keyderived from the order ID so retries never create duplicates. -
Cancel on returns. When a covered item is returned or the customer withdraws, call
POST /v1/policies/{id}/cancel. -
Listen for webhooks. Subscribe to
claim.*andsettlement.statement.createdif you want to show claim status or reconcile automatically. See Events.
Display requirements
Section titled “Display requirements”Insurance distribution rules apply to how the offer is shown. Every integration must:
- Show the plan name, term and price, including all taxes.
- Link to the terms (
documents.terms_url) and the insurance product information document (documents.ipid_url) before the customer adds the cover. - Leave the offer unselected by default. A pre-ticked box is not allowed.
- Make declining as easy as accepting.
- Show the cover as a separate line on the order confirmation and receipt.
Failure handling
Section titled “Failure handling”The offer is an add-on and must never block a sale.
- Use a short timeout (2 seconds) on
POST /v1/offers. If it fails or times out, hide the offer and continue. - Retry
POST /v1/policieswith the sameIdempotency-Keyon network errors and5xxresponses, with exponential backoff, for up to 24 hours. A queue is the simplest way to do this. - If a policy can’t be created at all, refund the premium line and let us know. The customer should never pay for cover they don’t have.