Skip to content

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_items takes 1 to 100 lines, in the shapes an order takes. currency must be the currency the lines are priced in.
  • A catalog line, one with variant_id or bundle_id, uses the catalog's delivery settings and its variant's unit_weight. It can't send fulfillment.
  • A custom line, one without either, must send fulfillment, and can send unit_weight and unit_dimensions. Without a weight, a method priced by weight reports cannot_calculate with pricing_failure.
  • inventory_routing_source is 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
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" }
  }'
Response
{
  "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 resource
  • ready
    At least one option is priced and listed in options.
  • needs_input
    No option yet, but a method needs more buyer input, such as a full address or a pickup store. The group's input_requirements name each field.
  • needs_checkout_context
    No option, and a method can only be priced for a real checkout. Create a checkout and a delivery quote to see its price.
  • unavailable
    No method can deliver these items with this input. Check candidate_outcomes and merchant_diagnostics.

evaluation_status, on the preview and on each choice group, says whether Flint could evaluate every method:

evaluation_status on delivery preview
  • complete
    Every method was evaluated.
  • incomplete
    At least one method needs buyer input or a checkout before Flint can price it.
  • degraded
    Flint couldn't calculate at least one method, for example because a rate callback failed. Check failure_category; a retryable outcome 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, with review_configuration: the method's eligibility rules excluded this buyer or address. eligibility_mismatches names each condition that didn't match.
  • method_unavailable, with review_configuration: the method can't serve this cart, for any other unavailable_reason.
  • input_required, with provide_input: the method needs more buyer input.
  • checkout_context_required, with create_checkout: the method can only be priced for a real checkout.
  • dependency_failure, with retry: 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_supplied pricing always needs a checkout, because your server supplies the rate for a specific quote.
  • callback pricing needs a checkout unless both the method's pricing.callback.preview_enabled and the rate callback's configuration.preview_enabled are true. 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 reports cannot_calculate with callback_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_location is 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, with distance_meters. Without it, they come back in the order the pickup methods list them, with no distance_meters.
  • maximum_distance leaves out stores farther from the buyer location. value must be greater than zero, and unit is meter, kilometer, or mile.
  • 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
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" }
  }'
Response
{
  "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, with review_configuration: the Location is inactive, so it was left out.
  • pickup_location_geography_unavailable, with review_configuration: the Location has no usable published geography, so it was left out.
  • pickup_location_inventory_unavailable, with review_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, with retry: Flint couldn't resolve the Location.

A response to a checkout credential has the same shape without merchant_diagnostics.

Errors#

  • HTTP 400
    A field is missing or invalid, and param names it. This covers an empty, duplicated, or over-25 delivery_method_ids, a currency that doesn't match the lines, a custom line without fulfillment or a catalog line with it, a tracked line without inventory_routing_source, methods that can't deliver a line's allowed fulfillment types (param line_items), and a maximum_distance that isn't positive or uses another unit. A checkout credential that sends mode: "delivery_options" gets a NOT_ALLOWED detail with param mode.
  • HTTP 404
    A method in delivery_method_ids or your checkout default doesn't exist in this environment, and details[0].resource_id names it, or the checkout session can't be found. A checkout credential that names another checkout session gets this with param checkout_session_id.
  • HTTP 409
    A 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].reason is unsupported_state or archived, and blocking_resources names the resource. In pickup_locations mode, reason terminal_status means the checkout session is completed, expired, or closed.
  • HTTP 503
    SERVICE_UNAVAILABLERetry the same request
    A 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.

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#

POST/v1/delivery-previews

Requires 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 of

The buyer's location for pickup or local delivery, supplied as an address or a coordinate, chosen by `type`.

currencystringRequired

ISO 4217 currency code.

delivery_method_idsarray of string

Delivery methods to evaluate. When omitted, uses settings.checkout.default_delivery_method_ids, or no methods when that setting is empty.

destination_addressobject

A partial address for delivery quotes, previews, and buyer locations. Country is required when any member is present.

inventory_routing_sourceobject

Chooses where a delivery options preview routes inventory from: a fixed Location, an inventory allocation policy, or one policy revision.

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

Exact non-selectable delivery preview.

dataone ofRequired

Resource, collection, or operation result returned by this request.

metaobject

Additional information about this response.

request_idstringRequired

Identifier 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?