> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pcnaid.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhooks

> Inbound and outbound webhooks for Loyalty & Rewards — Shopify subscriptions, compliance handlers, outbound delivery, and retry mechanisms.

# Webhooks

## Inbound Shopify webhooks

The app subscribes to the following Shopify webhook topics (declared in `shopify.app.toml`):

| Topic | Purpose |
| - | - |
| `app/uninstalled` | Shop cleanup, session deletion, privacy signal recording |
| `orders/paid` | Award purchase points, evaluate earning rules, detect velocity anomalies |
| `orders/updated` | Update order metafields, reconcile points |
| `refunds/create` | Reverse points awarded on refunded orders |
| `app_subscriptions/update` | Reconcile plan subscription changes |
| `shop/update` | Refresh shop primary domain |

## Compliance webhooks

Privacy-related mandatory topics handled through a single compliance webhook URI:

| Topic | Handler Behavior |
| - | - |
| `customers/data_request` | Compiles loyalty data for the requested customer and emails the export to the merchant's recorded contact address |
| `customers/redact` | Deletes the matching live customer record and cascading loyalty records in PostgreSQL |
| `shop/redact` | Deletes the shop record, dependent PostgreSQL records, Shopify session rows, and trial history after the authenticated uninstall signal is present |

### How redaction works

After an authenticated `app/uninstalled` webhook records the uninstall signal, a later `shop/redact` deletes all shop data. The handler uses HMAC body fingerprinting for retry suppression. Session absence alone is never treated as proof of uninstall. Legacy ambiguous requests are recorded for reconciliation.

## Outbound webhooks

The app emits domain events as signed outbound webhooks via a Svix-compatible delivery system.

* Delivery uses HMAC signing.
* Retry backoff: 1 minute → 12 hours.
* Admin UI provides endpoint management, subscription configuration, delivery logs, and replay.
* Delivery logs with replay are available through the Settings > Webhooks Configuration page.

### Outbound webhook topics

Outbound webhooks cover all major domain events: points awarded, redeemed, expired; tier changes; referral completions; achievement unlocks; and more. Manage endpoint subscriptions from the admin UI.

## Scheduled processing

Tier downgrades, paid membership renewals, points expiry warnings, and retries of failed outbound webhook and Shopify Flow deliveries run as scheduled background jobs inside the app. They are not part of the public API.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.