Quote to checkout
Read a product, answer its questions, and send the buyer a link to pay.
The SDK does all of this in a modal on your page. Use the API when you want your own quote form, or to quote on a buyer's behalf from a back-office tool.
You need a buyer id first: see Sign up buyers.
List what the buyer can purchase
GET /api/buyers/{buyerId}/productsEach product says what it is, who insures it, and what one unit buys:
{
"data": [
{
"id": 105,
"name": "Physical Damage - Temporary Substitute",
"description": "Daily Physical Damage",
"unit": "day",
"maxUnits": 127,
"insurer": "Incline P&C Group",
"claimsPhone": "5550516140",
"agreements": [{ "name": "Terms & Conditions.pdf", "url": "https://…" }],
"questions": [ … ]
}
],
"page": 0, "limit": 25, "total": 3, "hasMore": false
}unit is day for coverage sold by the day, or trip for coverage sold per trip. Show the agreements as links the buyer must read before paying.
Get the product's questions and a ready-made request
GET /api/buyers/{buyerId}/products/{productId}Every product asks its own questions: a truck's VIN, its value, who the insured is, who should be listed on the certificate. Each question says how to answer it:
{ "id": 286, "group": null, "label": "VIN #", "type": "text", "required": true }
{ "id": 289, "group": null, "label": "Stated Value of Unit", "type": "number", "required": true, "placeholder": "Stated Value (USD)" }
{ "id": 291, "group": "Named Insured", "label": "Insured's Name", "type": "text", "required": true, "placeholder": "ie) JB Hunt" }
{ "id": 296, "group": "Certificate Holder #1", "label": "Entity Email", "type": "text", "required": false, "format": "email", "formatDescription": "An email address." }
{ "id": 118, "group": null, "label": "Desired Excess Auto Limit", "type": "select", "required": true, "options": [{ "label": "$2,000,000", "value": "2000000" }, …] }| Field | Meaning |
|---|---|
id | Send it back as questionId. |
group | A heading shared by related questions, such as the named insured's details. Show them together. |
type | text; number (send digits, like "85000"); or select (send one option's value, not its label). |
required | A quote is refused when this answer is blank. Other questions may be left out. |
format | When present, the answer must be an email, an ssn (9 digits), or a date (YYYY-MM-DD). |
The response also has quoteTemplate: the request body for the next step, with every question listed, required marked, and the values blank. Fill it in and post it.
Create the quote
POST /api/quotes{
"buyerId": "9f1c4e2a-3b7d-4c1e-8f2a-5d6b7c8e9f01",
"productId": 105,
"startDate": "2026-12-01",
"units": 3,
"timeZone": "America/Chicago",
"answers": [
{ "questionId": 286, "value": "1FUJGLDR7CLBP8834" },
{ "questionId": 287, "value": "2021" },
{ "questionId": 288, "value": "Freightliner" },
{ "questionId": 289, "value": "85000" },
{ "questionId": 291, "value": "Acme Freight LLC" }
]
}unitsis how much to buy, in the product'sunit: 3 days here. At mostmaxUnits.startDateis today or later, at most a year away.timeZoneis when each day starts and ends:America/New_York,America/Chicago,America/Denver,America/Los_AngelesorUTC.
If anything is wrong, the response is 400 and error.details names every problem, by question:
{ "error": { "code": "invalid_request", "message": "Some answers are missing or not valid.", "details": [
"answers: question 286 (VIN #) is required",
"answers: question 118 (Desired Excess Auto Limit) must be one of the option values: \"1000000\", \"2000000\""
] }, "requestId": "…" }Otherwise it is 201, priced and waiting for payment:
{
"id": "cs_live_a1B2c3D4",
"status": "awaiting_payment",
"paymentUrl": "https://checkout.stripe.com/c/pay/cs_live_a1B2c3D4",
"paymentIntentId": "pi_3Q7abcDEF",
"amountTotalCents": 4458,
"currency": "usd",
"product": { "id": 105, "name": "Physical Damage - Temporary Substitute" },
"units": 3,
"coverageStart": "2026-12-01T06:00:00.000Z",
"coverageEnd": "2026-12-04T05:59:59.999Z"
}Show the buyer amountTotalCents (taxes and fees included) and the coverage dates, and store id: it is the quote id you look the purchase up by. paymentIntentId can be null until the buyer pays, so do not rely on it.
Retrying safely
Every POST /quotes makes a new payment page. Send an Idempotency-Key header (a UUID, or your own order id) and a retry of a quote that succeeded gets the first quote back, marked Idempotent-Replayed: true, instead of a second one. If the first call failed on our side or timed out, the same key answers 409 idempotency_outcome_unknown rather than risk a second payment page: send the next attempt with a new key. See Errors.
Send the buyer to pay
Redirect the buyer, or email them, to paymentUrl. It is a Stripe payment page; card details never touch your servers or ours.
Nothing is bought until they pay. A 409 binding_moratorium means the product cannot be sold for those dates right now (for example during a hurricane); offer other dates.
Confirm the purchase
A few seconds after payment, CoverPort issues the certificates of insurance and the purchase appears, found by the quote's id:
GET /api/purchases?quoteId=cs_live_a1B2c3D4If you have the payment's id instead (pi_…, for example sale.purchaseId from the SDK), GET /api/purchases?paymentIntentId= finds the same purchase. For a quote on a test product, add &testMode=true.