Webhooks
Topics CODGuard subscribes to and what each one triggers.
| Topic | Purpose |
|---|---|
orders/create | Payment-mode detection, analytics, billing, RTO scoring, partial order edit. |
app/uninstalled | Cleanup on uninstall. |
app/scopes_update | Track scope changes. |
customers/data_request | Mandatory GDPR compliance. |
customers/redact | Mandatory GDPR compliance. |
shop/redact | Mandatory 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
- Claims the webhook receipt. If it is already claimed, stop.
- Reads
_codguard_paymentto determine the mode, falling back to the stored payment-mode selection by session id, or by phone and mode. - Increments daily analytics for the shop.
- Computes and stores the RTO risk score, then applies the flag or cancel action if thresholds are met.
- For partial orders, runs the Shopify order edit that swaps the deposit lines for the real products.
