Delivery previews

Delivery previews compute delivery options for a proposed cart or pickup locations for a checkout. They do not reserve stock or change a delivery selection. Both modes require commerce.delivery.read for merchant callers. Checkout credentials can use only pickup_locations for their own checkout session.

A delivery_options preview returns the same choice-group and merchant-diagnostic vocabulary used by checkout quotes. It does not reserve inventory, invoke caller-supplied pricing, or create a selectable quote. Callback pricing participates only when the callback has preview_enabled: true.

Treat evaluated_at and expires_at as the evidence window for the result. Re-run the preview after changing cart lines, destination data, buyer location, routing input, or delivery configuration.

Route#

POST /v1/delivery-previews requires mode. Use delivery_options to evaluate a proposed cart for merchant testing. Call it before publishing configuration or after changing a profile, method, zone, location set, or callback. For example, POST /v1/delivery-previews with a physical line item and destination shows the choices the same cart could receive at checkout.

JSON
{
  "mode": "delivery_options",
  "currency": "USD",
  "delivery_method_ids": ["dmet_01K1P6G4M7H2N8Q9R3S5T6V7WX"],
  "line_items": [
    { "variant_id": "var_123", "quantity": 2 }
  ],
  "destination_address": {
    "postal_code": "11249",
    "country": "US"
  }
}

Use pickup_locations before quoting the buyer's chosen store. Provide checkout_session_id, and optionally buyer_location, maximum_distance, and expected_delivery_selection_id. A distance must be positive with unit meters, kilometers, or miles. The current selection ID may be omitted or null when none is selected. A different selection returns 409 DELIVERY_PICKUP_AVAILABILITY_CHANGED.

JSON
{
  "mode": "pickup_locations",
  "checkout_session_id": "cs_123",
  "expected_delivery_selection_id": null,
  "buyer_location": {
    "type": "address",
    "address": { "postal_code": "11249", "country": "US" }
  },
  "maximum_distance": { "value": 10, "unit": "kilometers" }
}

The response's data.mode matches the request. pickup_locations returns up to 25 locations, nearest first when Flint can place the buyer location. Merchant callers also receive merchant_diagnostics with codes pickup_location_inactive, pickup_location_geography_unavailable, pickup_location_inventory_unavailable, and pickup_location_dependency_failure. Checkout credentials receive buyer-safe results. A checkout credential used for another session or for delivery_options receives 403.

Delivery-option diagnostics use eligibility_no_match, method_unavailable, input_required, checkout_context_required, preview_unsupported, and dependency_failure. These are diagnostic values, separate from API error codes.

Create delivery preview#

POST/v1/delivery-previews

Requires scope commerce.delivery.read or commerce.delivery.write

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

buyer_locationone of
currencystringRequired

ISO 4217 currency code.

delivery_method_idsarray of stringRequired
destination_addressobject
inventory_routing_sourceobject
line_itemsarray of one ofRequired
modeenumRequired

The delivery question this preview answers. - `delivery_options`: Evaluates delivery methods and prices for the supplied items and buyer location.

  • delivery_options
pickup_location_idstring
pricing_contextmap of string

Response · 200

dataone ofRequired
metaobject
request_idstring
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": [
      "example"
    ],
    "line_items": [
      {
        "variant_id": "example"
      }
    ],
    "mode": "delivery_options"
  }'

Was this helpful?