Asiapay react native library
React Native 0.60.0+ XCode 12+ iOS 10+ Android SDK 17+
iOS: 2.6.02 Android: 2.2.7
npm install react-native-asiapay
yarn add react-native-asiapay
pod install
- Add
#import <AP_PaySDK/AP_PaySDK.h>
to yourAppDelegate.m
- Add
[[PaySDK shared] processOrderWithUrl:url];
to- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
Add flatDir { dirs "$rootDir/../node_modules/react-native-asiapay/android/libs" }
to android/build.gradle
Inside
allprojects {
repositories {
....
}
}
Android
Put your public key file in android/app/src/main/assets/paysdk.properties
iOS
Put your public key file in android/app/src/main/assets/paysdk.properties
import Asiapay from "react-native-asiapay";
// Config environment and merchant id at the beginning of your app
Asiapay.setup('Production' | 'Sandbox', 'merchant id');
// Make payment
Asiapay.alipay('price', 'HKD', 'transaction id', 'Remark')
.then(s => {
// Successfully capture payment from Alipay
})
.catch(({ code, message }) => {
// Failed with error
});
Check https://github.com/asiapay-lib/ for more details
- Ensure the bug was not already reported by searching on Gihub under https://github.com/onecharge-ev/react-native-asiapay/issues
- If you're unable to find an open issue addressing the problem, open a new one. Be sure to include a title and clear description, as much relevant information as possible, and a code sample or an executable test case demonstrating the expected behavior that is not occurring.
- Open a new GitHub pull request with the patch.
- Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.
- Open a new GitHub pull request with the new updates.