💸

In-app purchases and subscriptions (RevenueCat)

Bravo uses RevenueCat service to integrate In-App Purchases for iOS & Android apps.
In-app purchase is the feature that allows you to build apps with subscriptions for digital products and services. Not only will this unlock recurring revenue for you or your business, but you’ll also be able to grow a loyal and engaged audience that won’t have to leave the app to make purchases.
This feature is available in the Business App plan.

Requirements

  • A RevenueCat account (free tier available).
  • For Android, you need to have a published app already on Google Play. In case you don't have one, create a publication-ready app and follow this guide to publish it.
  • For iOS you need to have generated an IPA bundle in Bravo.

About RevenueCat

With RevenueCat, you can allow you app users to purchase subscriptions, make sure your users pay for accessing specific pages, and more. Instead of having one set up for Android and another for iOS, Bravo connects to RevenueCat to have both platforms available in your app with just one connection.
Before starting to set this feature up, make sure you are familiar with how RevenueCat works and the meaning of Products, Entitlements and Offerings.
Your app connects to RevenueCap and gets access to subscriptions both from Apple and Google stores

🔖 The tags

The following tags are available:
//Purchase action
[action:purchase:<package_id>]
​
//Show the price of the purchase
[price:<package_id>] => For the text layer
{price} => Within the text
​
//Show the paywall
[page:paywall]
​
//Control access to pages and visibility to containers
[require:purchase:<entitlement_ids>]
​
//Show page or container to users that haven't purchased any plan
[require:purchase:none]
​
//Restore purchase
[action:restore-purchases]

Purchase actions

These tags will be used anywhere we want to allow users to do an in-app purchase.
Purchase action
Show price
[action:purchase:<package_id>]
Triggers the purchase action. This will normally need to be added in a button where users can execute the purchase. <package_id> is the identifier of the package from the offering in RevenueCat. For example: "pro", "medium" or "basic".
[price:<package_id>]
Use this tag, together with the {price} expression in the design file, to show the price of the purchase. Check out our example design to see an example. package_id will be the same one used in the purchase action.

Purchase response action

We can configure an action to happen once the purchase action is success or not.
  1. 1.
    Go to the binding page in Bravo Studio, select the element with [action:purchase:<package_id>]
  2. 2.
    Open the Revenuecat purchase option.
  3. 3.
    Select the desired action for On Success and/or On Error:
    1. 1.
      No action
    2. 2.
      Show alert
    3. 3.
      Go to page
    4. 4.
      Go back
    5. 5.
      Open URL
    6. 6.
      Refresh
    7. 7.
      Logout

Paywall

[page:paywall]
Use this tag to create a paywall page. This page will be displayed every time users try to access content that requires a purchase. This page will usually contain the UI elements with the [action:purchase:<package_id>] tag.

Access control

[require:purchase:<entitlement_ids>]
Use this tag to create pages that only users who made a purchase can access.
The access control is based on entitlements, which represents the access level a particular user has. Each entitlement can be associated to more than one package: for instance, in case we want to create monthly and yearly subscriptions. However, all the packages inside the same entitlement will grant access to the same content.
In the tag, separate the entitlement IDs with commas, in case there’s more than one. For example, [require:purchase:basic,medium]

Conditional visibility for purchases

[require:purchase:<entitlement_ids>]
Allows to show/hide containers, and components depending on the entitlement, allowing a lot of flexibility that can be already configured by tags in Figma (no API calls needed).
Separate the entitlement IDs with commas, in case there’s more than one. For example, [require:purchase:basic,medium]

Restore purchases action

[action:restore-purchases]
This is used to restore purchases in case the app is deleted, a new device will be used, etc. It's a requirement from Apple to include it.

🎨 Sample design file

You can use the file below to see how to set up these tags.

Setup RevenueCat App

  1. 1.
    Create an account if you don't have one already (free tier available).
  2. 2.
    Go to Projects -> Create Project.

iOS configuration

  1. 1.
    Make sure you have followed step 2 from our iOS publication guide. We need to have an app created in App Store Connect with a bundleID.
  2. 2.
    Generate an App-Specific Shared Secret following this guide.
  3. 3.
    Generate an In-App Purchase Key following this guide.​
  4. 4.
    Complete the iOS in-app product setup following this guide.
  5. 5.
    In the RevenueCat project you have created, add an App Store app, set an app name, the bundleID from step 1 and the App-Specific Shared Secret from step 2.
  6. 6.
    Configure the products in RevenueCat following this guide.​
  7. 7.
    Create one offering. Set "default" as identifier. Only this offering is supported!
  8. 8.
    Attach the packages to this offering. Use "Custom" as identifier type and enter its name. Ex: "pro".
  9. 9.
    Now follow the first 4 steps (under Setup Instructions) indicated in this guide.
  10. 10.
    In Bravo Studio, go to you app -> Integrations -> Payments. Enable RevenueCat.
  11. 11.
    Set the Apple (IOS) API Key and/or Android API Key. You'll find them in RevenueCat, under Project settings -> API Keys. Save.
  12. 12.
    Now you'll be able to test the set up in Testflight:
    1. 1.
      Generate an IPA: In Bravo Studio, go to your app -> Publish -> iOS.
    2. 2.
      Fill the Bundle ID and certificates.
    3. 3.
      Click on Get IPA.
    4. 4.
      In 15-20min you'll receive your IPA ready to be uploaded to Apple Store Connect via Transporter. Learn more about Testflight.

