Stand-alone application payment interface


Payment process description

1434706071200_e4da3b7fbbce2345d7772b0674a318d5.jpg

Consumption process:

1) The user initiates payment in the App and calls the interface public static void pay

2) SDK and Ali server After the payment is confirmed, the payment page is displayed to the user

3) After the user confirms the payment, the SDK initiates and completes the payment to the Ali server

4) AliThe server will feed back the payment results to the SDK

5) SDK The payment status is returned in the callback

6) App decides whether to issue props to App users based on the callback status


Single machine application payment interface

Interface description:

Single machine App calls the payment interface public static void pay
The App client determines whether the props are issued through the callback status

Preconditions:None

Function prototype :

public static void pay(String title,String subjectId, String amount, IPayListener payListener
Parameter description:

title: The name of the payment item, such as "Gem ”

subjectId product ID (used to mark products participating in incentive activities, customized by CP) Optional

amount: RMB “points” (such as amount = 100, representing 1 yuan)

payListener: callback function, notifies success or failure after payment is completed.

Request example:

Stringamount =“1”;
             String title ="支付人民币0.01元";
             AliTvSdk.pay(title,subjectId,amount,newIPayListener() {
                    @Override
                    publicvoidonSuccess(String title,intamount) {
                           TestToast.show("支付成功");
                    }
                    @Override
                    publicvoidonError(String title,intamount, String errMsg) {
                           TestToast.show("支付失败,原因:"+ errMsg);
                    }
                    @Override
                    publicvoidonCancel(String title,intamount) {
                           TestToast.show("支付取消");
                    }
});