Nami Public Documentation
Sign In
Nami Documentation
Nami Documentation
  • Get Started
    • Overview
      • Key Concepts
      • Data Collection
      • Built for Privacy
    • Evaluating Nami
    • SDKs
      • Apple Native SDK
      • Android Native SDK
      • Amazon Native SDK
      • Roku Native SDK
      • React Native Cross-Platform SDK
      • Flutter Cross-Platform SDK
      • Unity Cross-Platform SDK
      • Release Notes
        • Find Nami SDK Version
    • Quickstart Guide
  • Subscription Management
    • Overview
    • Products
      • Archive Products
      • Sync Products
    • Entitlements
    • Customer Screen
    • Accounts and Login/Logout
    • Advanced Use Cases
      • Upgrades and Downgrades
      • Supported Purchase Change States by Platform
      • Restoring Purchases
      • Working with Consumable IAPs
  • No Code Paywalls
    • Overview
    • Paywall Creator
      • Using the Creator
      • Paywall Layout
      • Components
        • Editing, Deleting, Reordering
        • Hiding Components
        • Video
        • Collapse
      • Editable Properties
        • Focused Styling
        • Safe Area
      • Conditions
        • Notched Devices
        • Product Entitlements
      • Adding Products
      • Repeating Product Group
      • Product Fields
      • Capabilities
        • Featured Styling
        • Selected Styling
        • Custom Brand Fonts
        • Carousel
        • Trial Eligibility
        • Deeplink Button
        • Introductory Offer Eligibility
        • Login Check
        • Product Groups
        • Conditional Product Groups
        • Offer Eligibility and Purchasing
        • Screenreader Text
        • Personalization Tokens
        • Custom Variables
        • Multipage
        • Custom Data Source
        • Advanced Video Features
        • Product Error States
      • ❓FAQs
        • Designing Paywalls in Figma
        • Guide to Building a Paywall from Scratch
      • 🎁Releases
        • Roadmap
    • Paywall Templates
      • Pacific
      • Pacific Premium
      • Trident
      • Starfish
      • Mantis
      • Venice
      • Venice Premium
      • Honest
      • Catalina
      • Oyster
      • Puffin
      • Marina
      • Beluga
      • Driftwood
      • Lagoon
      • Pisces
      • Aquarius
      • Conch
      • Lionfish
      • Moray
      • Tetra
      • Lighthouse
      • Puffin Tablet
    • Managing Paywalls
      • Archiving a Paywall
      • Duplicate a Paywall
    • Paywall Smart Text
    • Pricing Eligibility States
    • Pricing Eligibility by Platform
    • Nami Paywalls in Different Languages
    • Legacy Paywalls
  • Campaigns
    • Placements
      • Create a Placement
      • Deeplink Placements
      • Archiving a Placement
      • Managing Lots of Placements
      • Export Placements
    • Campaigns
      • Campaign Filters
        • Campaign Use Cases
      • Archiving a Campaign
      • Scheduling a Campaign
      • Campaign Conversion Events
      • Managing Lots of Campaigns
      • Campaign Troubleshooting
    • A/B and Multivariate Testing
      • Selecting an A/B test winner
      • A/B Test Allocation
  • Integrations
    • All Integrations
    • Billing Platforms
      • Apple Integration
        • App Store Setup
          • Privacy Details
        • Platform Integration
        • App Store Server Notifications
        • Store Credentials
          • App Store Connect Shared Secret
          • Apple App Store Connect API
          • Apple In App Purchase
        • Add a Product
        • Platform Sync
        • SDK Integration
        • Troubleshooting
        • Testing and Development
          • Apple Testing Environments
          • Setting up Device Sandbox Test Environment
          • Setting up StoreKit config in Xcode
      • Google Integration
        • Google Play Store Setup
        • Platform Integration
        • Service Account
        • Real-time Developer Notifications
        • Add a Product
        • Platform Sync
        • SDK Setup
        • Troubleshooting
          • Supporting Android minSdkVersion 25 or lower
          • Requested product is not available for purchase
          • Unsupported Version of Play Billing
      • Amazon Appstore Integration
        • Create Amazon Android App
        • Platform Integration
        • Shared Key
        • Real-time Event Notifications
        • Add a Product
        • SDK Integration
        • Testing
      • Roku Integration
        • Platform Integration
        • API Key
        • Transaction Notifications
        • Add a Product
        • SDK Integration
      • Web Integration
    • Analytics Tools
      • Adobe Analytics
      • Amplitude
      • Google Analytics
      • mParticle
      • 3rd-Party Analytics
    • Subscription Management
      • Nami Subscription Management
      • Bring your Own Payment Code
    • CDP Integrations
      • Adobe CDP Integration
      • Amplitude CDP Integration
      • Custom CDP Integration
      • Generic CDP Integration
    • Other Integrations
      • Wicket Labs
      • Webhooks
        • Introduction to the Nami ML Event System
        • Event Types
          • Purchase Status Updates
          • Events for Upgrades, Downgrades, and Crossgrades
        • Event Subscriptions
        • Understanding Transferred Events and Accounts
      • API Access
    • Events Feed
  • Analytics
    • Using Charts
    • Paywall Analytics
      • Impressions
      • Paywall Conversion Rate
      • Sessions
      • Active Devices
    • Subscription Analytics
      • Revenue
      • MRR
      • Purchases
      • Trial Starts
  • Nami Account
    • Manage your Apps
      • Find your Nami App Platform ID
      • Setting up Legal Text for your Apps
    • Organization
      • Configuring Organization Security Policies
      • Billing
    • Invite your Team
      • Roles
    • Manage your Account
      • Two-Factor Authentication (2FA)
