# RevenueCat ready to use: webhooks RevenueCat counts as delivered, session-long store identity, Paywall and Customer Center

The RevenueCat module matches RevenueCat's current documentation: 200 for every handled webhook, optional HMAC signing, every event type, verification paced by access. The app keeps the SDK identified for the whole session, explains each store outcome and can show RevenueCat's Paywall and Customer Center. A setup page covers stores, RevenueCat, webhook, env and sandbox testing.

<Callout title="Action: RevenueCat webhook settings">
If you already use RevenueCat: `REVENUECAT_WEBHOOK_SIGNING_SECRET` is now optional and must match the webhook's **HMAC webhook signing** secret when set. Turn signing on in the dashboard and copy its secret, or remove the variable. Filter each webhook to the environment of its server. A development client built before this change has no `react-native-purchases-ui`; rebuild it to use the Paywall or the Customer Center.
</Callout>

- **Webhooks RevenueCat counts as delivered.** `/api/billing/revenuecat` answered 204, and RevenueCat counts any status but 200 as a failure, retrying each event five times. It now answers 200. It does the same, and acts on nothing, for an authentic event from the other store environment or from an app outside `REVENUECAT_APP_IDS`, which used to be rejected with 400. The Authorization header is always required and compared in constant time; the `X-RevenueCat-Webhook-Signature` HMAC is required only when its secret is set, because RevenueCat makes signing opt-in. Every documented event type parses, including `TRANSFER`, `PURCHASE_REDEEMED`, `EXPERIMENT_ENROLLMENT` and `TEMPORARY_ENTITLEMENT_GRANT`, and every User an event names is re-read. The tests use RevenueCat's own sample payloads. See [Mobile subscriptions with RevenueCat](/docs/features/revenuecat). ([efd7d4a](https://github.com/CarlosZiegler/template-cloudflare/commit/efd7d4ad5726e3f4e2f49b0911f004a0b7e3c26d))
- **Verification paced by access.** The cron re-read every queued User hourly, at most 600 an hour, so past that size verifications aged out and paying Users lost access. A User with access is now re-read at half of `BILLING_MAX_VERIFIED_AGE_SECONDS`, or a minute after the earliest period end. A User without access is re-read on an event, a sync, or weekly. Each tick re-reads 24 Users, four at a time. ([70e38b8](https://github.com/CarlosZiegler/template-cloudflare/commit/70e38b898fb44346e41c357a9f1c2197205aad60))
- **Store identity for the whole session.** Leaving Profile → Subscription logged the SDK out. A renewal or an approved Ask to Buy delivered later would then have been posted for an anonymous user, and RevenueCat's default restore behavior could move the subscription away from the User. The signed-in layout now connects RevenueCat after sign-in and logs it out only on sign-out. Its customer info listener calls `billing.sync` when the device and the server disagree. ([47a490c](https://github.com/CarlosZiegler/template-cloudflare/commit/47a490c1c71798e6e3c57b19ba10687bd08eeb2b))
- **A screen that explains the store.** Purchase and restore results now say what happened: cancelled (silent), waiting for approval, not allowed, already owned (use Restore), belongs to another account, network, or failed. The screen also tells a build without the store module apart from a failed connection, and offers "Manage subscription". `EXPO_PUBLIC_REVENUECAT_PAYWALL` shows RevenueCat's Paywall for the current offering, and `EXPO_PUBLIC_REVENUECAT_CUSTOMER_CENTER` opens the Customer Center. Both come from `react-native-purchases-ui` 11.0.4 and are used only in builds that include it. ([8135fd6](https://github.com/CarlosZiegler/template-cloudflare/commit/8135fd63497bde26a21a622262b8624f375edeca), [47a490c](https://github.com/CarlosZiegler/template-cloudflare/commit/47a490c1c71798e6e3c57b19ba10687bd08eeb2b))
- **Setup, step by step.** [Mobile subscriptions with RevenueCat](/docs/features/revenuecat) covers:
  - store products in App Store Connect and Play Console;
  - the RevenueCat project (entitlements, offerings, restore behavior, the v1 secret key);
  - the webhook, env vars and the `billing.mobile` flag;
  - sandbox testing with a StoreKit configuration file, sandbox testers and Play license testers.

  `docs/billing.md` is now in English, and [ADR-0004](/docs/adr/0004-payments-providers) records the changes. ([f636228](https://github.com/CarlosZiegler/template-cloudflare/commit/f6362289feefe55c104e217970559b5b810c53a6))