Android configuration

RevenueCat setup

In order to set up the RevenueCat integration on Android, follow the steps below:
  • Configure an account in RevenueCat if you don’t have one, and create project. Then, create an app in that project (remember you need two different apps for Android and iOS)
  • After creating the Android app, you need to create Play service credentials. This will allow Revenuecat connect to Google play. Follow the steps indicated in this guide to create these credentials in JSON format.
  • You'll need to ensure Pub/Sub service is enabled in the Google Cloud project used to create the Play service account. You can do that by following this link.
  • After registering your app, we recommend setting up Platform Server Notifications. These notifications aren't required but will speed up webhooks and integration delivery times and reduce lag time updating your subscribers.
  • Create your products, entitlements, and offering in RevenueCat. To clarify the concepts:
    • Products are all your different subscription types (e.g. basic, medium, pro)
    • Entitlements are the different “entrance levels” (e.g. one entitlement must have at least one product, but may have more than one)
    • Offerings are a group of products, that are available ins a specific time, mostly use for marketing purposes. We only support one “default” offering.
  • First create all your products. In our Recipes example, the list of products looks like this (note you need to create separate products for Android and iOS)
  • Then, create all your entitlements (normally 1 entitlement = 1 product, but this depends on each particular case)
  • After you have products and entitlements, you need to attach each product to its correspondent entitlement. In our Recipes example, we added 2 products to each entitlement (1 per iOS and 1 per Android):
  • Create an offering: “default” (the only one offering supported for now) and add a description
  • Enter the created offering, and click on “ + New” to add a Package
​
  • Select “Custom” in the first dropdown, and then enter the Identifier name (i.e. your product name) and a description
​
​
​
​
  • Enter in the created package, and click on Attach
  • In the popup, you should see all the products you added in previous steps. Attach the ones that corresponds to the package. For our example, in the pro package, we will add the “pro products” for Android and IOS:
​
​
​
​
  • Click on attach. Repeat this process for all the packages you have. When you’re done, you should see in the default offering all the packages (a.k.a subscriptions) that you have.

Bravo setup

After setting up your Android app in RevenueCat, you'll need to copy the Android API key and paste it in the Bravo settings for the RevenueCat integration:
Once you've copy/pasted the key, press Save and continue to the next section of this guide.

Google Play setup

Finally, you need to create your subscriptions in Google Play. Please read carefully the instructions, since the steps need to be followed thoroughly. The right steps to create a subscriptions are:
  1. 1.
    Need to have an app published and live in Google Play (mandatory).
2. Create a Closed testing track, and upload an AAB with a newer version. Wait until the app is approved (need to be reviewed by Google even in this Closed testing track)
​
​
3. Now, you need to add a test user. This test user needs to be the same user logged in in your Android test device. The test user needs to be added both in License testing of your Google Play account, and in the Closed testing track for the app.
  • Open the License testing section in the side bar, and insert the email of the test user.
  • Then, add the tester email in the closed testing track of the app.
  • Finally, make sure the tester joins the test on the web.
​
4. Once the previous steps are done correctly, users should be able to create a subscription in the Monetise - Products -Subscriptions section in the left side menu. If users see the screenshot below, it means steps 1 to 3 are not completed correctly
5. Click on Create subscription and enter Product ID and Name (this product ID will be the same you enter in RevenueCat). See screenshots below:
6. Click on add a base plan, chose base plan id and select auto-renewing
7. IMPORTANT: Select Manage country/region availability in blue. If you try to add a country directly in the Edit base plan section, you might get unexpected errors trying to save
8. Unselect 95 countries/regions, search your country, check the box and click apply
9. Click on Price, enter a price and save
10. Click save
11. Click activate
12. Go back to the subscriptions main page, and if you did everything correctly, you should see your plan as active
To recap, at this point you should have:
  • Play service credentials created and saved on Revenuecat
  • Your app published in Google Play
  • A new version with the RevenueCat library integrated (new build requested in Bravo), published in a Closed testing track
  • At least one tested that joined your testing track
  • All your subscriptions created in Google Play
Now, you should be able to test the in-app purchases with the tester user you've created. Once you're ready to go, move the app to the publication track and it will be available for all users!
​