Powered by GitBook
On this page
  • 1. Adding the Nami SDK
  • Installing React Native SDK Bridge
  • Configure for Apple
  • Configure for Play Store-only
  • Configure for Play Store + Amazon Appstore
  • Configure the SDK
  • 3. Launch a campaign to Show a Paywall
  • 4. Managing Purchases
  • Grant access to paid app features
  • Using your own subscription management
  • 5. Managing Identity
  1. Get Started
  2. SDKs

React Native Cross-Platform SDK

Last updated 7 months ago

Adding Nami to your app has a few steps for a basic app.

  1. Add the SDK to your project

  2. Configure the SDK

  3. Show a paywall in your app

  4. React to a purchase to grant access to paid content or features

  5. Optional: Managing Identity

1. Adding the Nami SDK

In React Native apps, the Nami SDK setup consists of two parts.

  1. Installing the React Native SDK bridge

  2. 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 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.

yarn add react-native-nami-sdk
npm install react-native-nami-sdk --save

Configure for Apple

Complete the following steps to prepare your React Native app for using Nami.

target 'TestApp' do
  platform :ios, '14.0'
  # ...
end

target 'TestApp-tvOS' do
  platform :tvos, '15.0'
  # ...
end
  1. Run cd ios && pod update

Configure for Play Store-only

  1. Edit android/build.gradle and add the native Nami SDK for Android maven repository.

allprojects {
    repositories {
        google()
        mavenLocal()
        maven { url "https://packages.namiml.com/NamiSDK/Android/"}
        maven { url 'https://jitpack.io' }
    }
}
  1. Edit android/app/build.gradle to default to the Play Store build of the Nami SDK

android {
    defaultConfig {
        missingDimensionStrategy 'store', 'play'
    }
}

Configure for Play Store + Amazon Appstore

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.

productFlavors {
    amazon {
        dimension "store"
        repositories {
            maven { url "https://packages.namiml.com/NamiSDK/Amazon/"}
        }
    }
    play {
        dimension "store"
        repositories {
            maven { url "https://packages.namiml.com/NamiSDK/Android/"}
        }
    }
}

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.

import {AppRegistry, Platform} from 'react-native';
import {Nami} from 'react-native-nami-sdk';
import App from './App';

let appPlatformIDAndroid = 'YOUR_GOOGLE_PLAY_APP_PLATFORM_ID';

if (Platform.OS == 'android' && Platform.constants.Manufacturer == 'Amazon') {
  appPlatformIDAndroid = YOUR_AMAZON_APPSTORE_APP_PLATFORM_ID';
};

let configDict = {
  'appPlatformID-apple': 'YOUR-APPLE_APP-PLATFORM-ID',
  'appPlatformID-android': appPlatformIDAndroid,
  logLevel: 'DEBUG'
};

Nami.configure(configDict);

AppRegistry.registerComponent('YourAppName', () => App);

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.

Using 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.

5. 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.

The code for the React Native bridge is also .

If you need help setting up your React Native development environment, you can find instructions here: .

Edit ios/Podfile.Confirm for each target, that the match Nami's native Apple SDK.

Also, for Amazon FireTV devices or other devices targeting minSdkVersion 25 or lower, see this for two additional steps to enable the Nami SDK to work properly. Nami supports down to minSdkVersion 22.

available on our Github
https://reactnative.dev/docs/environment-setup
minimum versions
document
Nami Subscription Management
Bring your Own Payment Code
Accounts and Login/Logout
NPM bridge module
Cover

SDK on GitHub

launchLaunch a live campaign in your app and show the assigned paywall
isCampaignAvailableReturns a boolean if a matching campaign is available on the device.