πŸ’ΈIn-App Purchases

Before reading this page, please make sure you've set up your RevenueCat account.

🐈Setup RevenueCat Appchevron-right
circle-info

To offer a seamless purchasing experience across platforms, use In-app Purchases for your mobile app users and your preferred web payment processor for website users. The Browser Info feature helps you identify the user's platform to apply the correct payment method.

πŸ§‹ Bubble.io Plugin

[Element] Natively - Purchases

Events:

  • Purchase Success

  • Purchase Failed

  • Set Customer Success

  • Set Customer Failed

  • Purchase Cancelled

  • Customer ID Received

  • Get Price Success

  • Get Price Failed

  • Restore Purchase Success [iOS]

  • Restore Purchase Failed [iOS]

  • Paywall - purchase success

  • Paywall was not presented //Paywall was not presented.

  • Paywall - cancelled //Paywall was presented and the user cancelled without executing an action.

  • Paywall - error //Paywall was presented and an error occurred performing an operation.

  • Paywall - Entitlement ID missing //Only returned when using [Action] Show Paywall if needed and Entitlement ID is not provided.

  • Paywall - Offering ID was not found //Only returned when provided Offering ID is not valid.

  • Paywall - restore purchase success [iOS]

States:

  • Latest Transaction Id - Transaction Id after Purchase Package

  • Latest Customer Id - Customer Id after Set Customer ID or Purchase Package

  • Latest Error - Empty if no error

  • Latest GetPrice price - 9.99

  • Latest GetPrice price (Localized) - "$9.99" / "9.99 USD"

  • Latest GetPrice currency - "USD", "UAH", etc.

  • Latest PurchasePackage packageId

Actions:

  • Purchase Package - Initiate purchase of product or subscription

    • Old Product ID (Android) - Required for upgrading or downgrading an active Android subscription. You can retrieve the current Product ID by using the RevenueCat - Verify Subscription action.

    • Proration (Android) - When a user upgrades or downgrades their subscription on Android, Google Play offers five distinct proration modes. These modes determine exactly when the user is charged and how their billing cycle is adjusted.

      Choosing the right model is essential for managing your revenue and providing a fair experience for your users (e.g., charging them immediately for an upgrade vs. waiting until the next cycle).

      For a detailed breakdown of each specific mode and its implementation logic, please refer to the official RevenueCat Proration Documentationarrow-up-right.

  • Set Customer ID - Link your user's id with RevenueCat customer

    • Customer Identifier - (We're recommending using a Current User's unique id to identify customers in the RevenueCat dashboard)

  • Reset Customer ID - Unlink Customer ID from a device

  • Get Package Price - Returns a price for specific product

  • Get Customer ID - Returns a current customer id

  • Show Paywall - displays the paywall

    • Offering ID - if not provided, will be shown the default offering.

  • Show Paywall if needed - automatically displays the paywall only if the user doesn't have an active entitlement

    • Offering ID - if not provided, will be shown the default offering.

    • Entitlement ID - this field is required.

  • Restore Purchase [iOS] - Restores purchases (Handled by RevenueCat automatically)

How to use?

  1. Make sure you've set up your Revenue Cat for your app

  2. Add revenuecat_apiKey in plugin settings. To find API Key, go to RevenueCat App > API keys > Secret API keys.

  3. Call Set Customer ID

  4. When the Set Customer Success event fires, call Purchase Package action

How to verify User's subscription?

circle-info

Make sure you've added revenuecat_apiKey in plugin settings. To find API Key, go to RevenueCat App > API keys > Secret API keys. ⚠️⚠️⚠️ MAKE SURE YOU'RE USING API KEY V1

RevenueCat - Verify Subscription

  • Customer ID - Revenue cat user id that was used on RevenueCat Login.

circle-exclamation

Returns a result as:

  • Product ID - text

  • Purchase Date - date

  • Grace Period Expires Date - date

  • Expiration Date - date

  • Is Active - yes / no (Expiration Date > Current Date)

  • Error - empty text if no error

Bubble Setup example:

  1. On each User Login or first Signup you need to set the RevenueCat customer ID to your own user's unique id.

  2. Purchase a subscription (package) with action

  3. Verify user's subscription whenever you need it

  4. If you have any issues and, for some reasons, purchases doesn't work. You can check Latest Error value from Natively Purchases element

  5. You can also use RevenueCat APIarrow-up-right for your purpose (for example, validation of purchases)

πŸ›  JavaScript SDK

NativelyPurchases

How to verify subscription with JS?

You need to fetch a user from RevenueCat API and verify it's entitlements. More details can be found herearrow-up-right.

Where to find Package ID?

You can find it in your RevenueCat App dashboard, more details herearrow-up-right

circle-info

We recommend checking thisarrow-up-right guide if you plan to use a Stripe subscription through RevenueCat.

Create a request in API Connectorarrow-up-right (more details about the endpoint you can find herearrow-up-right)

Where fetch_token & app_user_id is:

Last updated