Skip to main content

Installation


Schemes

Launch a paywall

Opens the RevenueCat native paywall UI configured in your RevenueCat dashboard. The paywall handles product selection, pricing display, and the purchase flow.

Direct purchase

Triggers a purchase for a specific product without showing a paywall UI. Use this when you have your own custom purchase UI.
iOS product ID format:
Android product ID format:
The prefix before : is the subscription group name as configured in Google Play Console.

Customer Center

Opens the RevenueCat Customer Center, the native UI that lets users restore purchases, manage their subscription, request refunds (iOS only), and complete feedback surveys. All actions inside the sheet stream back to your web layer through window.onRevenueCatCenter.

Check entitlements

Queries the native store for all purchases on the current device/account. Returns active subscriptions, expired subscriptions, and one-time purchases. Instant and offline-capable.
Call this on app load, on page navigation, and before gating any premium feature.

Purchase callback

The Despia runtime calls window.onRevenueCatPurchase() immediately when the store confirms a transaction client-side. This is a signal that a transaction occurred, not confirmation that access should be granted.
Do not grant access based on the callback alone if you have a backend. The callback fires before your server has received and processed the RevenueCat webhook. Always wait for your backend to confirm before unlocking features.
If you have no backend, use getpurchasehistory:// inside the callback to check entitlements directly from the store:

Customer Center callback

The Despia runtime calls window.onRevenueCatCenter(event) for every action a user takes inside the Customer Center sheet, plus when the sheet itself is dismissed. Set up a single handler and switch on event.event. When the user runs Restore Purchases from inside the Customer Center, run your existing Despia restore flow on top of the Customer Center’s own restore. Both paths hit the native store, but firing your getpurchasehistory:// query plus entitlement check on restoreCompleted guarantees your web app reflects whatever the device actually thinks is true. The Customer Center event tells you the user finished a restore. The Despia call confirms what they restored.
The event payload’s activeEntitlements array is convenient but not authoritative. Always run getpurchasehistory:// yourself after a state-changing event. The native store is the source of truth, the events are just signals that something might have changed.

Events

All Customer Center events are client-side. They fire while the user is interacting with the sheet. Server-side outcomes such as Apple actually approving a refund, renewals, expirations while the app is closed, and billing failures require RevenueCat webhooks.

Android refund fallback

Google Play does not allow apps to trigger refund requests in-app. The Customer Center on Android has no refund button for this reason, and the refundRequested / refundCompleted events never fire on Android. To give Android users a path to refunds, configure a custom URL management option in your RevenueCat Customer Center dashboard, then route it client-side using a User-Agent check.
Recommended customUrl destinations for the Android refund path:
iOS users never hit the customUrl branch for refunds because the native refund flow is built into the Customer Center. The User-Agent check above is purely to give Android users a path that doesn’t dead-end.
To process the refund manually once you receive the email, go to RevenueCat Dashboard > Customers, look up the user, and use the Grant or Refund actions. RevenueCat will fire a REFUND webhook event back to your endpoint so your backend stays in sync.

getpurchasehistory:// response fields

Each item in restoredData has the following fields:

Entitlement check pattern

Set up entitlements in your RevenueCat dashboard first: create an entitlement (e.g. premium), then attach both your iOS and Android products to it. Both platforms will then return the same entitlementId in the response.
Client-side entitlement checks only reflect native iOS and Android purchases. If a user purchased on web, getpurchasehistory:// will not show that purchase. For apps with web payments, check your backend first and use the native store check as a secondary fallback.

Web fallback

Neither launchPaywall nor purchase work in a standard browser. Always detect the Despia runtime and fall back to a RevenueCat Web Purchase Link.
Always append the user’s ID to the Web Purchase Link URL. The user must already exist in your database before you redirect them, RevenueCat includes the app_user_id in every webhook event, and if your backend cannot find that user the purchase cannot be granted.
Optional Web Purchase Link parameters:

Webhook handler

Server-side webhooks are the recommended way to track subscription state. They let you revoke access on expiry, handle billing issues, and sync state across platforms in real time.

Register the webhook

  1. Go to RevenueCat Dashboard > Integrations > Webhooks
  2. Set the URL to your endpoint e.g. https://yourapp.com/webhooks/revenuecat
  3. Set the Authorization header to a random secret stored in your environment variables
  4. Select All events and save

Endpoint

Some backends (Supabase Edge Functions, Convex) apply authentication middleware by default that will block incoming RevenueCat requests. Disable the default auth middleware on this endpoint so RevenueCat’s Authorization header reaches your handler.

Webhook event types

Database schema


Restore purchases

Required by App Store guidelines. Call getpurchasehistory:// and re-grant any active entitlements found.
You can also surface the Customer Center scheme as the entire restore-and-manage UI, since users can run a restore from inside the sheet themselves. For the fully safe path, hook restoreCompleted and run your own Despia restore plus entitlement check rather than trusting the event payload alone. The native store is the source of truth, the events are just triggers.

Resources

NPM Package

despia-native

RevenueCat Dashboard

Configure entitlements, offerings, and paywalls

RevenueCat Webhooks

Event types, fields, and sample payloads