Shopify
Purpose
Orders, catalog, customers, and inventory for a channel whose type is SHOPIFY. Usually the seller's own store, with PointNXT fulfilling its orders and reporting shipments, cancellations and deliveries back.
Authentication
Client id and secret in the connection vault (client_credentials grant). The seed schema also has an optional webhook_secret. The app's scopes are set where the app is configured in Shopify, not in code; the connection form lists them, including read_merchant_managed_fulfillment_orders and write_merchant_managed_fulfillment_orders, which shipping orders back needs.
API version
The Admin GraphQL API is pinned to 2026-04 (supported until 16 April 2027), the newest the installed SDK (@shopify/shopify-api 13.x) knows. Shopify serves a retired version as the oldest supported one, so a stale pin changes the schema silently; moving past 2026-04 means upgrading the SDK. From 2026-04, inventorySetQuantities takes an @idempotent key and changeFromQuantity per quantity (we send null, setting absolute values as the stock master); fulfillments use fulfillmentCreate.
Rate limiting and query cost
Shopify meters by query cost (100 points a second on standard plans) and refuses any single query over 1,000 points. A throttled request waits for the points it needs and retries, up to 3 times and 15 seconds a wait. Orders and products are paged by id and each record read on its own, because a page of full orders (line items) or products (variants, metafields) is far over the per-query limit; an order reads 50 line items at once and pages the rest. Inventory reads go 20 items to a query for the same reason.
Channel HTTP budgets for inventory are in inventory-publish.constant.ts.
Orders
Pulled on the sync scheduler by updated_at (60 days back on a first sync), plus webhooks. The cursor moves when the window is read to the end. An order that fails on its own is kept (shopify:order-sync:failed:<channelId> in the cache, 7 days) and re-read by id at the start of the next run, up to 25 a run, rather than holding the cursor; without the cache the cursor holds as before. Same rule for every channel; see Integrations overview.
- Lines use
currentQuantity, after Shopify order edits. A line edited out (quantity 0) isCANCELLED, which gives its stock back. Lines that need no shipping (gift cards, digital goods) are not order lines. - Each line's shipped quantity comes from
unfulfilledQuantity. A fully fulfilled line isSHIPPED, orDELIVEREDonce every live Shopify fulfillment is delivered, which also makes the orderDELIVERED. - A full refund makes the order
REFUNDEDeven after fulfilment. - A Shopify hold on a fulfillment order parks an open order
ON_HOLD(Held in Shopify) until Shopify releases it. A new order Shopify's risk analysis recommends cancelling or investigating is held (Shopify flagged fraud risk) until someone releases it in PointNXT; it is not re-applied after. An order created on hold is still address-validated, like any new order. - Shopify fulfillments are kept as
Order.config.channelTrackingand shown as "Marketplace shipment" on the order page.
Direction
Inventory flush job flush-channel:SHOPIFY. Outbound order service is part of the capability regex, so status push is possible when manageState is on and the class was discovered:
- Fulfilled:
fulfillmentCreateonly against fulfillment orders that areOPENorIN_PROGRESSand assigned to a location PointNXT ships from (the channel's mapped locations; without a mapping, any location not run by a fulfillment service). Lines are grouped by the PointNXT shipment that carried them (only shipments PointNXT created, originOMS), so each Shopify fulfillment has that parcel's AWB, courier and tracking URL. An AWB that arrives after a fulfillment exists is added withfulfillmentTrackingInfoUpdate. - Cancelled:
orderCancel, never restocking (PointNXT is the stock master). - Delivered: a
DELIVEREDfulfillment event on each live fulfillment not yet delivered.
Channel settings: notifyCustomer (default on) lets Shopify email the buyer on shipment and cancellation; refundOnCancel (default off) refunds the original payment method when PointNXT cancels a paid order.
Webhooks
shopify-webhook.controller.ts is @PublicRoute and enqueues webhook_queue. Signature verification is implemented for this path. Do not copy that claim onto every courier.
Topics: orders/create, orders/updated, orders/cancelled, products/create, products/update, fulfillment_orders/placed_on_hold and fulfillment_orders/hold_released (the order is re-read), and app/uninstalled (the connection is marked DISCONNECTED). ShopifyWebhookHealthService runs on the webhook health schedule and re-creates any subscription Shopify dropped after failed deliveries; an app's subscriptions are not visible in the Shopify admin, so a missing one was not removed by a person.
Code
src/integrations/shopify.
Failure
Shared sync circuit breaker. Inventory partial success is per item. Idempotency of order ingestion is unknown beyond the outbox and ProcessedEvent tools.
Payment references
Order import also records the order's gateway payment as an OrderPaymentTransaction, so payment gateway settlements can match it. The GraphQL order query reads transactions; only successful SALE/CAPTURE entries from a recognised gateway are kept (toShopifyPaymentReferences in shopify-order.service.ts).
Orders paid with Shopify Payments are not matched against gateway lines. They reconcile through the Shopify payout report on the marketplace settlement path. See Payment gateway settlements.