# Platform notes for the order side

Where the order-side columns come from on common systems, and the platform behaviour that creates mismatches. Field names were checked on 2026-10-17; read the live reference before mapping, because APIs and connectors rename fields.

## Paid definition: authorized or captured

Fill `paid_definition` in the contract before mapping `paid_at`.

- Merchants who capture at checkout have one time for both. Merchants who authorize at checkout and capture at fulfilment have days between them, and the thank-you page fires at authorization.
- If the business counts revenue at a successful authorization, use `authorized` and map `authorized_at`. Otherwise use `captured`; authorized orders not yet captured are then excluded as `authorized_not_captured`, and only orders whose authorization was voided, expired or failed count as `unpaid`.
- Shopify `Order.displayFinancialStatus` (checked 2026-10-17):
  - `AUTHORIZED`: payment details validated, appears only with manual capture. Authorized, not captured.
  - `PARTIALLY_PAID`: a manual capture for less than the order value. Captured; compare the captured amount in the contract.
  - `PAID`: captured automatically or manually, or marked as paid.
  - `PENDING`: the provider needs time, or a manual payment method. Not paid.
  - `EXPIRED` and `VOIDED`: authorization ended without capture. Never paid: `unpaid`, with `authorization_ended` true.
  - `PARTIALLY_REFUNDED` and `REFUNDED`: paid earlier; keep in the population and handle as refunds.
  - The time of each step sits on the order's transactions, not on the status; check the transaction fields live.
- Stripe PaymentIntent with `capture_method=manual` moves to `requires_capture` after authorization and to `succeeded` after capture. An authorization not captured in time is released and the PaymentIntent becomes `canceled`. Online card holds usually last 7 days and differ by method (checked 2026-10-17); read the hold window live rather than assuming one.
- Check the store's payment capture setting live before choosing; do not infer it from a few orders.

## Shopify

Identifiers. One order has several, and integrations differ in which they send as `transaction_id`:

- Admin GraphQL `Order.id`: a global ID.
- `Order.legacyResourceId`: the ID of the same order in the REST Admin API.
- `Order.name`: the identifier shown on the order page in the admin, such as `#1042`. Sequences can collide across stores.
- `Order.confirmationNumber`: a customer-facing identifier, often shown instead of the order name.
- In the Web Pixels API, `checkout_completed` exposes `event.data.checkout.order.id` (null on every other event) and `event.data.checkout.token`, a checkout identifier, not an order identifier.

Prove which one your integration sends (step 3), and whether it arrives as a global ID string or a number.

Statuses and dates:

- `Order.test` marks test orders.
- `Order.displayFinancialStatus` gives the financial status; map it with the paid definition above.
- `Order.sourceName` gives the source, such as `web`, `mobile_app` or `pos`. Use it for the channel rule.
- `Order.processedAt`, `Order.createdAt` and `Order.cancelledAt` are ISO 8601 timestamps. If the contract counts paid orders, find the time payment succeeded on the order's successful transaction and check that field live; do not assume `processedAt` is the paid time.

Money:

- Use the `...Set` money fields; their unprefixed versions are deprecated. Each gives shop and presentment amounts.
- `Order.currencyCode` is the shop currency; `Order.presentmentCurrencyCode` is the currency the customer paid in. Compare in the same currency the purchase event carries.
- `subtotalPriceSet` is line items after discounts and before returns. `totalTaxSet` and `totalDiscountsSet` are before returns. `totalPriceSet` is the total before returns. The `current...` versions are after returns and refunds, so do not use them for the purchase comparison.
- Check whether the store's prices include tax before deciding `expected_value`.

Checkout behaviour that creates mismatches:

- `checkout_completed` fires once per checkout, usually on the thank-you page. With upsells or post-purchase offers it fires on the first upsell page instead and does not fire again on the thank-you page. If the triggering page never loads, it is not sent.
- The Thank you and Order status upgrade (checked 2026-10-17): Additional scripts became view-only on 2025-08-28; Order status page script tags stopped running on 2025-08-28 for Plus stores and on 2026-08-26 for all other stores, the deadline for non-Plus stores to upgrade. Purchase tracking left in either stopped at the upgrade; the replacement for analytics is web pixels (an app pixel or a custom pixel). See [classes-and-causes.md](classes-and-causes.md).
- Shopify's GTM custom pixel tutorial maps `value` from `checkout.totalPrice`, which Shopify describes as including duties and taxes, and also sends tax and shipping. Copies of that example produce `hint_value_is_order_total` mismatches. `checkout.subtotalPrice` is described as the price before duties, shipping and taxes.
- Google Tag Assistant's Troubleshoot tag does not detect Google tags inside a custom pixel or loaded by GTM in one. Use Shopify Pixel Helper; a negative result from Tag Assistant proves nothing.
- Shopify's sales report counts pending, cancelled and unpaid orders in gross sales and excludes test and deleted orders. Sales reversals (formerly returns, a term Shopify has deprecated) appear as negatives on the date they were processed (checked 2026-10-17). "Shopify sales" is therefore never the expected value for a paid-order contract.

