Shopify field notes

Fix Shopify orders, payments, subscriptions, and inventory with a script

A working library of the problems that hit real Shopify stores, across orders and payments, refunds and payouts, subscriptions, inventory, and fulfillment, and how to detect or repair each one with a small Python or Node.js script on the Admin GraphQL API. Every guide has a diagram of the problem, a diagram of the fix, full code in both languages, tests, and links to the source reports.

Python and Node.js Admin GraphQL API Diagrams and full code All code on GitHub

Orders, payments, and webhooks

8 guides

Orders stuck Unpaid after an outside payment

Bank transfer or cash on delivery came in but the order still says Pending. Mark the eligible ones paid, safely.

Repair

Webhook subscription auto-deleted

Too many failed deliveries and Shopify removed your webhook. Detect the gap and recreate the subscription.

soon

Webhook HMAC check keeps failing

The raw body got parsed before you verified it, so every event is rejected. Verify against the raw bytes.

soon

Duplicate webhook deliveries run twice

The same event arrives more than once and doubles your work. Dedupe on the webhook id.

soon

Missed webhooks with no backfill

Your app was down past the retry window. Poll updated orders and apply what you missed.

soon

Authorized payment expires uncaptured

The seven day hold runs out before you capture. Sweep authorized orders and capture the valid ones.

Reconciler

Double charge from duplicate transactions

Two SALE transactions landed on one order. Find the duplicates and refund the extra.

Repair

High-risk orders left unactioned

Fraud-flagged orders sit and ship anyway. Read the risk assessment and hold or cancel them.

Diagnostic

Refunds, payouts, and reconciliation

7 guides

Transactions total does not match the order

The sum of captures and refunds drifts from the order total. Report the ones that do not tie out.

Diagnostic

Reconcile orders against payouts

A bank deposit never equals the order totals. Tie each payout to its balance transactions to the cent.

soon

Processing fee not recorded on the order

Reports show gross, not what you kept. Pull the fee from the balance transaction onto the order.

soon

Partial refund leaves the tax untouched

A refund gave back the item but not its tax. Recompute the tax portion on partial refunds.

soon

Refund exists but the money never moved

The refund shows on the order while the gateway transaction failed. Catch the stuck ones.

soon

Chargeback pulled funds, order still Paid

A dispute took the money but the order looks fine. Write the dispute state onto the order.

soon

Presentment vs settlement currency

The buyer paid one currency and you settled another. Make the exchange explicit in the report.

soon

Subscriptions and billing

7 guides

Renewal fails on an expired card

The saved card expired and the renewal stalls. Find the contracts and send an update-card email.

Reconciler

Contract has no valid payment method

The method was revoked or never set. Detect the contracts that cannot bill and prompt the buyer.

soon

Dunning never retries a failed charge

A billing attempt failed and nothing tried again. Schedule retries with a safe backoff.

soon

Duplicate renewal charges

A retry with no idempotency key billed twice. Use a deterministic key per contract and cycle.

soon

Next billing date drifts

The stored date and the real cycle disagree. Compare them and realign the schedule.

soon

Billing runs on a cancelled contract

A scheduled attempt still made an order after cancel. Guard attempts on the contract status.

soon

Selling plan deleted after app uninstall

Removing the app dropped the plan and broke the product. Recreate the group and re-point it.

soon

Inventory

6 guides

Available drifted from real on-hand

The number on the store no longer matches the shelf. True it up with a compare-and-set write.

soon

Overselling from concurrent writes

Two updates raced and the count went wrong. Use compare quantity so a stale write is rejected.

soon

On-hand vs available vs committed

Raw stock got treated as sellable. Read the real quantity names and report the difference.

soon

Negative or phantom inventory

The oversell policy let the count fall below zero. Find the items and set the right policy.

Repair

Untracked items sell without limit

Tracking was off so the item never runs out. Detect them and turn tracking on.

soon

Bulk stock true-up after a bad import

An import left the counts wrong across the catalog. Re-set them in safe batches.

soon

Fulfillment

4 guides

Orders stuck Unfulfilled

The fulfillment was never created so the order never ships. Find the open ones and fulfill them.

soon

Fulfillment stuck On hold

A hold was placed and never released. Release the specific holds and let the order move.

soon

3PL fulfillment out of sync

The warehouse shipped but Shopify still shows in progress. Close or move the fulfillment order.

soon

Routed to an out-of-stock location

The order went to a location with no stock. Move the fulfillment order to one that can ship.

soon

Customers and data

4 guides

Duplicate customers for one email

The same shopper has several records. Merge them so history and credit stay in one place.

soon

Paid checkouts stranded as abandoned

A checkout paid but no order exists. Find the stranded ones and reconcile them.

soon

Test and Bogus Gateway orders in live data

Test orders slipped into your real reports. Flag and separate them from live sales.

soon

External id metafield dropped on create

Your linking key vanished on order create. Audit and set the metafield back.

soon

Fighting a Shopify bug right now?

If you have a problem in Shopify orders, payments, subscriptions, inventory, or fulfillment that you would rather hand off, this is the kind of work I do. Message me and we can work through it together.

Contact me on LinkedIn

Found this useful?

These guides are free and always will be. If one saved you a support ticket or a refund, you can throw a coffee my way. It keeps the notes coming.

Buy me a coffee on Ko-fi