Webhooks

Topics CODGuard subscribes to and what each one triggers.

TopicPurpose
orders/createPayment-mode detection, analytics, billing, RTO scoring, partial order edit.
app/uninstalledCleanup on uninstall.
app/scopes_updateTrack scope changes.
customers/data_requestMandatory GDPR compliance.
customers/redactMandatory GDPR compliance.
shop/redactMandatory GDPR compliance.

Shopify API version: 2026-07.

Idempotency

orders/create is the busy one, and Shopify retries webhooks. CODGuard claims a unique (shop, topic, resourceId) receipt before processing, so a retry can never double-count analytics, double-bill a message, or run an order edit twice.

What orders/create does

  1. Claims the webhook receipt. If it is already claimed, stop.
  2. Reads _codguard_payment to determine the mode, falling back to the stored payment-mode selection by session id, or by phone and mode.
  3. Increments daily analytics for the shop.
  4. Computes and stores the RTO risk score, then applies the flag or cancel action if thresholds are met.
  5. For partial orders, runs the Shopify order edit that swaps the deposit lines for the real products.