Web application renewal payment interface


Payment process description

1434706053921_a87ff679a2f3e71d9181a67b7542122c (1).jpg

##Consumption process:

1) The user initiates payment in the App, and the App calls the SDK payment interface payFromServer

2) After the SDK confirms the payment with the Ali server, 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) The Ali server feeds back the payment result to the SDK. And notify the App server

5) The App server uses the callback order information to decide whether to issue props to App users

Network application renewal first payment


##Interface Description

public static void repayFromServer

, to implement the automatic renewal function. If the application needs to access the renewal payment interface, please contact Alibaba operation configuration is activated. The first renewal will be completed in real time through the client, and subsequent renewals will be implemented through the server of the application calling the server of Digital Entertainment. Please pay attention to the rules of the renewal interface. Calls that do not meet the rules will not be able to achieve the first payment or subsequent payments.


Preconditions:None


#Function prototype

public static void repayFromServer (String subject, String orderId, String interval, List<String> priceList, String description, final String title, final String notifyUrl, final String subjectId, final IPayListener payListener)


Parameter description

subject: Renewal product package, such as "Film and TV Monthly Subscription"

orderId: Order number, generated by the CP server

interval: Automatic renewal mode (month: monthly, season: quarterly), only supports two fixed modes; whether monthly or quarterly, only supports renewal within 1 year, that is, monthly renewal , the subsequent application server can initiate up to 11 renewal requests, and the subsequent quarterly renewal can initiate up to 3 renewal requests.

priceList: Price list, including this consumption and the consumption amount for each subsequent renewal

description (optional): end time of business rights, empty if not available

title: payment target Product, such as "xx Film and Television"

notifyUrl: After the payment is completed, the callback address of the Alibaba server to the CP server

       subjectId (optional) Product ID. If it is empty, you will not be able to participate in consumption incentive activities. It is recommended that it be required.

payListener: Callback function to notify success or failure after payment is completed.

Request example

   AliTvSdk.pay("XX商品", "12345678", "month",
                   Arrays.asList(arr), "权益描述",
                   "支付物品名称", "http://setbycp2", null, 
new IPayListener(){
                            @Override
                            public void onSuccess(String title, int amount) {
                                   TestToast.show("支付成功");
                            }
                            @Override
                            public void onError(String title, int amount, String errMsg) {
                                   TestToast.show("支付失败, 原因:" + errMsg);
                            }
                            @Override
            public void onError(String errCode, String errMsg) {
                TestToast.show(" 支付失败。" + errCode + ":" + errMsg);
            }
                            @Override
                            public void onCancel(String title, int amount) {
                                   TestToast.show("支付取消");
                            }
});


Web application renewal subsequent payment


Interface description

The merchant is using the customer After the client successfully creates the renewal sequence, it can send a renewal request to the payment background through the server.

Access method: TOP

TOPFor access guide, see

//open.taobao.com/doc2/detail.htm?spm=a219a.7629140.0.0 .jlQptD&treeId=49&articleId=101617&docType=1

TOP See the appendix for the auxiliary tool class (java).

API

##taobao.tvpay.partner. renewal.pay

Request parameter structure:

##Product Titleyes

Return infrastructure description:

##Parameter name

Parameter description

Required

##Details

partner_notify_url

##Callback address

is


#partner_order_no

The merchant order number of this order

is

price

##Price, divided into units of RMB

Yes

It needs to be the same as when the sequence was originally created, otherwise an error will be reported.

##ref_order_no

Merchant order number of the first order in the sequence

is the merchant order corresponding to the order when

is created from the sdk. Number.

Seq

Renewal serial number.

is the first seq paid on

##SDK Counted as 0, the first seq renewed from the background is 1, and so on.

##Subject

subject_id

## Product id

yes

##Prompt message or error messagedata.data

Field

##Description

Code

##success:

Success

message

Return business parameters (requires RSA method to use private key to decrypt to get json The string is parsed into structured data parameters)


##Return infrastructure sample:

{
    "tvpay_partner_renewal_pay_response":{
        "result":{
            "code":"success",
            "data":{
                "order_status":"TRADE_SUCCESS"
            },
            "message":"success",
            "success":true
        }
    }
}


If the request is successful (success is true), refer to the order_status field to verify the order status

