Shanghai AllPay Technology Co., Ltd.
AllPay provides access plug-ins (hereinafter referred to as "SDK") for customers based on mobile APP payments to help customers achieve fast, secure and centralized access to payment channels.
The merchant gateway sends the order information to the AllPay gateway, and the AllPay gateway processes the transaction serial number, ie tn, back to the merchant gateway, and tn is used as a parameter to adjust the mobile app payment control. Please refer to the specific AllPay Gateway Docking Document
Start the interface of the payment control, the interface is defined as follows:
public static void pay(Activity activity,String tn,boolean mode)
::: tip Parameter Description activity - Active object used to initiate the payment control.
tn - Transaction serial number. Required parameter for app payment. Merchants get from the AllPay backend.
mode - AllPay background environment ID, true means to initiate a transaction from the AllPay formal environment, false means to initiate a transaction from the AllPay test environment. :::
1.Copy allpaysdk.arr to the project's libs.
2.Add compile(name: 'allpaysdk', ext: 'aar') under the dependencies of the build.gradle file in the Application Module.
3.Add in the build.gradle file of the Application Module
repositories {
flatDir {
dirs 'libs'
}
}
Call the payment control in the following way:
/**
* tn - Transaction serial number. Required parameter for app payment. Merchants get from the AllPay backend.
* false represents the test environment, true represents the formal environment.
*/
AllPayEngine.Pay(ShopCartActivity.this, tn, false);
After the payment is completed, obtain the payment control payment result, and add the corresponding processing logic, just implement the onActivityResult() method in the Activity, and the example code is as follows:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (data == null) {
return;
}
if (requestCode == AllPayConst.VTPAY_PAY_REQUESR_CODE&& resultCode == AllPayConst.VTPAY_PAY_RESULT_CODE) {
String result = data.getExtras().getString("pay_result");
}
}
pay_result, which is a json string, in the following format:
{
"state": "cancel",
"paymentSchema": "UP",
"orderNum": "604337497032",
"errorDetail": "user cancel operation "
}
Message description:
Add in the dependencies of the build.gradle file in the Application Module
compile 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:+'
1.Copy alipaySdk.arr to the project's libs.
2.Add in the dependencies of the build.gradle file in the Application Module
compile(name: 'alipaySdk', ext: 'aar')
If you have problems debugging, please contact us: support@allpayx.com