This project serves as a wrapper for Simpl Zero Click native sdk.
Using npm:
npm install --save react-native-simpl-zero-click-sdk
or using yarn:
yarn add react-native-simpl-zero-click-sdk
Run the following command to link the SDK to Android and iOS
react-native link react-native-simpl-zero-click-sdk
Add the following to android/app/build.gradle
:
...
repositories {
maven { url "http://maven.getsimpl.com"}
}
dependencies {
...
compile project(':react-native-simpl-zero-click-sdk')
compile "com.simpl.android:zeroClicksdk:+"
}
If you are using Cocoapods, Add native ZeroClick SDK to your Podfile
pod 'react-native-simpl-zero-click-sdk', :podspec => '../node_modules/react-native-simpl-zero-click-sdk/react-native-simpl-zero-click-sdk.podspec'
Then run,
pod install
If you are not using Cocoapods, Link the Framework from here manually.
import SimplSdk from 'react-native-simpl-zero-click-sdk'
// To check either user is approved or not
SimplSdk.isUserApproved({merchantId: '<merchant id>', isSandbox: true, phone_number: '<phone_number>', email: '<email>', params: { amount_in_paise: 1000 }},
(approved, isFirstTransaction, buttonText) => console.log(approved)),
(errorMessage) => console.log(errorMessage));
//To generate zero-click token
SimplSdk.generateZeroClickToken((token) => console.log(token), (errorMessage) => console.log(errorMessage))
//To open redirection URL
SimplSdk.openRedirectionURL(urlString, (successMessage) => console.log(successMessage), (errorMessage) => console.log(errorMessage));
//To generate Fingerprint
SimplSdk.generateFingerprint('<merchant_id>', '2212345678', 'email@example.com',
{ sample_merchant_param1: 'value1', sample_merchant_param2: 'value2', sample_merchant_param3: 'value3' },
(fingerprint) => {
console.log(fingerprint)
})
Sample project can be found here