Alipay
Overview
Introduction
Alipay is a payment method which allows you to process payments in different currencies by using e-wallets China. This method supports purchases and refunds.
This article provides information about working with the Alipay method: general insights are presented in the Overview section, while information about the actions required to process payments and perform other actions is presented in the sections that follow.
General information
Payment method type | digital wallet payments |
Payment instruments | digital wallets |
Countries and regions | CN |
Payment currencies | AUD, CAD, CNY, EUR, GBP, HKD, JPY, SGD, USD * |
Currency conversion | – |
One-time purchases | + |
Credential-on-file purchases | – |
Full refunds | Refer to your ecommpay key account manager |
Partial refunds | Refer to your ecommpay key account manager |
Payouts | – |
Chargebacks | – |
Notes |
|
Onboarding and access fee | refer to your ecommpay key account manager; additional information is available in ecommshop |
* For information about available currencies and availability of refunds, refer to your ecommpay key account manager.
Interaction diagram
Payment processing by using the Alipay method involves the merchant's web service, one of ecommpay interfaces, the ecommpay payment platform, and technical facilities of the Alipay service.
Operations support
Various platform interfaces can be used to process payments and perform operations using the Alipay method. Purchases can be processed by using Payment Page, Gate and Dashboard (using payment links), refunds—by using Gate and Dashboard. At the same time, regardless of the interfaces used, the following properties and limitations are applicable.
When working with the Alipay the following properties and limitations are applicable.
Amounts | Times ¹ | |||
---|---|---|---|---|
minimum | maximum | basic | threshold | |
Purchases | 10.00 CNY or 1,00 USD | 5,000.00 CNY or unlimited USD | up to one hour | * |
Refunds | – | – | * | * |
* For more information refer to your ecommpay key account manager.
- The base and threshold times are defined as follows:
- The base time is the average estimated time between the moment a payment is initiated in the payment platform to the moment the payment result is sent to the web service. The base time evaluation is made on the assumption of normal operation of all technical facilities and communication channels and typical customer behaviour (if any input from the customer is required). Use the base time to estimate when to react to the absence of payment result callbacks or when to check payment status (details).
- The threshold time is the maximum possible time between the moment a payment is initiated in the payment platform to the moment the web service receives the callback with the payment result. A payment is automatically assigned the
decline
status if it wasn't processed within the threshold time. For individual customisation of the threshold time limit, contact ecommpay technical support.
Processing scenarios
To perform a purchase by using the Alipay method, you need to redirect the customer to the Alipay service, while to make a refund, you need to receive a request from the customer and notify the customer about the result of the refund via the web service.
Purchases via Payment Page
General information
To process a purchase through Payment Page by using the Alipay method, the merchant's web service is required to send a request with all required parameters and signature to the ecommpay URL and receive a callback with the result. The full sequence and special aspects of purchase processing are provided below.
Information about the formats of requests and callbacks used for processing payments by using the Alipay method via Payment Page is presented further in this section; general information about working with the Payment Page API is presented in Interaction concepts.
Request format
There are several things you need to consider when sending purchase requests by using the Alipay method:
- The following parameters required for any payment must be specified:
project_id
—project identifier obtained from ecommpay during integrationpayment_id
—payment identifier unique within the projectpayment_currency
—payment currency code in the ISO-4217 alpha-3 formatpayment_amount
—payment amount in the smallest currency unitcustomer_id
—customer identifier unique within the project
- The following parameters required for any payment must be specified:
project_id
,payment_id
,payment_currency
,payment_amount
,customer_id
. - The available currencies of purchase specify with ecommpay key account manager.
- There is one more mandatory parameter—language_code. In the language_code parameter, you must use
zh
code of Payment Page. - If you need to have the payment form displayed with the Alipay method selected, set the
force_payment_method
parameter toalipay
. - Additionally, any other parameters available for working with Payment Page can be used (details).
- After all target parameters are specified, generate a signature (details).
Thus, a correct request for opening the payment form using the Alipay method must contain the project identifier, basic payment information (identifier, amount, and currency code), customer identifier, language code and signature.
Callback format
The Alipay method uses the standard format for callbacks to deliver purchase results. For more information, see Callbacks.
The following is the example of a callback with information about a 10.00 CNY
purchase made by the 125
customer in the 201
project.
The following is the example of a callback with information about a declined purchase.
Useful links
The following articles can be useful when implementing purchases via Payment Page:
- Interaction concepts—about the interaction with the payment platform by using Payment Page.
- Signature generation and verification—about the procedure of generating and verifying signatures in requests and callbacks.
- Payment models and statuses—about the types, processing models, and possible statuses of supported payments and operations.
- One-time one-step purchase—about processing of one-time one-step purchases by using Payment Page.
- Information of operations performing—about error and response codes that are used in the payment platform to record information about performing of operations.
Purchases via Gate
General information
To process a purchase through Gate by using the Alipay method, the merchant's web service is required to do the following:
- Send a request with all the required parameters and signature to the ecommpay URL.
- Receive an intermediate callback from the payment platform and redirect the customer to the Alipay service.
- Receive the final callback from the payment platform.
The full sequence and special aspects of purchase processing are provided below.
Information about the formats of requests and callbacks used for processing payments by using the Alipay method via Gate is presented further in this section. General information about working with the Gate API is presented in Interaction concepts.
Request format
There are several things you need to consider when sending purchase requests by using the Alipay method:
- To initiate each purchase, send a separate POST request to the
/v2/payment/wallet/alipay/sale
endpoint. This endpoint belongs to the group /v2/payment/wallet/{payment_method}/sale. - Each request must include the following objects and parameters:
- Object
general
—general purchase information:project_id
—project identifier obtained from ecommpay during integrationpayment_id
—payment identifier unique within the projectsignature
—request signature generated after all required parameters are specified (details—in the Signature generation and verification) (details)
- Object
payment
—payment information:amount
—payment amount in the smallest currency unitcurrency
—payment currency code in the ISO-4217 alpha-3 formatdescription
*—description or comment to the payment
- Object
customer
—customer information:id
—customer identifier unique within the projectip_address
—customer IP address relevant for the initiated paymentfirst_name
*—customer first namelast_name
*—customer last namephone
*—customer phone number without +email
*—customer emailzip
*—customer postal codecountry
*—customer country of residence in the ISO 3166-1 alpha-2 formatcity
*—customer city of residence in Chinesestreet
*—customer address of residence in Chinese
- Object
return_url
—contains the URLs to which customer is redirected during or after payment processing:success
*—URL for redirecting a customer after a performed purchasereturn
—URL for redirecting a customer during a purchase
Note: * Refer to your ecommpay key account manager for more information on the necessity of using theses parameters. If any of these parameters are missing, the payment platform may send the list of missing parameters in a callback requesting additional information submission (details are available in Submission of additional payment information). - Object
- The available currencies of purchase specify with ecommpay key account manager.
- Additionally, any other parameters included in the specification can be used.
Thus, a correct purchase request by using the Alipay method must contain the project identifier, basic payment information (identifier, amount, and currency code), customer information, URLs for redirection and signature.
Formats of intermediate callbacks for customer redirection
To redirect a customer from the web service to the Alipay service, a callback containing redirection data is sent to the web service. Depending on the provider processing the payment a URL or a QR code can be used for customer redirection:
- URL—in this case the callback contains the
redirect_data
object - QR code—in this case the callback contains the
display_data
array
Refer to your ecommpay key account manager regarding the appropriate redirection type.
Object redirect_data
Each payment made with the Alipay method requires redirection of customers from the merchant's web service to the Alipay service. To redirect a customer it is necessary to receive an intermediate callback from the payment platform and use the information included in the redirect_data
object. The format of such callbacks is standard (details), and the following objects and parameters are included in the redirect_data
object:
body
—object with data to be sent in the request bodymethod
—parameter specifying the HTTP method for sending the request (GET
orPOST
)url
—parameter containing a link for redirection
Array display_data
To redirect a customer from the web service to the Alipay site, you must receive a callback from the payment platform containing the display_data
array. This array can contain one or more objects with the following parameters:
type
—object typetitle
—object titledata
—data corresponding to the object type
The display_data
array is formed taking into account the following conditions:
- The object containing data for displaying the QR code is always present in the array. The value of the
data
parameter depends on the value of thetype
parameter which can have one of the following values:qr_url
—QR code is passed as a link the image. In this case thedata
parameter contains a URL.qr_img
—QR code is passed as an image. In this case thedata
parameter contains a string encoded using the Base64 scheme.qr_data
—QR code is passed as a string. In this case thedata
parameter contains a string which should be used to generate a QR code on the web service side.
- In addition to the object containing the data for displaying the QR-code the
display_data
array can contain one or several objects with additional information. Thetype
parameter of such objects is assigned theadd_info
value, while thedata
parameter can contain various information. - If the array contains one or more objects with additional information, then the array includes an object with the information on the lifespan of the QR code (starting when the code is created on the Alipay side). The
title
parameter of such an object is assigned theQR Code Timeout
value, while the lifespan is specified in seconds in thedata
parameter.
The following is the callback fragment containing the string to be used to generate a QR code as well as the lifespan of the code.
Callback format
The Alipay method uses the standard format for callbacks to deliver purchase results. For more information, see Callbacks.
The following is the example of a callback with information about a 10.00 CNY
purchase made by the 125
customer in the 201
project.
The following is the example of a callback with information about a declined purchase.
Useful links
The following articles can be useful when implementing purchases via Gate:
- Interaction concepts—about the interaction with the payment platform by using Gate.
- Signature generation and verification—about the procedure of generating and verifying signatures in requests and callbacks.
- Payment models and statuses—about the types, processing models, and possible statuses of supported payments and operations.
- One-time one-step purchase—about processing of one-time one-step purchases by using Payment Page.
- Information of operations performing—about error and response codes that are used in the payment platform to record information about performing of operations.
Refunds by using Gate
General information
To perform a refund through Gate by using the Alipay method, send a request with all required parameters and signature to the ecommpay URL and receive a callback with the result. The full sequence and special aspects of refund performing are provided below.
Information about the formats of requests and callbacks used for performing refunds by using the Alipay method via Gate is presented further in this section. General information about working with the Gate API is presented in Interaction concepts.
Request format
There are several things you need to consider when sending refund requests by using the Alipay method:
- To initiate each refund, send a separate POST request to the
/v2/payment/wallet/alipay/refund
endpoint. This endpoint belongs to the group /v2/payment/wallet/{payment_method}/refund. - Each request must include the following objects and parameters:
- Object
general
—general refund information:project_id
—project identifier obtained from ecommpay during integrationpayment_id
—identifier of the payment that needs to be refundedpayment identifiersignature
—request signature generated after all required parameters are specified (details—in the Signature generation and verification)
- Object
payment
—refund information:description
—refund description or commentamount
—refund amount in the smallest currency unit (required for a partial refund)
- Object
customer
—customer information:ip_address
—customer IP address relevant for the initiated refund
- Object
- Additionally, any other parameters included in the specification can be used.
Thus, a correct refund request by using the Alipay method must contain the project and payment identifiers, description of the refund, the customer IP address, signature, and, if necessary, refund amount.
Callback format
The Alipay method uses the standard format for callbacks to deliver refund results. For more information, see Callbacks.
Useful links
The following articles can be useful when implementing refunds via Gate:
- Interaction concepts—about the interaction with the payment platform by using Gate.
- Signature generation and verification—about the procedure of generating and verifying signatures in requests and callbacks.
- Payment models and statuses—about the types, processing models, and possible statuses of supported payments and operations.
- Purchase refunds—about performing of refunds by using Gate.
- Information of operations performing—about error and response codes that are used in the payment platform to record information about performing of operations.
Testing
General information
For the Alipay method, it is possible to test purchases by using Payment Page and Gate, as well as refunds by using Gate. To enable and disable testing, as well getting assistance with setting up a test project, refer to ecommpay technical support.
When testing payments and operations keep in mind that the test project identifier must be indicated in requests, the interfaces of the emulator of Payment Page and Alipay payment forms can differ from the production environment.
Statuses of test payments and operations
The final status of test payments and operations is determined by the amount specified in the request.
Test purchases:
decline
status with40000
or40400
amountsuccess
status with any other amount
Test refunds:
decline
status with50000
or50500
amountsuccess
status with any other amount
Purchases by using Payment Page
To perform a test purchase by using Payment Page:
- Send a correct test request for opening Payment Page to the payment platform.
- If the
alipay
method was not specified in the request—select the method on the emulator page. - Make sure that the payment instructions are displayed and click the Pay button.
- Specify a random last name in the data entry field.
- Click the Success or Decline button (depending on the amount specified in the request).
- Receive the final callback with information about the payment result.
More information about processing purchases by using the Alipay method via Payment Page is provided in the Purchases via Payment Page section.
Purchases by using Gate
To perform a test purchase by using Gate, do the following:
- Send a correct test request for purchase to the payment platform.
- Receive the intermediate callback with the redirection data.
- Go to the received URL and click the Success or Decline button (depending on the amount specified in the request).
- Receive the final callback with information about the payment result.
More information about processing purchases by using the Alipay method via Gate is provided in the Purchases via Gate section.
Refunds by using Gate
To perform a test refund by using Gate, send a valid test request for a refund of a previously processed test purchase to the payment platform and receive a final callback with information about the refund result. More information about performing refunds by using the Alipay method via Gate is provided in the Refunds by using Gate section.
Analysis of payments results
To analyse information about payments made with the Alipay method and other methods, you can use:
- Dashboard interface toolkit with various lists and analytic panels.
- Reports in CSV file format, available via the Reports section (one-time and periodically).
- Data in JSON format, sent by program requests to a specified URL available by using the Data API interface.
If you have any questions, refer to the documentation (Dashboard and Using Data API) and ecommpay technical support.