Add Invitereferrals Library to your Project

npm install react-native-invitereferrals

Link library to Project

react-native link react-native-invitereferrals


Note: React Native 0.59.0 Older & Not Using Cocoapods.

  • If you are not using Cocoapods & react-native link react-native-invitereferrals does not work.

  • Then you have to manually link the library

    A. Open node_modules/react-native-invitereferrals/ios
    B. Drag and drop RNInvitereferrals.xcodeproj into XCode project folder Libraries

Cocoapods Install

React Native 0.60.0 or higher & Using Cocoapods.
Run this command from terminal

cd ios && pod install && cd ..

Initialize Sdk

1. Configure your info.plist

 * Open info.plist of your project as source code (right click on info.plist and click on    Open as >> Source code) and add the following code in it.


  • You can simply open the info.plist and add the keys which works as same as above for this.

    1.1. Add a new row by going to the menu and clicking Editor > Add Item. Setup a NSAppTransportSecurity as a Dictionary.

    1.2. Added a Subkey called NSAllowsArbitraryLoads as Boolean and set its value to YES as in the following image.

1.3. Add a new row again and set up a URL Types item by adding a new item. Expand the URL Types key, expand Item 0, and add a new item, URL schemes. Fill in “appScheme” for Item 0 of URL schemes and your company identifier for the URL Identifier. Your file should resemble the image below when done.

1.4 Add a new row again and set up a LSApplicationQueriesSchemes as an Array. Fill in “whatsapp” for Item 0 , “fb” for item 1 and “twitter” for item 2 as in the following image.

2. App Delegate Initialization

  • Include the header file in each .m file .
#import "RNInvitereferrals.h"
  • Initialize the sdk in didFinishLaunchingWithOptions function.
[ RNInvitereferrals setupWithBrandId: BRANDID encryptedKey: @”ENCRYTEDKEY” ];

// Example:
//       -(BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:                          (NSDictionary*)launchOptions {
//          [RNInvitereferrals setupWithBrandId: 27XXX encryptedKey:                                                            @"685B3E09241XXXXXXXXXXXXXXXXXXXXXX"];
//          }



In the above example, Dummy Brand ID and Encryption keys shown. Kindly login your IR_account to see your credentials.

  • Add the following function in your AppDelegate file. openURL function that will check the deep linking and open your app from URL Scheme.
-(BOOL)application:(UIApplication*)app    openURL:(NSURL*)urloptions:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
    [RNInvitereferrals OpenUrlWithApplication: app Url: url];
    return YES;

Plugin Methods

  • To use plugin functions import module on your react page.
import Invitereferrals from 'react-native-invitereferrals';

Add Referral Button

  • Add the following line in your custom button click. Replace CampaignID with the id of the referral campaign. Default campaignID will be applied if no campaignID specified.
Invitereferrals.inline_btn(“campaignID” );

// Example:-
//      Invitereferrals.inline_btn(“1765”);



  • For​ ​Default​ ​Campaign​ ​you​ ​can​ ​pass​ ​0​ ​as​ ​CampaignID:

Pass User Details for Auto-Login (Single Sign In)

Invitereferrals.userDetails((String)name, (String)email, (String)mobile, (String)campaignID, (String)subscriptionID, (String)customValues, callback);
// Example:
//      Invitereferrals.userDetails("abc", "[email protected]", "9876543210", “0”, null, null, this.successCallback  );


Callback function be like this:

alert(“success msg= ”+ msg);

Tracking Install / Register / Sale Events

  • You call tracking() method to track events (i.e. install , register or sale):


invitereferrals.tracking(“install”,null,”0”, null, null);


invitereferrals.tracking(“register”,(String)EMAIL_ID,(String)PURCHASE_VALUE, null, null, successCallback, errorCallback);
// Example:
//  invitereferrals.tracking(“register”,”[email protected]”,”0”, null,        null, this.funSuccess, this.funError);


Success and Error Callback

alert(“success msg = ”+msg);
alert(“error msg = ”+msg);


invitereferrals.tracking(“sale”,(String)ORDER_ID,(String)PURCHASE_VALUE, null, null, successCallback,  errorCallback);
// Example:
//      invitereferrals.tracking(“sale”,“abc123”,“99”, null, null,this.funSuccess, this.funError);

Show Welcome Message

  • Show​ ​welcome​ ​message​ ​to​ ​customer​ ​if​ ​he​ ​comes​ ​through​ ​referral​ ​of​ ​his​ ​friend.

Show Refer a friend Popup

  • Just add the following line in the activity in which you want to show the referral program popup
// Example: 
//      Invitereferrals.invite("home");