Web application renewal payment interface
Payment process description
##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
:
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:
##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 | ##Product Title||||||||||||||||||||||||||||||||||||
subject_id | ## Product id | yes |
|
Field | ##Description |
Code | ##success: Success |
message | ##Prompt message or error 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 :
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:
##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) |
## Key name(key) | Value(value) |
partner_order_no | Merchant order number |
Alipay transaction serial number | |
Order status |
|
Order price, divided into RMB units | |
Product title | |
Product id | ##buyer_logon_id |
Payer Alipay account |