WAIT_BUYER_PAY Waiting for buyer to pay

TRADE_SUCCESS Payment successful

TRADE_CLOSED Transaction closed

If the request fails, please refer to the error code field to analyze the cause of the error.

TERM_COUNT_EXCEED_LIMIT, too many account periods

RENEWAL_PRICE_ERROR, the amount verification failed

RENEWAL_PRICE_EXCEED_LIMIT The total renewal amount exceeds the limit

RENEWAL_ORDER_NOT_ALLOWED The application does not support renewal at the moment

RENEWAL_ORDER_INFO_ERROR The order information is incorrect

RENEWAL_THREAD_NOT_FOUND Renewal sequence not found

RENEWAL_THREAD_STATUS_ERROR Exception in renewal sequence status

RENEWAL_ORDER_PAY_FAIL Failed to pay for renewal order

RENEWAL_TIME_ERROR The renewal time has not arrived

RENEWAL_THREAD_SEQ_ERROR The renewal account period is incorrect

- -------------------------------------------------- --------------------------


Callback notification after successful payment on the server side

Interface description:

Third-party applications need to develop an HTTP service and provide the server Interface address, for example: http://Third-party application server address/XXX The digital entertainment server uses the public key (public_key) provided by the merchant to encrypt the parameters to generate an encrypted string encryptString (decrypted into json format), and provides it in the app request Add the encrypted string of this successful order information to the URL (parameter: notify_url) (the format is: notify_url?data=encryptString). The digital entertainment server will send the above information to the APP server. http request, if the return information is " success", the sending is successful. If the returned information is other, the time interval will be increased and the message will be resent.

Data decrypted data structure :

##TRADE_SUCCESS Payment successfulTRADE_CLOSED Transaction closed##buyer_logon_id

The server actively queries the order payment status

Interface Description:

Merchant You can actively query the order payment status through this interface. It is mainly used for the merchant to proactively query once after receiving a successful payment from the client to verify whether the order has been paid successfully.

Access method: TOP

For the TOP access guide, see ://open.taobao.com/doc2/detail.htm?spm=a219a. 7629140.0.0.jlQptD&treeId=49&articleId=101617&docType=1

APItaobao.tvpay.partner.order.query

Request parameter structure:

Key name(key)

##Value(value)

partner_order_no

Merchant order number

alipay_trade_no

Alipay transaction serial number

order_status

Order Status

WAIT_BUYER_PAYWaiting for buyer to pay

Payer Alipay account

Parameter name

Parameter description

Is it required?

Details

order_no

Merchant order number

is

Merchant’s own order number

##Return infrastructure description:

codemessagedata.data

Return infrastructure sample:

{
   "tvpay_partner_order_query_response": {
       "result": {
           "code": "success",
           "data": {
               "data": "PG5Qgxp5C+Muqohd7s01IE9SK/VnYVSxsY7nPqHFR8d+tjx3qLBeTu8llVi0+yaQHdMl/ZMTXxhchl9FiruOkX+GL5aN4S+/C68Tq5Os5dT4iilwNaDT6gw2pBtMUR9maVfXukcvFMLSx7d9XsjebWpapqTMgjOkMQjOHUA0GtcdgfFPE4sFxwB0+8SdbOYF1qoEkBoU8o0brd6/tFTJkqn/uJUbHOoqqLXCB3LmxShRa4m8KRsVPfSavOEjcSO7yfNTu7cLhGoOCRL5ffwLWVxyPRpaLfm0O8CJi9Cllb5nndWzh1zoXUtyBdfw9iHzbE0C7WArO5+YLKVCzA5c4A=="
           },
           "message": "success",
           "success": true
       },
       "request_id": "118g71ywn59zf"
   }
}


dataDecrypted data structure:

##Field

Description

##success: Success

Prompt message or error message

Return business parameters (requires RSA method to use private key to decrypt, get json string and parse it into structured data parameters)

##alipay_trade_noAlipay transaction serial numberorder_statusOrder statusWAIT_BUYER_PAYWaiting for buyer to pay##TRADE_SUCCESS Payment successfulTRADE_CLOSEDTrade closedpricesubjectsubject_id ##buyer_logon_id

## Key name(key)

Value(value)

partner_order_no

Merchant order number

Order price, divided into RMB units

Product title

Product id

Payer Alipay account