Purpose
A vendor-neutral interface wraps the optional RevenueCat SDK. Configuration, connection and identity changes serialize SDK operations. A generation guard prevents stale identity results from updating the current customer state. Purchase and restore resolve to a StoreResult: the CustomerInfo, or a reason mapped from the SDK's error codes (cancelled, pending, not allowed, already owned, another account, network, failed, unavailable). onCustomerInfoChange forwards the SDK's updates while a confirmed user is connected, and manageSubscriptions opens the store's subscription settings. React hooks expose customer and entitlement state.
Public exports
| Subpath | Target |
|---|---|
. | ./src/index.ts |
./react | ./src/react.ts |
These paths come from packages/purchases/package.json. A . entry is the package root. Conditional targets distinguish platform or type resolution; consumers should import the subpath, not its source file.
How to extend
Register the supported SDK, connect the signed-in user for the whole session (not one screen) and disconnect on sign-out; keep identity changes inside the package. Client purchase state is presentation; server-verified Paid Access remains authoritative.
Read Payments for the model and Mobile subscriptions with RevenueCat for the setup.