The Alipay payment method specification describes the data formats used by the PaymentRequest API [[!PAYMENTREQUESTAPI]] to support payment by Alipay.

Introduction

This specification is a Alipay Payment Method Specification used by the PaymentRequest API [[!PAYMENTREQUESTAPI]] to support payment by Alipay. It is intended to provide compatibility for merchants who currently request card details from customers to ease adoption of the PaymentRequest API.

In the future, merchants should favor payment methods that provide a tokenized response.

Dependencies

This specification relies on several other underlying specifications.

Payment Request Architecture
The terms Payment Method, Payment App, and Payment Transaction Message Specification are defined by the Payment Request Architecture document [[!PAYMENTARCH]].
Payment Request API
The term PaymentRequest constructor is defined by the PaymentRequest API specification [[!PAYMENTREQUESTAPI]].
Payment Method Identifiers
The term Payment Method Identifier is defined by the Payment Method Identifiers specification [[!METHODIDENTIFIERS]].
Web IDL
The IDL in this specification is defined by Web IDL [[!WEBIDL]].

Payment Method Identifier

The following payment method identifier strings are supported by the Alipay data formats.

Identifier StringDescription
alipayAlipay

Alipay Payment flows

Payment Method Specific Data for the PaymentRequest constructor

This section describes payment method specific data that is supplied as part of the data argument to the PaymentRequest constructor.

The following is the payment method specific data used by the PaymentRequest constructor when processing Alipay Payment methods.

Payment Method Specific Data

        dictionary PaymentMethodSpecificData  {
          required DOMString service;
          required DOMString partner;
          required DOMString _input_charset;
          required DOMString sign_type;
		  required DOMString sign;
          required DOMString notify_url;

		  DOMString out_trade_no;
		  DOMString subject;
		  DOMString payment_type;
		  DOMString seller_id;
		  DOMString total_fee;
		  DOMString body;
		  DOMString goods_type;
		  DOMString it_b_pay;

        };
      

The PaymentMethodSpecificData dictionary contains the following fields:

service
The service field contains interface name which is a Fixed value.
partner
The partner field contains the merchant's account.
input_charset
The _input_charset field contains the encoding type of merchant’s website, default value is utf-8.
sign_type
The sign_type field contains the signature type.
sign
The sign field contains the signature content.
notify_url
The notify_url field contains the asynchronous notification URL.
out_trade_no
The out_trade_no field contains the unique order number in merchant website.
subject
The subject contains the key word for the merchandise,transaction, order etc.
payment_type
The payment_type field contains the payment type.
seller_id
The seller_id field contains the seller's account.
total_fee
The total_fee field contains the total amount of an order (RMB). Value range is [0.01, 100000000.00].
body
The body field contains the description information of one transaction.
goods_type
The goods_type field contains the merchandise type. 1: physical; 0: virtual.
it_b_pay
The it_b_pay field contains the time out value for unfinished transaction.

Payment Method Response

The AlipayResponse dictionary contains the response from the PaymentRequest API when a user accepts payment with a Alipay payment method.

AlipayPaymentResponse

        dictionary AlipayPaymentResponse {
          required DOMString success;
          required DOMString notify_id;
          required DOMString notify_time;
          required DOMString notify_type;
		  required DOMString sign_type;
          required DOMString sign;
		  
		  DOMString out_trade_no;
		  DOMString subject;
		  DOMString payment_type;
		  DOMString trade_no;
		  DOMString trade_status;
		  DOMString seller_id;
		  DOMString seller_email;
		  DOMString buyer_id;
		  DOMString buyer_email;
		  DOMString total_fee;
		  DOMString quantity;
		  DOMString price;
		  DOMString body;
		  DOMString gmt_create;
		  DOMString gmt_payment;
		  DOMString refund_status;
		  DOMString gmt_refund;

        };
      

The AlipayPaymentResponse dictionary contains the following fields:

success
The success field contains indication whether the transaction is successful.
notify_id
The notify_id field contains the notification ID.
notify_time
The notify_time field contains the notification time.
notify_type
The notify_type field contains the notification type.
sign_type
The sign_typefield contains the signature type.
sign
The signfield contains the signature content.
out_trade_no
The out_trade_no field contains the order number in merchant website.
subject
The subject field contains the key word for the merchandise,transaction, order etc .
payment_type
The paymentfield contains the payment_type .
trade_no
The trade_nofield contains the order number of the transaction.
trade_status
The trade_status field contains the trade status.
seller_id
The seller_id field contains seller's account.
seller_email
The seller_email field contains the seller's email.
buyer_id
The buyer_id field contains the buyer ID to indentify the buyer's account.
buyer_email
The buyer_email field contains the buyer's email.
total_fee
The total_fee field contains total amount of an order (RMB).
quantity
The quantity field contains the quantity of the merchandise.
price
The price field contains the price of merchandise.
body
The body field contains description of the merchandise.
gmt_create
The gmt_create field contains the time of the creation of the transaction.
gmt_payment
The gmt_payment field contains time of the payment.
refund_status
The refund_status field contains the status of refund.
gmt_refund
The gmt_refund field contains the time of refund.