Access:

- Shopify's Dev MCP server serves developer docs and API schemas, runs locally and needs no store authentication. It is not a way to read orders.
- The Shopify AI Toolkit can run store tasks through Shopify CLI's authenticated store context: `shopify store auth` with `--scopes`, then `shopify store execute`, which blocks mutations unless `--allow-mutations` is passed (checked 2026-10-17). Use it only with read scopes (for example `read_orders`), never pass `--allow-mutations`, and get human approval before authenticating against a live store.
- Otherwise pull orders from an approved export, a warehouse connector or an Admin API app with read scopes.

## Stripe

- Amounts are integers in the currency's minor unit: `1099` charges 10.99 USD and `10` charges 10 JPY. Some currencies carry special rules (for example ISK and UGX are represented with two decimals that are always `00`). Convert with the currency's own exponent from Stripe's currency page, never a blanket division by 100.
- Checkout Session `status` is `open`, `complete` or `expired`; `complete` means the session is complete while payment may still be processing. `payment_status` is `paid`, `unpaid` or `no_payment_required`. `paid` also covers a successfully processed zero-amount trial invoice, so it is not proof of revenue.
- Delayed methods such as ACH direct debit and other bank transfers finish later with `checkout.session.async_payment_succeeded`; also handle `checkout.session.async_payment_failed`.
- Stripe states that fulfilment cannot rely on the landing page because customers may never reach it, and that the fulfilment function can be called more than once, even concurrently, for the same session.
- Checkout Session fields worth carrying to the order side: `amount_subtotal` (before discounts or taxes), `amount_total` (after discounts and taxes), `total_details` (discount, shipping and tax amounts), `currency` (lower case), `client_reference_id` (your reference for reconciliation), `invoice`, `payment_intent`, `created` (Unix seconds).
- Invoices: `billing_reason` separates `subscription_create`, `subscription_cycle`, `subscription_update`, `subscription_threshold`, `manual`, `quote_accept` and others. A purchase contract for new customers usually counts only the first qualifying paid invoice; renewals belong in a separate event or report. `status_transitions.paid_at` gives the paid time.
- Out-of-band payments: `invoice.paid` also fires when an invoice is marked as paid outside Stripe, so those invoices enter the paid population with no browser journey. Exclude them by reason. On API version 2026-05-27.dahlia and later, `amount_paid_off_stripe` (requested with `expand`, absent from event payloads) gives the amount paid outside Stripe; the older `paid_out_of_band` boolean is deprecated (checked 2026-10-17). Check which field your API version returns.
- Webhooks: live-mode deliveries are retried for up to three days, duplicates happen, and order is not guaranteed. Deduplicate notifications by event ID and business outcomes by object.
- Access: Stripe's MCP server at `mcp.stripe.com` reads any GET method through `stripe_api_read` and writes through `stripe_api_write`. Use only the read tool, with an OAuth grant or agent API key limited to read permissions. Stripe states that from December 2026 its MCP server stops accepting full-access secret keys and restricted keys without the Agent tag.

## WooCommerce

- Statuses (checked 2026-10-17): Processing means payment received and the order awaits fulfilment; Completed follows fulfilment; On hold awaits payment confirmation (common with bank transfer and delayed methods); Pending payment and Failed mean no successful payment; Draft is a temporary block-checkout record; Cancelled and Refunded also exist. Map Processing and Completed to paid, keep Refunded as paid then refunded, and treat On hold and Pending payment as not paid until they move. Cancelled orders may or may not have been paid; check the order notes or gateway.
- Order number against order ID: by default the order number equals the internal order ID. Sequential order number plugins change the number returned by `get_order_number()` while the ID stays the same. Prove which one the tracking plugin sends (step 3) and map both.
- Payment time: read the paid timestamp the store records, not the status change date in a report; check the field name in the store's version live.

## Invoice and subscription billing systems

- Provisional numbers. Some checkouts show a provisional number (cart, quote or pre-invoice) in the browser, and the billing system issues a final invoice number when payment completes. If the browser sends the provisional number, the join fails for every order unless the billing record keeps both. Find the field that stores it, map both keys, and include the store in the key: provisional sequences often collide across stores.
- Paid time precision. Lags and late flags need a paid timestamp with a time part; a date-only paid field is not enough.
- New versus renewal. Renewals and account-portal payments usually have no browser checkout and no ecommerce data on the page. Exclude them by the contract's channel or reason rule, or reconcile them separately.
- Return pages. A return URL flag such as `?status=success` is not proof of payment. Confirm paid status from the billing record, not the URL.
- Several stores in one property. The order side must cover every store that sends to the property, or the others' purchases look analytics-only.

## Other carts and custom order databases

- Map the same output columns from the order table. Watch for amounts in minor units, prices that include tax, a currency column that holds the shop currency rather than the customer's, and a "completed" status that means placed rather than paid.
- If the cart's analytics plugin sends the order number and the database key is an internal ID, store both and map both.
