React Native Cross-Platform SDK
Adding Nami to your app has a few steps for a basic app.
Add the SDK to your project
Configure the SDK
Show a paywall in your app
React to a purchase to grant access to paid content or features
Optional: Managing Identity
1. Adding the Nami SDK
In React Native apps, the Nami SDK setup consists of two parts.
Installing the React Native SDK bridge
Configuring the Nami SDK for your projects
Let's walk through each step.
Installing React Native SDK Bridge
The Nami SDK for React Native is available as a NPM bridge module and supports supports Apple iOS, iPadOS, and tvOS published on the App Store, Android and Android TV published on Google Play, and Amazon FireTV apps published on the Amazon Appstore.
To add Nami to your React Native project, start by adding the React Native bridge to your project with yarn
or npm
.
The code for the React Native bridge is also available on our Github.
If you need help setting up your React Native development environment, you can find instructions here: https://reactnative.dev/docs/environment-setup .
Configure for Apple
Complete the following steps to prepare your React Native app for using Nami.
Edit
ios/Podfile.
Confirm for each target, that the minimum versions match Nami's native Apple SDK.
Run
cd ios && pod update
Configure for Android Projects
Edit
android/build.gradle
and add the native Nami SDK for Android maven repository.
Configure for Android & Amazon Projects
If your projects is also available on the Amazon Appstore, you will need to change the way you include the the Nami SDK maven repository. Nami publishes two flavors of the Android SDK -- one for Google Play, and one for Amazon Appstore.
As a result you will need to edit android/app/build.gradle
instead and use build flavors to pull in the correct Android maven repository.
Also, for Amazon FireTV devices or other devices targeting minSdkVersion
25 or lower, see this document for two additional steps to enable the Nami SDK to work properly. Nami supports down to minSdkVersion
22.
Configure the SDK
We recommend that you configure the Nami SDK as early in your app's index.js
.
To initialize the Nami SDK, you'll call the configure
method with App Platform IDs for both Apple and Android.
Nami recommends setting the log level to WARN for apps on the store. INFO may be helpful during development to better understand what is going on. DEBUG level has a lot of information and is likely only helpful to the Nami support team.
3. Launch a campaign to Show a Paywall
Now that you have the SDK configured, let's show a paywall by launching a campaign. This step requires that you have a live campaign configured in the Nami Control Center.
It's easily to launch a campaign, as well as receive granular callbacks about what's happening on the paywall. This can be used to provide error handling UI or even send data to your analytics platform.
You can also check if a campaign is available before launch.
4. Managing Purchases
If you are using Nami's subscription management features, you can ask the SDK whether or not a user has access to an entitlement.
Grant access to paid app features
Once a user has made a purchase, you'll need to make sure to give them access to the content and features in your app that require a purchase. This is managed on the Nami platform through our entitlement engine.
Nami Subscription ManagementUsing your own subscription management
If you have your own subscription management or in-app purchase code or are using another third-party solution, no problem! Nami will call back to you when a user initiates the purchase flow on a Nami paywall. It's then your responsibility to process the purchase and notify Nami when the purchase completes successfully.
Bring your Own Payment Code5. Managing Identity
Provide your customer identifier to link one or more devices to a known customer. It's best to do this when a user registers or signs-in to their account in your app.
If provided, the customer id (which we refer to as the external id) will be returned in any individual level data from Nami web hooks or REST API. Nami also uses customer id to establish a cross-platform view of a subscriber for analytics reporting.
Accounts and Login/LogoutLast updated