Skip to main content

AI Prompt

Add native mobile monetization to my app using the Despia SDK from: https://www.npmjs.com/package/despia-nativeFirst, install the package: 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!
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/webhooksOnce the payment is confirmed on the backend, the backend should send a webhook to the frontend to let it know that this user’s in-app purchase session was completed.Please follow the installation instructions for the “despia-native” npm package closely, and do not modify my instructions. Implementation as mentioned is critical.
How it Works: Despia acts as a bridge between your Lovable app and native mobile payment systems. When users tap a button to launch the paywall, Despia displays a native RevenueCat Paywalls interface configured in your RevenueCat dashboard. The paywall handles the complete purchase flow through Apple’s App Store or Google Play Store, ensuring secure transactions and automatic subscription management.

Installation

Install the Despia package from NPM:
npm install despia-native

Usage

1. Import the SDK

import despia from 'despia-native';

2. Launch Paywall

Call the despia() function with a RevenueCat Paywalls Command:
despia("revenuecat://launchPaywall?external_id=user_777&offering=default");

Resources

  • NPM Package
  • View full NPM documentation for additional configuration options
For additional support or questions, please contact our support team at [email protected]