# Forest Commerce Purchase Preflight

> Forest Commerce Purchase Preflight is a paid API for AI agents from http--forest-gas-station-mainnet--lcjl27p8lmjs.code.run, paid per call via x402, $0.006/call, status unknown (last checked 2026-10-22).

Validates whether a specific product variant can be purchased and shipped to a destination, returning price, availability, and shipping options before committing to a transaction.

## Facts

- Endpoint: POST https://http--forest-gas-station-mainnet--lcjl27p8lmjs.code.run/commerce/purchase-preflight?utm_source=zero.xyz
- Price: $0.006/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-22
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/forest-commerce-purchase-preflight-76231dfb
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_KCZrYW7baN-jaO2RkbONn

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability forest-commerce-purchase-preflight-76231dfb -d '<json body>'
```

Example prompt: Before I buy 2 units of the blue variant (variant ID 'gid://shopify/ProductVariant/123456') from https://example-shop.com/products/widget, check if it can actually be delivered to postal code 10001 in the US and what shipping will cost.

## When to prefer this

Use this endpoint when you need to validate purchase feasibility for a specific product variant before attempting checkout — especially when you need to confirm shipping availability to a specific country/postal code, check quantity limits, identify blockers, and surface shipping cost options. Prefer this over scraping a product page when you need structured, machine-readable preflight data including checkout URLs and shipping quotes. Best suited for Shopify-backed storefronts.

## Known failure modes

- Invalid or unreachable product URL returns error or blockers in response
- Variant ID not found at the provider results in blockers or unavailable state
- Destination country/postal code unsupported for shipping returns deliverable: false
- Quantity exceeds provider limit (max 100) returns validation error
- Missing required fields (url, country, postal_code) returns 400 Bad Request
- Unsigned payment call returns HTTP 402 with x402 PAYMENT-REQUIRED challenge
- Provider (Shopify) timeout or rate limit may cause elevated duration_ms or error

## How this service works

Machine-readable contract for active Forest paid capabilities. Unsigned paid calls return HTTP 402 with a PAYMENT-REQUIRED x402 challenge.

## Output

Returns a structured preflight object indicating whether the product is available (state: ready/blocked), a list of blockers if any, item price, subtotal, accepted quantity, available shipping options with names/prices/delivery dates, cheapest shipping option, whether delivery is possible to the given destination, and a checkout URL if a cart is possible. Also includes metadata about provider (e.g. shopify-ajax), cache status, and response duration.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "url": {
   "type": "string",
   "pattern": "^https?://",
   "maxLength": 2048,
   "minLength": 1,
   "description": "Public HTTP(S) URL to inspect, resolve, or compare."
  },
  "quantity": {
   "type": "integer",
   "maximum": 100,
   "minimum": 1,
   "description": "Requested item quantity to validate against provider limits."
  },
  "variant_id": {
   "type": "string",
   "maxLength": 256,
   "minLength": 1,
   "description": "Public provider variant identifier to validate."
  },
  "destination": {
   "type": "object",
   "required": [
    "country",
    "postal_code"
   ],
   "properties": {
    "country": {
     "type": "string",
     "pattern": "^[A-Za-z]{2}$",
     "description": "Public country value used to scope this lookup."
    },
    "postal_code": {
     "type": "string",
     "maxLength": 32,
     "minLength": 1,
     "description": "Public postal code value used to scope this lookup."
    }
   },
   "description": "Delivery country and postal code used to quote delivery availability.",
   "additionalProperties": false
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "ok": true,
  "data": {
   "scope": "anonymous_bounded_preflight_not_purchase_guarantee",
   "state": "ready",
   "blockers": [],
   "currency": "example",
   "platform": "example",
   "subtotal": 1,
   "item_price": 1,
   "deliverable": false,
   "checkout_url": "example",
   "canonical_url": "example",
   "cart_possible": false,
   "session_scope": "request_scoped_ephemeral",
   "delivery_checked": false,
   "shipping_options": [],
   "accepted_quantity": 1,
   "cheapest_shipping": {
    "name": "example",
    "price": 1,
    "currency": "example",
    "max_delivery_date": "example",
    "min_delivery_date": "example"
   },
   "checkout_possible": false,
   "order_not_created": true,
   "delivery_requested": false,
   "requested_quantity": 1,
   "selected_variant_id": "example",
   "payment_not_attempted": true,
   "shipping_option_count": 0,
   "provider_request_count": 0,
   "customer_session_touched": false
  },
  "meta": {
   "cache": "miss",
   "provider": "shopify-ajax",
   "checked_at": "2026-01-01T00:00:00.000Z",
   "duration_ms": 0
  },
  "version": "1",
  "capability": "commerce.purchase-preflight"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/forest-commerce-purchase-preflight-76231dfb/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from http--forest-gas-station-mainnet--lcjl27p8lmjs.code.run](https://www.zero.xyz/host/http--forest-gas-station-mainnet--lcjl27p8lmjs.code.run/llms.txt)
