react-native-simpl-sdk
v1.0.8
Published
A React Native wrapper for Simpl SDK
Downloads
21
Readme
React Native Library for SimplSdk
This project serves as a SimplSdk wrapper to create custom React Native native SimplSDK modules that can later be installed through NPM and easily be used in production.
Installation
Using npm:
npm install --save react-native-simpl-sdk
or using yarn:
yarn add react-native-simpl-sdk
Linking
Run the following command to link the SDK to Android and iOS
react-native link react-native-simpl-sdk
Add native SDK
Android
Add the following to android/app/build.gradle
:
...
repositories {
maven { url "http://maven.getsimpl.com"}
}
dependencies {
...
compile project(':react-native-android-library-simpl-sdk')
compile "com.google.android.gms:play-services-auth-api-phone:16.0.0" //Used to support SMS autoread feature. Ignore if already present.
compile "com.simpl.android:sdk:+"
}
iOS
No additional steps required.
Usage
Simply import/require
it by the name defined in your library's package.json
:
import SimplSdk from 'react-native-simpl-sdk'
//TO check either user is approved or not
SimplSdk.isApproved('<client_id>', '9123456789', '[email protected]', true,/*To test in sandbox mode*/
(result) => console.log("User approved: "+result),
(approvalError) => console.log("User approval error: "+approvalError));
//Authorise the transaction
SimplSdk.authorizeTransaction(10000/*amount_in_paise*/,"abcd1234"/*order_id*/, (transactionToken) => console.log("Transaction Token: "+transactionToken),
(authError) => console.log("Authentication error: "+authError));