Delivery previews
A delivery preview answers one delivery question and saves nothing. It creates no resource, holds no inventory, and never changes a checkout's delivery selection. mode picks the question, and the response's data.mode matches the request.
Before a checkout exists
delivery_options
Which options and prices would this cart get at this address? Send currency and line_items; the response is a DeliveryPreview. Callers: an API key, the dashboard, or a partner app.
During a checkout
pickup_locations
Which stores can supply this checkout, nearest first? Send checkout_session_id; the response is a DeliveryPickupAvailability. Callers: the same, plus the checkout credential for its own session.
When to use each mode#
Use delivery_options to test your configuration. Run a cart and an address through your delivery methods before you offer them, and again after you change a profile, method, zone, location set, or rate callback. Try one address in each zone, and carts on both sides of any price threshold. Your server can also use it to estimate delivery on a product or cart page. The delivery options guide walks through a full configuration.
A preview's options have no delivery_option_id, so a buyer can't select one. To offer options a buyer can choose, create a delivery quote for their checkout.
Use pickup_locations in a checkout you build yourself. A pickup method can't be priced until the buyer chooses a store, so list the stores first, then send the chosen store's ID as pickup_location_id when you quote the buyer's delivery. The quote checks the store and its stock again. Hosted checkout does this for you.
Preview delivery options#
Flint builds the cart from line_items the way it builds an order, with catalog prices, bundles, modifiers, and inventory routing, then evaluates your methods against it and discards it.
The cart.
line_itemstakes 1 to 100 lines, in the shapes an order takes.currencymust be the currency the lines are priced in.- A catalog line, one with
variant_idorbundle_id, uses the catalog's delivery settings and its variant'sunit_weight. It can't sendfulfillment. - A custom line, one without either, must send
fulfillment, and can sendunit_weightandunit_dimensions. Without a weight, a method priced by weight reportscannot_calculatewithpricing_failure. inventory_routing_sourceis required when any line tracks inventory, the same as on an order. It sets where the cart's stock comes from, which decides each item's origin. See Inventory.
The methods. List up to 25 distinct IDs in delivery_method_ids, or leave it out to preview your checkout default, settings.checkout.default_delivery_method_ids. The response's delivery_method_ids lists the methods Flint evaluated. With no default, the preview returns empty delivery_method_ids and choice_groups. An empty array is invalid.
The buyer. destination_address can be partial, such as a postal code and country; a method that needs more lists it in input_requirements. Add buyer_location for local delivery or pickup eligibility that depends on where the buyer is, and pickup_location_id to price pickup at one store.
Preview two mugs shipped to Brooklyn, against standard shipping and an express method priced by a rate callback. Abridged:
curl -X POST https://api.withflintpay.com/v1/delivery-previews \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"mode": "delivery_options",
"currency": "USD",
"delivery_method_ids": ["dmet_01K4Q8M2V6T9R3S5W7X1Y2Z3AB", "dmet_01K4Q8M2V6T9R3S5W7X1Y2Z3CD"],
"line_items": [
{ "type": "variant", "variant_id": "var_01K4Q8N5D2F7G3H6J9K1M4P8QR", "quantity": 2 }
],
"inventory_routing_source": { "type": "fixed_location", "location_id": "loc_01K4Q8P3B6C9D2E5F8G1H4J7KM" },
"destination_address": { "postal_code": "11249", "country": "US" }
}'
{
"data": {
"mode": "delivery_options",
"currency": "USD",
"delivery_method_ids": ["dmet_01K4Q8M2V6T9R3S5W7X1Y2Z3AB", "dmet_01K4Q8M2V6T9R3S5W7X1Y2Z3CD"],
"line_items": [
{ "type": "variant", "variant_id": "var_01K4Q8N5D2F7G3H6J9K1M4P8QR", "quantity": 2 }
],
"destination_address": { "postal_code": "11249", "country": "US" },
"evaluation_status": "incomplete",
"choice_groups": [
{
"availability_status": "ready",
"evaluation_status": "incomplete",
"line_items": [{ "order_line_item_id": "li_01K4Q8R7S2T5V8W1X4Y7Z2A5BC", "quantity": 2 }],
"input_requirements": [],
"options": [
{
"delivery_method_id": "dmet_01K4Q8M2V6T9R3S5W7X1Y2Z3AB",
"type": "shipment",
"name": "Standard shipping",
"amount_money": { "amount": 900, "currency": "USD" },
"arrival_estimate": {
"earliest_date": "2026-10-06",
"latest_date": "2026-10-09",
"timezone": "America/New_York"
},
"delivery_plan": { "type": "single_delivery" },
"window_selection": "none",
"buyer_instructions": { "enabled": false, "required": false },
"display_position": 1,
"recommended": true,
"taxable": true
}
],
"candidate_outcomes": {
"dmet_01K4Q8M2V6T9R3S5W7X1Y2Z3AB": { "type": "available" },
"dmet_01K4Q8M2V6T9R3S5W7X1Y2Z3CD": { "type": "requires_checkout_context" }
}
}
],
"input_requirements": [],
"merchant_diagnostics": [
{
"diagnostic_id": "ddiag_01K4Q8T4V7W2X5Y8Z1A4B7C2DE",
"delivery_method_id": "dmet_01K4Q8M2V6T9R3S5W7X1Y2Z3CD",
"scope": "method",
"outcome": "requires_checkout_context",
"code": "checkout_context_required",
"recommended_action": "create_checkout",
"retryable": false,
"summary": "The method requires checkout authority for exact evaluation.",
"occurred_at": "2026-10-01T14:00:00Z"
}
],
"evaluated_at": "2026-10-01T14:00:00Z",
"expires_at": "2026-10-01T14:15:00Z"
},
"request_id": "req_01K4Q8V6W9X2Y5Z8A1B4C7D2EF"
}
Standard shipping is priced at $9.00. The express method's callback doesn't take preview traffic, so only a checkout can price it, which leaves the group and the preview incomplete.
Read the result#
Each choice group covers some of the cart's items and takes one delivery choice for them. Its options are the priced options a buyer would see. candidate_outcomes has one entry per method evaluated, keyed by method ID, and its type says what happened to the method: unavailable carries unavailable_reason, and cannot_calculate carries failure_category and retryable. The generated reference below lists every value with the action that fixes it.
A group's availability_status sums up its methods:
availability_status on delivery preview choice group resourcereadyAt least one option is priced and listed inoptions.needs_inputNo option yet, but a method needs more buyer input, such as a full address or a pickup store. The group'sinput_requirementsname each field.needs_checkout_contextNo option, and a method can only be priced for a real checkout. Create a checkout and a delivery quote to see its price.unavailableNo method can deliver these items with this input. Checkcandidate_outcomesandmerchant_diagnostics.
evaluation_status, on the preview and on each choice group, says whether Flint could evaluate every method:
evaluation_status on delivery previewcompleteEvery method was evaluated.incompleteAt least one method needs buyer input or a checkout before Flint can price it.degradedFlint couldn't calculate at least one method, for example because a rate callback failed. Checkfailure_category; aretryableoutcome can succeed on another preview.
merchant_diagnostics has one entry for each method that produced no option. Its code is a diagnostic value, separate from API error codes, and each code comes with one recommended_action:
eligibility_no_match, withreview_configuration: the method's eligibility rules excluded this buyer or address.eligibility_mismatchesnames each condition that didn't match.method_unavailable, withreview_configuration: the method can't serve this cart, for any otherunavailable_reason.input_required, withprovide_input: the method needs more buyer input.checkout_context_required, withcreate_checkout: the method can only be priced for a real checkout.dependency_failure, withretry: Flint couldn't check whether the method is available.
A preview reflects your configuration, stock, and the input you sent as of evaluated_at, and stays representative until expires_at. Preview again after you change any of them.
Methods only a checkout can price#
These methods report requires_checkout_context in a preview:
caller_suppliedpricing always needs a checkout, because your server supplies the rate for a specific quote.callbackpricing needs a checkout unless both the method'spricing.callback.preview_enabledand the rate callback'sconfiguration.preview_enabledaretrue. With both set, a preview calls your rate callback. Flint limits how many preview calls to your callbacks run at once, and a call over the limit reportscannot_calculatewithcallback_unavailable, which you can retry.
Find pickup locations#
Send the buyer's checkout as checkout_session_id. Flint checks every store the checkout's pickup methods offer against the checkout's items and returns up to 25 of them in locations, each with its compatible methods, the quantities it applies to, and a candidate_outcome.
buyer_locationis an address, even a postal code alone, which Flint measures from the code's center, or a coordinate for an exact distance. With it, stores come back nearest first, withdistance_meters. Without it, they come back in the order the pickup methods list them, with nodistance_meters.maximum_distanceleaves out stores farther from the buyer location.valuemust be greater than zero, andunitismeter,kilometer, ormile.- The checkout must be open. The search reads the checkout's current items and leaves the buyer's delivery selection as it is, so a buyer who already chose a store can search again without losing their choice.
Your storefront can make this call with the checkout credential, sent as Authorization: Bearer, instead of your API key. Abridged:
curl -X POST https://api.withflintpay.com/v1/delivery-previews \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"mode": "pickup_locations",
"checkout_session_id": "cs_01K4Q8W8X1Y4Z7A2B5C8D1E4FG",
"buyer_location": {
"type": "address",
"address": { "postal_code": "11249", "country": "US" }
},
"maximum_distance": { "value": 10, "unit": "kilometer" }
}'
{
"data": {
"mode": "pickup_locations",
"evaluation_status": "complete",
"input_requirements": [],
"locations": [
{
"location": { "location_id": "loc_01K4Q8X2Y5Z8A1B4C7D2E5F8GH", "name": "Williamsburg shop" },
"distance_meters": 1843.7,
"compatible_methods": [
{ "delivery_method_id": "dmet_01K4Q8Y3Z6A9B2C5D8E1F4G7HJ", "delivery_method_revision_id": "dmetr_01K4Q8Z4A7B1C4D7E2F5G8H1JK" }
],
"applicable_quantities": [{ "order_line_item_id": "li_01K4Q8C7D1E4F7G1H4J7K2M5NP", "quantity": 2 }],
"candidate_outcome": { "type": "available" }
},
{
"location": { "location_id": "loc_01K4Q8A5B8C2D5E8F1G4H7J2KM", "name": "Greenpoint shop" },
"distance_meters": 3210.2,
"compatible_methods": [
{ "delivery_method_id": "dmet_01K4Q8Y3Z6A9B2C5D8E1F4G7HJ", "delivery_method_revision_id": "dmetr_01K4Q8Z4A7B1C4D7E2F5G8H1JK" }
],
"applicable_quantities": [{ "order_line_item_id": "li_01K4Q8C7D1E4F7G1H4J7K2M5NP", "quantity": 2 }],
"candidate_outcome": { "type": "unavailable", "unavailable_reason": "inventory_insufficient" }
}
],
"merchant_diagnostics": [],
"evaluated_at": "2026-10-01T14:00:00Z"
},
"request_id": "req_01K4Q8B6C9D3E6F9G2H5J8K3MN"
}
A store that can't supply the cart is still listed, with candidate_outcome.type unavailable and unavailable_reason inventory_insufficient or eligibility_no_match. Offer the buyer only stores whose outcome is available.
What each credential sees#
A response to an API key, dashboard, or partner app caller always includes merchant_diagnostics, empty when nothing was left out. It names stores the search left out and stores that can't supply the cart's tracked items, each code with its recommended_action:
pickup_location_inactive, withreview_configuration: the Location is inactive, so it was left out.pickup_location_geography_unavailable, withreview_configuration: the Location has no usable published geography, so it was left out.pickup_location_inventory_unavailable, withreview_configuration: the Location doesn't allocate inventory, so it's listed as unavailable for items with tracked inventory. Items without tracked inventory need no allocation.pickup_location_dependency_failure, withretry: Flint couldn't resolve the Location.
A response to a checkout credential has the same shape without merchant_diagnostics.
Errors#
- StatusHTTP 400CodeINVALID_
REQUEST What to doA field is missing or invalid, andparamnames it. This covers an empty, duplicated, or over-25delivery_method_ids, acurrencythat doesn't match the lines, a custom line withoutfulfillmentor a catalog line with it, a tracked line withoutinventory_routing_source, methods that can't deliver a line's allowed fulfillment types (paramline_items), and amaximum_distancethat isn't positive or uses another unit. A checkout credential that sendsmode: "delivery_options"gets aNOT_ALLOWEDdetail withparammode. - StatusHTTP 404What to doA method in
delivery_method_idsor your checkout default doesn't exist in this environment, anddetails[0].resource_idnames it, or the checkout session can't be found. A checkout credential that names another checkout session gets this withparamcheckout_session_id. - StatusHTTP 409What to doA method you listed, or one in your checkout default, isn't active, or a zone, location set, or rate callback it uses is archived or inactive.
details[0].reasonisunsupported_stateorarchived, andblocking_resourcesnames the resource. Inpickup_locationsmode,reasonterminal_statusmeans the checkout session is completed, expired, or closed. - StatusHTTP 503What to doA service the preview depends on was unavailable. Retry with backoff.
Previews have their own rate limit class, delivery_preview, separate from delivery quotes and selections.
Related#
Delivery optionsSet up profiles, zones, and methods, then preview them.Collect delivery in your checkoutQuote, choose a store, and select an option for a buyer.Delivery configurationThe profiles, methods, zones, and callbacks a preview evaluates.Create delivery preview#
/v1/delivery-previewsRequires scope commerce.delivery.read or commerce.delivery.write
Rate limit: delivery_preview
Computes delivery options with mode delivery_options or up to 25 pickup locations with mode pickup_locations. Creates no resource, holds no inventory, and does not change the current selection. Pickup locations are nearest first when a buyer location is provided. Merchant callers receive diagnostics. Checkout credentials may use only pickup_locations for their own checkout session.
Request body
Send exactly one of these
The `delivery_options` variant of `CreateDeliveryPreviewRequest`.
Not accepted with a checkout credential
buyer_locationone ofThe buyer's location for pickup or local delivery, supplied as an address or a coordinate, chosen by `type`.
Send exactly one of these
The `address` variant of `DeliveryBuyerLocationInput`.
addressobjectRequiredA partial address for delivery quotes, previews, and buyer locations. Country is required when any member is present.
typeenumRequiredaddress
currencystringRequiredISO 4217 currency code.
delivery_method_idsarray of stringDelivery methods to evaluate. When omitted, uses settings.checkout.default_delivery_method_ids, or no methods when that setting is empty.
destination_addressobjectA partial address for delivery quotes, previews, and buyer locations. Country is required when any member is present.
citystringcountrystringISO 3166-1 alpha-2 country code.
line1stringline2stringpostal_codestringstatestringState, province, or region. State conditions read it as a subdivision of the address's country: send its code with or without the country prefix, such as NY or US-NY. In the US and Canada, the English name, such as New York, also matches. US addresses also accept the USPS military codes AA, AE, and AP. If the address country is listed by a state condition but state names no subdivision of that country, the condition cannot be decided: the method or rate is left out as cannot_calculate (invalid_buyer_input).
inventory_routing_sourceobjectChooses where a delivery options preview routes inventory from: a fixed Location, an inventory allocation policy, or one policy revision.
inventory_allocation_policy_idstringinventory_allocation_policy_revision_idstringlocation_idstringtypeenumRequiredfixed_locationpolicypolicy_revision
line_itemsarray of one ofRequiredSend exactly one of these
The `variant` variant of `CreateOrderLineItemInput`.
gift_card_purchaseobjectBuyer-selected face value and recipient for a gift_card variant. The server freezes the offer and resolves consideration per unit. Omit to purchase the reference denomination without a recipient.
metadatamap of stringCaller-owned metadata. Values can't be empty strings. Keys starting with flint_ are reserved for Flint, are not returned, and cannot be written through the public API.
modifiersarray of one ofModifiers sold with the item, each chosen from the catalog or typed as text.
quantityintegerNumber of units, from 1 through 9999. The extended line subtotal, including modifiers, must satisfy the order money ceiling.
subscriptionobjectSelected recurring terms for this variant. Lines with the same cadence start one subscription after payment.
taxobjectHow tax applies to this line item.
typeenumRequiredSelects the type branch.
variant
variant_idstringRequiredID of the product variant to add. A catalog line item sends this or `bundle_id`; a custom line item sends neither.
modeenumRequiredThe delivery question this preview answers. - `delivery_options`: Evaluates delivery methods and prices for the supplied items and buyer location.
delivery_options
pickup_location_idstringpricing_contextmap of stringThe `pickup_locations` variant of `CreateDeliveryPreviewRequest`.
buyer_locationone ofThe buyer's location for pickup or local delivery, supplied as an address or a coordinate, chosen by `type`.
Send exactly one of these
The `address` variant of `DeliveryBuyerLocationInput`.
addressobjectRequiredA partial address for delivery quotes, previews, and buyer locations. Country is required when any member is present.
typeenumRequiredaddress
checkout_session_idstringRequiredCheckout session whose pickup locations to evaluate. Checkout credentials must identify their own session.
maximum_distanceobjectA maximum distance from the buyer location, as a value and unit, that limits which pickup locations a preview returns.
unitenumRequiredmeterkilometermile
valuenumberRequiredMaximum distance from the buyer location, greater than zero, in the selected unit.
modeenumRequiredThe delivery question this preview answers. - `pickup_locations`: Lists the checkout session's pickup locations and whether each can supply its items.
pickup_locations
Response · 200
Exact non-selectable delivery preview.
dataone ofRequiredResource, collection, or operation result returned by this request.
One of these shapes
The delivery options and prices Flint would offer for the supplied items and buyer location, with input requirements and merchant diagnostics.
buyer_locationone ofOmitted for a checkout session credential that doesn't act for the customer the buyer verified.
choice_groupsarray of objectRequiredcurrencystringRequiredISO 4217 currency code.
delivery_method_idsarray of stringRequireddestination_addressobjectOmitted for a checkout session credential that doesn't act for the customer the buyer verified.
evaluated_atstringRequiredRFC3339 timestamp.
evaluation_statusenumRequiredcompleteincompletedegraded
expires_atstringRequiredRFC3339 timestamp.
input_requirementsarray of objectRequiredInputs the delivery methods need. A quote requirement, such as the destination address, is input a method needs before Flint can price it. A selection requirement is input a delivery selection needs before payment, such as a recipient field or delivery window an option requires. A method that waits on the buyer's address or store, or on an address the buyer must correct, already lists the recipient fields it requires. Those requirements name the method's choice group and have no delivery_option_ids.
line_itemsarray of one ofRequiredmerchant_diagnosticsarray of objectPresent for merchant callers as an array, including when empty. Absent for buyer callers.
modeenumRequiredThe delivery question this preview answers. - `delivery_options`: Evaluates delivery methods and prices for the supplied items and buyer location.
delivery_options
pickup_location_idstringmetaobjectAdditional information about this response.
api_versionstringAPI version used to produce this response.
idempotency_replayedbooleanWhether this response replays a stored result for the supplied Idempotency-Key.
trace_idstringTrace identifier to include when contacting Flint about this request.
warningsarray of objectConditions that need attention even though the request succeeded.
request_idstringRequiredIdentifier of this API request, used to correlate logs and support requests.
curl -X POST https://api.withflintpay.com/v1/delivery-previews \
-H "Flint-Version: 2026-09-07" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"currency": "USD",
"delivery_method_ids": [
"dmet_01K1P6G4M7H2N8Q9R3S5T6V7WX"
],
"destination_address": {
"country": "US",
"postal_code": "11249"
},
"line_items": [
{
"quantity": 2,
"type": "variant",
"variant_id": "var_01K1P6G4M7H2N8Q9R3S5T6V7WX"
}
],
"mode": "delivery_options"
}'Was this helpful?
