Support A+ Rewards Mini Program JSAPI
As getAuthCode and tradePay have already been integrated for payment, in order to allow A+Rewards reuse both jsapi, you need to perform the following steps:
Android
Step 1. Add Jsapi file to your project
- Add the alipayplusjsapi (the .arr file) to the libs folder of your project.
- Add the following code to the build.gradle file of your module.
copy
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar", "*.aar"])
}
Step 2. Set up the JSAPI
copy
IAPConnect.init(this, initConfig, new InitCallback() {
@Override
public void onSuccess() {
AlipayPlusClientJSAPI.getInstance().setUp();
}
@Override
public void onFailure(InitErrorCode initErrorCode, String s) {
Log.d(TAG, s);
}
});
IOS
Step 1. Add Jsapi file to your project
Add the MPPAlipayPlusClientJSAPI file to the Build Phases -> Link Binary with Libraries of the project.
Step 2. Set up the JSAPI
copy
IAPConnectClient.sharedInstance()?.initWithContext(config, success: {
MPPAlipayPlusClientJSAPI.setUp()
}, failure: { (error, errorMessage) in
})