React Native SDK Setup
Fusion is equipped with a custom SDK to support react native applications and their operations at full scale. The SDK takes care of all the compliance related to card issuance, its lifecycle, operations, and provides a seamless user experience for your customers.
Prerequisites
Before beginning with the SDK setup, we’d highly recommend you take a note of the following checklists:
- You must take care of the prerequisites for the respective Android and iOS SDKs
- The SDK supports v 10.0.1 for react and v 0.64.0 for react-native frameworks
- Follow the linked guidelines to set up a react-native project
SDK Setup
This section will explain how you can integrate the SDK into your reach native project.
Step 1
Create an .npmrc
file in the project repository to access the rn-cards-sdk
. Copy the following content to the .npmrc
file created:
|
|
Step 2
Use the following command to install the SDK.
|
|
Platform Specific Setup
Perform the following steps to complete the platform specific setup for your application
Android
Step 1
Add the dependency on the private Maven Repo. This will help you get access to all the native code for Cards SDK. Add the following code under the allProjects
section of project-level build.gradle
. You can get your username and password from App Center’s SDK details page.
|
|
You can get your username and password from App Center’s SDK details page.
Step 2
Enable data binding by adding the following line under the android section of app level build.gradle
file.
|
|
Step 3
Exclude the Kotlin modules from packaging options. This can be done by adding the following code snippet to the android settings in app level build.gradle
.
|
|
Step 4
Add the following permissions to the AndroidManifest.xml
file.
|
|
Step 5
Enable multi-dex by adding the following line under defaultConfig
in the app level build.gradle
file.
|
|
Step 6
Add the assets, config, collections, and fonts provided in the SDK integration doc or app-center in the android folder.
Step 7
Add jcenter()
to the repositories under project level build.gradle
. This is necessary for react native 0.64.0 version.
|
|
Step 8(Optional troubleshooting step)
In case you face multi-dex issues, you may wish to tweak the memory settings a little. This can be done by adding the following line to gradle.properties
file.
|
|
iOS
Step 1
In the podfile, add the following snippet
|
|
Step 2
Add the assets, config(supercardSdk.plist) and the local collection files for theme, templates & shopHook configs in the app target.
Step 3
run ‘pod install’ in ExampleApp/ios/ directory and then run ‘react-native run-ios’ in the root folder or build the project from xcode.
SDK initialisation
Initialise the cards SDK using the following code
|
|
SDK Authentication & Setup
Authenticate and setup the SDK using the following piece of code
|
|