SDK overview
Order payment
Obtain SDK version number
Express pay SDK API on Android platform is shown in the following table:
API name | API description |
PayTask | SDK provides object APIs of payment and inquiry. |
PayTask object mainly provides sellers with order payment function and obtains current SDK version number.
Order payment
Method name: payTask.pay
Method prototype: PayTask payTask = new PayTask (activity); payTask.pay (orderInfo, true);
Method function: payTask.pay provides sellers with order payment function.
Method parameters: Examples using PayTask with parameter activity.
Parameter name | Parameter description |
String orderInfo | Mainly includes sellers' order information, key=“value” form, and uses & to connect. |
boolean isShowPayLoading | Users click to pay inside seller's app, whether loading is needed or not as transition before opening Alipay app, set this value as true, a loading will be directly opened when calling for pay API, until H5 payment page or Alipay app payment page opens. (Suggest to set this value as true, to optimise the transition process from click-to-pay to payment page.) |
An example of payment parameters is shown below - please see "Request Parameters Description" for more details on parameters:
partner="2088101568358171"&seller_id="xxx@alipay.com"&out_trade_no="0819145412-6177"&subject="test"&body="testtest"&total_fee="0.01"¤cy="USD"&forex_biz="FP"¬ify_url="http://notify.msp.hk/notify.htm"&service="mobile.securitypay.pay"&payment_type="1"&_input_charset="utf-8"&it_b_pay="30m"&sign="lBBK%2F0w5LOajrMrji7DUgEqNjIhQbidR13GovA5r3TgIbNqv231yC1NksLdw%2Ba3JnfHXoXuet6XNNHtn7VE%2BeCoRO1O%2BR1KugLrQEZMtG5jmJIe2pbjm%2F3kb%2FuGkpG%2BwYQYI51%2BhA3YBbvZHVQBYveBqK%2Bh8mUyb7GM1HxWs9k4%3D"&sign_type="RSA"
Returned value:Returned result called by this method, see "synchronous response parameter" for parameters description". The typical string format for returned result is shown as below:
resultStatus={9000};memo={};result={partner="2088101568358171"&seller_id="xxx@alipay.com"&out_trade_no="0819145412-6177"&subject="test"&body="testtest"&total_fee="0.01"¤cy="USD"&forex_biz="FP"¬ify_url="http://notify.msp.hk/notify.htm"&service="mobile.securitypay.pay"&payment_type="1"&_input_charset="utf-8"&it_b_pay="30m"&success="true"&sign_type="RSA"&sign="hkFZr+zE9499nuqDNLZEF7W75RFFPsly876QuRSeN8WMaUgcdR00IKy5ZyBJ4eldhoJ/2zghqrD4E2G2mNjs3aE+HCLiBXrPDNdLKCZgSOIqmv46TfPTEqopYfhs+o5fZzXxt34fwdrzN4mX6S13cr3UwmEV4L3Ffir/02RBVtU="}
Note:
Returned result needs to use value of resultStatus and result fields to determine the payment result. When verifications of resultStatus=9000, and success="true", as well as sign="xxx" are passed, payment is successfully. Other outcomes will be regarded as failure. For circumstances of low security level, payment result can be decided by checking resultStatus and success="true" only.
The only difference on the returned result between Android platform and iOS platform is the key of resultStatus; the returned result of iOS is ResultStatus (the initial letter is capitalized in order to be compatible with historical versions), while that of Android platform is resultStatus.
Obtain SDK version number
Method name: payTask.getVersion
Method prototype: PayTask payTask = new PayTask (activity); payTask.getVersion();
Method function: obtain current SDK version number
Method parameters: Instantiate PayTask, and pass instance of parameter activity.
Returned value: String type value, e.g. "2.0.0".