AI Prompt
Add native mobile monetization to my app using the Despia SDK from: https://www.npmjs.com/package/despia-nativeFirst, install the package: Payment confirmation will happen via RevenueCat’s Webhooks, so make sure to include or instruct me to set up the correct backend structure.You can find the documentation about this here: https://www.revenuecat.com/docs/integrations/webhooks
npm install despia-nativeThen import it: import despia from 'despia-native'Create a payment system that uses RevenueCat Paywalls by calling: despia(revenuecat://launchPaywall?external_id={USER_ID}&offering={OFFERING})This will launch a native paywall interface configured in your RevenueCat dashboard, handling purchases through Apple App Store and Google Play billing.Add a button to launch the paywall for your app’s offerings, for example:"default"- your main offering"premium"- premium tier offering"annual_sale"- special promotional offering
The Despia Native Runtime will call the global function
onRevenueCatPurchase() when an in-app purchase or subscription is successfully made on the client side. Although this should not grant access immediately, it’s a good time to start polling your backend to check if the RevenueCat webhook has already updated the user’s status or plan permissions.This feature requires native capabilities which will be fully provided by the “despia-native” npm package, no additional native libraries are needed!
- Read and follow all best practices for Webhook events here: https://www.revenuecat.com/docs/integrations/webhooks/event-types-and-fields
- Check out the sample Webhook event schemas here: https://www.revenuecat.com/docs/integrations/webhooks/sample-events
Installation
Install the Despia package from NPM:Usage
1. Import the SDK
2. Launch Paywall
Call thedespia() function with a RevenueCat Paywalls Command:
Resources
- NPM Package
- View full NPM documentation for additional configuration options