yarn add react-native-ottpay
or
npm install react-native-ottpay --save
# RN < 0.60
react-native link react-native-ottpay
# RN > 0.60
cd ios && pod install && cd ..
Manually linking the library for iOS
Drag ottpay.xcodeproj
to your project on Xcode
Click on your main project file (the one that represents the .xcodeproj
). Add libottpay.a
to your project's Build Phases
➜ Link Binary With Libraries
Manually linking the library for Android
include ':react-native-ottpay'
project(':react-native-ottpay').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-ottpay/android')
dependencies {
...
implementation project(':react-native-ottpay')
}
On top, where imports are:
import com.ottpay.OttpayPackage;
Add the OttpayPackage
class to your list of exported packages.
@Override
protected List<ReactPackage> getPackages() {
return Arrays.asList(
new MainReactPackage(),
new OttpayPackage()
);
}
Select your project. Add the following System libraries to your project's Build Phases
-> Link Binary With Libraries
:
QuartzCore.framework
CoreTelephony.framework
CoreText.framework
UIKit.framework
Foundation.framework
CoreGraphics.framework
CoreMotion.framework
CFNetwork.framework
SystemConfiguration.framework
libc++.tbd
libsqlite3.tbd
libz.tbd
Then add the AlipaySDK.framework
(under your node_modules/react-native-ottpay/ios
folder) librarie to your project's Build Phases
-> Link Binary With Libraries
If framework not found AlipaySDK
please drag the folder node_modules/react-native-ottpay/ios
to your project's Build Setting
-> Framework Search Paths
#import "IPNCrossBorderPluginAPi.h"
- (void)applicationWillEnterForeground:(UIApplication *)application {
[IPNCrossBorderPluginAPi applicationDidBecomeActive];
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
import OttPay from 'react-native-ottpay';
const payStr = 'appId=*******&mhtAmtCurrFlag=1&mhtCharset=UTF-8&mhtCurrencyType=USD&mhtOrderAmt=1&mhtOrderDetail=mhtOrderDetail&mhtOrderName=merchantTest&mhtOrderNo=20211026105613&mhtOrderStartTime=20211026105530&mhtOrderTimeOut=3600&mhtOrderType=01¬ifyUrl=http%3A%2F%2Flocalhost%3A10802%2F&payChannelType=90&mhtSignType=MD5&mhtSignature=c0fbeceaf63331b60b908d0526fc3f82';
OttPay.startPay(payStr);