Alipay
Overview
Alipay — payment method to perform purchases via e-wallets in China. Purchases are processed by using Payment Page and Gate, refunds are processed by using Gate.
General information
Payment method type | digital wallet payments |
Payment instruments | digital wallets |
Countries and regions | China |
Payment currencies | AUD, CAD, CNY, EUR, GBP, HKD, JPY, SGD, USD * |
Currency conversion | – |
Purchases | + |
Payouts | – |
Stored credentials payments | – |
Full refunds | Refer to your ecommpay Key Account Manager |
Partial refunds | Refer to your ecommpay Key Account Manager |
Chargebacks | – |
Notes |
|
Onboarding and access fee | Refer to your ecommpay Key Account Manager |
* For information about available currencies and availability of refunds, refer to your ecommpay Key Account Manager.
Interaction diagram
Payment processing by using the Alipay payment method requires merchant's web service, one of ecommpay interfaces, and the ecommpay payment platform, as well as provider's the technical facilities.
The following diagram provides the overall picture of interactions between different modules of the ecommpay payment platform and other systems that take place within the payment processing procedure.
Figure: Operation diagram
Operations support
Interfaces | Amounts | Times** | ||||||
---|---|---|---|---|---|---|---|---|
Payment Page | CMS Plug-ins | Gate | Dashboard | minimum | maximum | basic | threshold | |
Purchases | + | – | + | – | 10.00CNY or 1,00 USD | 5,000.00 CNY or unlimited USD | up to one hour | * |
Full refunds* | – | – | + | – | – | – | * | * |
Partial refunds* | – | – | + | – | – | – | * | * |
* For more information refer to your ecommpay Key Account Manager.
** The basic and threshold times are defined as follows:
- The basic 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 initiator. The basic 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 customer is required). Use the basic time to estimate when to react to the absence of payment result notifications or when to check payment status.
- The threshold time is the maximum possible time between the moment a payment is initiated in the payment platform to the moment the initiator receives the callback with the payment result. A payment is automatically declined, if its waiting time exceeds the threshold time. For individual setting of the threshold time limit, contact ecommpay technical support.
Processing scenarios
In the Alipay method, purchase involves customer redirection to the Alipay service,while refund is performed with the notification of a customer via web service.
Figure: Payment via Payment Page
Figure: Payment via Gate
Figure: Refund via Gate
The sections that follow provide detailed information about what you need to perform payments and how you can analyse the information on payments and operations.
Purchase via Payment Page
General information
In the Alipay method, to perform a purchase by using Payment Page, the merchant web service should send a request with all the required parameters and signature to the ecommpay URL and get the callback with the payment result from the payment platform. When opening Payment Page, you can have Payment Page opened with the Alipay method selected. For more information about preselecting payment methods, see in Preselecting payment methods.
The full sequence and particularities of the purchase process are provided below.
Figure: Purchase sequence when using Payment Page
- Customer initiates payment by using the web service.
- The merchant web service sends to the specified ecommpay URL the payment request for processing the payment by using Payment Page.
- The payment platform receives the request for processing the payment by using Payment Page.
- The payment platform performs the initial request processing that involves validation of the required parameters and signature.
- Payment Page is generated into the ecommpay payment platform as specified in the project settings and the request parameters.
- The payment form is displayed to the customer.
- The customer selects Alipay payment method and agrees to use the method (or accepts the method already selected on the form and agrees).
- The payment platform receives the payment request for payment processing in the Alipay service.
- The payment platform performs the internal payment request processing and sends it to the Alipay service.
- The payment request is processed on the Alipay side.
- The Alipay service generates the data for redirecting the customer to the Alipay form and sends it to the payment platform.
- The payment platform sends to Payment Page the data for redirecting the customer to the Alipay service.
- The customer is redirected to the Alipay service.
- The customer completes required steps to perform purchase.
- The payment is processed on the Alipay side.
- The Alipay service sends the payment result notification to the payment form.
- The payment platform sends the callback to the web service.
- The payment platform sends payment results to Payment Page.
- A page with the payment result information is displayed to the customer.
The sections that follow discuss in more details the request format and the Payment Page parameters to use in the Alipay payment method and provide the information on the format of callbacks with payment results. For the general information on how to use the API, see Payment Page API Description.
Request format
There are several things you must consider when using the Alipay method:
- You must provide values for the basic minimum of parameters. Listed below are the parameters that are mandatory for any payment method:
- customer_id—the unique ID of the customer within your project
- project_id—the project ID obtained from ecommpay
- payment_id—payment ID unique within the project
- payment_currency—payment currency in ISO-4217 alpha-3 format
- payment_amount—payment amount in minor units
- 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 payment form displayed with the Alipay method selected, set the force_payment_method parameter to
alipay
. - If required, you can also add any other additional parameters Payment Page supports.
- After you specify all the parameters you need, you must create the signature for the request. For instructions on how to sign a payment request, see Signature generation and verification.
Thus, a correct payment request in the Alipay method must include project, customer and payment IDs, language code, the currency and the amount of a payment in the appropriate currency, as shown in the following example:
EPayWidget.run( { customer_id: '123', project_id: 0, payment_id: 'X03936', payment_amount: 20000, payment_currency: 'CNY', language_code: 'zh', signature: "kUi2x9dKHAVNU0FYldJrxh4yo+52Kt8KU+Y1Y4HASCQ9vySO\/RLCvhtT4DqtVUkDJrOcZzUCwX6R\/ekpZhkIQg==" } )
For information about all parameters available in the Alipay method, see Parameters for opening payment form.
Callback format
The Alipay method uses the standard format for callbacks to deliver purchase results. For more information, see Callbacks.
Figure: Example of a successful purchase callback
{ "project_id": 201, "payment": { "id": "ECT_TEST_155125514200636", "type": "purchase", "status": "success", "date": "2019-02-27T16:01:25+0000", "method": "alipay", "sum": { "amount": 1000, "currency": "CNY" }, "description": "ECT_TEST_1551255142006" }, "customer": { "id": "125" }, "operation": { "id": 20891000000045, "type": "sale", "status": "success", "date": "2019-02-27T16:01:25+0000", "created_date": "2019-02-27T15:46:21+0000", "request_id": "85d4801f8fa9dead54d315ae1945cebd734eeefc-288c556dc98db902179219cecb4550201cdcafab", "sum_initial": { "amount": 1000, "currency": "CNY" }, "sum_converted": { "amount": 1000, "currency": "CNY" }, "provider": { "id": 1189, "payment_id": "Abe9VAEokJyIqyRcX10TLkz30XQbmK3f", "date": "2019-02-27T16:01:24+0000", "auth_code": "" }, "code": "0", "message": "Success" }, "signature": "T/v8rquB+C0K7TR7sz1vvOrpCsV1/hr9LE0TciPhiQW/cTwYnkyJvMjXKcrzgAET24a4XeZFoJhIh27fY9PF7Q==" }
Here is an example of callback with an information about successful 10.00 CNY
purchase made by the 125
customer in the 201
project.
Figure: Example of a declined purchase callback
{ "id": "ECT_TEST_1551103453746538344", "type": "purchase", "status": "decline", "date": "2019-02-27T14:41:30+0000", "method": "alipay", "sum": { "amount": 10000, "currency": "CNY" }, "description": "" }, "operation": { "id": 20370000000023, "type": "sale", "status": "decline", "date": "2019-02-27T14:41:30+0000", "created_date": "2019-02-26T13:39:44+0000", "request_id": "36e07e85504ec76924435475b3544d1481b7f2aa-6ebfdf066073a2e1b967e22b3d6e59e5d5066ebb", "sum_initial": { "amount": 10000, "currency": "CNY" }, "sum_converted": { "amount": 10000, "currency": "CNY" }, "provider": { "id": 1189, "payment_id": "g4Ld5b6iSuzTmukZUj1RVkXNMuYSj07I", "date": "2019-02-27T14:41:29+0000", "auth_code": "" }, "code": "20105", "message": "Insufficient funds on customer account" }, "signature": "EezTcWDrcp8RW2Wb+bLmytXR+qczUZltlNDlBvJYGj2voXt1J9W6K+dZmmuOod7K9HNUqox9BRWctzaanCrzhw==" }
Here is an example of callback for a purchase rejected due to insufficient funds on customer account.
Related topics
The following topics might be useful when implementing payments through Payment Page:
Purchase via Gate
General information
In the Alipay method, when processing a purchase by using Gate, the merchant web service is required to do the following:
- Send a request with all the required parameters and signature to the ecommpay URL.
- Perform redirecting customer to the Alipay service.
- Get the callback with the payment result from the payment platform.
Figure: Purchase sequence when using Gate
- Customer initiates payment on the merchant web service by using Alipay payment method.
- The web service sends the request for processing the payment by using Gate to the specified ecommpay URL.
- The payment platform receives the request for processing the payment by using Gate.
- The payment platform performs the initial request processing that includes validation of the required parameters and signature.
- The payment platform sends to the web service response with request receipt confirmation and correctness check result. For more information, see Response format.
- The payment platform performs the internal payment request processing and sends it to the Alipay service.
- The payment request is processed on the Alipay side.
- The Alipay service generates the data for redirecting the customer to the Alipay service and sends it to the payment platform.
- The payment platform sends to the web service data for redirecting the customer to the Alipay service.
- The customer is redirected to the Alipay service.
- The customer completes required steps to perform purchase.
- The payment is processed on the Alipay side.
- The Alipay service sends the payment result notification to the payment form.
- The payment platform sends the callback to the web service.
- The customer receives the payment result from the web service.
The sections that follow discuss in more details the request format and the Gate parameters to use in the Alipay payment method and provide the information on the format of callbacks with purchase results.
Request format
There are several things you must consider when using purchase requests in the Alipay method:- You send purchase requests by sending the
/v2/payment/wallet/alipay/sale
request by using HTTP method POST. This is e-wallet request group: /v2/payment/wallet/{payment_method}/sale. - The following objects and parameters must be specified in the request:
- general—object that contains general purchase information:
- project_id—the project ID obtained from ecommpay
- payment_id—payment ID unique within the project
- signature—signature created after you specify all the required parameters. For more information about signature generation, see Signature generation and verification
-
customer—object that contains customer information:
- id—the unique ID of the customer within your project
- ip_address—customer IP address
- first_name*— first name
- last_name*— last name
- phone*—phone number without +
- email*—customer email
- zip*—postcode
- country*—country of residence in the ISO 3166-1 alpha-2 format
- city*—city of residence in Chinese
- street*—address of residence in Chinese
- payment—object that contains purchase information:
- amount—purchase amount
- currency—purchase currency
- description*—description or comment to the payment
- return_url—URL for customer returning from the bank site:
- return—site URL for returning
- success*—URL for returning after performed payment
Note: * Refer to your ecommpay key account manager for more information on the necessity of using theses parameters. If at least one of these parameters needs to be specified and was not included in the request, the payment platform requires additional data and the corresponding procedure is used—Submission of additional payment information. - general—object that contains general purchase information:
- The available currencies of purchase specify with ecommpay key account manager.
- If required, you can also add any other additional parameters Gate supports.
Thus, a correct payment request in the Alipay method must include general information about request, as well as customer and payment information:
Figure: Purchase request example
{ "general": { "project_id": 201, "payment_id": "ECT_TEST_155125514400636", "signature": "cMlzFj8zqZJbum1wysO3wE0qLdboEYQAteO62aewWX7xcG+Ttb0fhuenWNptFZg==" }, "customer": { "id": "123", "ip_address": "111.193.57.157", "first_name": "之的", "last_name": "张", "phone": "13632264148", "email": "2524243674@example.com", "street":"street", "city": "city", "zip": "123045608", "country": "CH" }, "payment": { "amount": 1000, "currency": "CNY", "description": "payment" }, "return_url": { "return": "http://example.com/return", "success": "http://example.com/success" } }
Formats of the customer redirection data
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
To redirect a customer from the web service to the Alipay site, you must receive a callback from the payment platform containing the URL for redirection in the redirect_data.url parameter and data to be sent in the request body in the redirect_data.body parameter, and use these parameters when opening the HTML page using the method specified in the redirect_data.method parameter. The data in redirect_data.body may be differ depending on the payment processing provider.
The following is the callback fragment containing the redirection data.
"redirect_data": { "method": "POST", "body": { "order_no": "29895000000582", "amount": "13.00", "payment_channel": "ALIPAY", "sign": "****************", "return_url": "https://site.com/process/wsid=pls2vp8vrcmdj95nhnjf2h9cd3", "signType": "RSA", "currency": "CNY", "body": "ECT_TEST_1552972940011", "app_id": "4391" }, "encrypted": [], "url": "https://test.com:443/payment/otoSoft/v3/h5.html" }
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.
"display_data": [ { "type": "qr_data", "title": "QR code", "data": "weixin://wxpay/bizpayurl?pr=dMrSpJG" }, { "type": "add_info", "title": "QR Code Timeout", "data": "600" } ]
Callback format
The Alipay method uses the standard format for callbacks to deliver purchase results. For more information, see Callbacks.
Figure: Example of a successful purchase callback
{ "project_id": 201, "payment": { "id": "ECT_TEST_155125514200636", "type": "purchase", "status": "success", "date": "2019-02-27T16:01:25+0000", "method": "alipay", "sum": { "amount": 1000, "currency": "CNY" }, "description": "ECT_TEST_1551255142006" }, "customer": { "id": "125" }, "operation": { "id": 20891000000045, "type": "sale", "status": "success", "date": "2019-02-27T16:01:25+0000", "created_date": "2019-02-27T15:46:21+0000", "request_id": "85d4801f8fa9dead54d315ae1945cebd734eeefc-288c556dc98db902179219cecb4550201cdcafab", "sum_initial": { "amount": 1000, "currency": "CNY" }, "sum_converted": { "amount": 1000, "currency": "CNY" }, "provider": { "id": 1189, "payment_id": "Abe9VAEokJyIqyRcX10TLkz30XQbmK3f", "date": "2019-02-27T16:01:24+0000", "auth_code": "" }, "code": "0", "message": "Success" }, "signature": "T/v8rquB+C0K7TR7sz1vvOrpCsV1/hr9LE0TciPhiQW/cTwYnkyJvMjXKcrzgAET24a4XeZFoJhIh27fY9PF7Q==" }
Here is an example of callback with an information about successful 10.00 CNY
purchase made by the 125
customer in the 201
project.
Figure: Example of a declined purchase callback
{ "id": "ECT_TEST_1551103453746538344", "type": "purchase", "status": "decline", "date": "2019-02-27T14:41:30+0000", "method": "alipay", "sum": { "amount": 10000, "currency": "CNY" }, "description": "" }, "operation": { "id": 20370000000023, "type": "sale", "status": "decline", "date": "2019-02-27T14:41:30+0000", "created_date": "2019-02-26T13:39:44+0000", "request_id": "36e07e85504ec76924435475b3544d1481b7f2aa-6ebfdf066073a2e1b967e22b3d6e59e5d5066ebb", "sum_initial": { "amount": 10000, "currency": "CNY" }, "sum_converted": { "amount": 10000, "currency": "CNY" }, "provider": { "id": 1189, "payment_id": "g4Ld5b6iSuzTmukZUj1RVkXNMuYSj07I", "date": "2019-02-27T14:41:29+0000", "auth_code": "" }, "code": "20105", "message": "Insufficient funds on customer account" }, "signature": "EezTcWDrcp8RW2Wb+bLmytXR+qczUZltlNDlBvJYGj2voXt1J9W6K+dZmmuOod7K9HNUqox9BRWctzaanCrzhw==" }
Here is an example of callback for a purchase rejected due to insufficient funds on customer account.
Related topics
The following topics might be useful when implementing payments through Gate:
Refund by using Gate
General information
Alipay supports full and partial refunds processing. In the Alipay method, any refund follows the usual procedure which is common to Gate: merchant's web service sends a request with all the required parameters and signature to ecommpay URL, Gate accepts the request and redirects to the payment platform for further processing. The full sequence of the payout process is provided below.
Figure: Refund sequence by using Gate
- A customer orders a refund on the merchant's web service side.
- Merchant's web service sends the request for the refund processing by using Gate to the appropriate ecommpay URL.
- Gate redirects the request to the ecommpay payment platform.
- The payment platform performs all the necessary checks and processes the request.
- The reply with the request processing results is sent to the merchant's web service. For more information, see Response format.
- The payment platform redirects the refund request to the Alipay service.
- The payment is processed on the Alipay side.
- Alipay sends the result notification to the payment platform.
- The payment platform sends a callback with the payment result to the web service.
- The customer receives the refund result from the web service.
The sections that follow discuss in more details the request format and the Gate parameters to use in the Alipay payment method and provide the information on the format of callbacks with refund results.
Request format
There are several things you must consider when using refund requests in the Alipay method:- You send payout requests by sending the
/v2/payment/wallet/alipay/refund
request by using HTTP method POST. This is e-wallets request group /v2/payment/wallet/{payment_method}/refund. - The following objects and parameters must be specified in any request:
- general—general refund information:
- project_id—project identifier
- payment_id—unique refund identifier
- signature—signature created after you specify all the required parameters. For more information about signature generation, see Signature generation and verification
- customer—customer information:
- ip_address—customer IP address
-
payment—refund information:
- amount—refund amount (only for the partial refunds)
- description—comment to the refund
- general—general refund information:
- If required, you can also add any other additional parameters Gate supports.
Thus, a correct refund request in the Alipay method must include project and payment IDs, customer IP address, amount (for the partial refund) and description of the refund, as shown in the following example:
Figure: Example of a refund request
"general": { "project_id": 239, "payment_id": "refund_02", "signature": "of8k9xerKSK4XL1QFaDH3p9Mh0CIcjmOwSwKJ7KLTZYO56lCv+f1M0Sf/7eg==" }, "customer": { "ip_address": "1.2.3.4" }, "payment": { "amount": 10000, "description": "refund_02" }
Callback format
The Alipay method uses the standard format for callbacks to deliver refund results. For more information, see Callbacks.
Related topics
The following topics might be useful when implementing payments through Gate:
Testing
General information
For the Alipay method the testing of purchases by using Payment Page and Gate, refunds by using Gate are available.
Testing can be performed within a test project, to enable and disable the testing availability, contact ecommpay technical support via support@ecommpay.com.
When performing a test payment, take into account that you must specify the identifier of the test project in the requests, the interfaces of the payment forms emulator of Payment Page and Alipay differ from the production environment.
Test payments statuses
When testing purchases, the final payment status is determined by the amount specified in the request:
decline
status with40000
or40400
amountsuccess
status with any other amount
When testing refunds, the final payment status is determined by the amount specified in the request:
decline
status with50000
or50500
amountsuccess
status with any other amount
Purchases by using Payment Page
To perform a test purchase by using Payment Page, do the following:
- Send a correct test request for Payment Page opening 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).
- Accept a callback with information about the payment result.
The full information about purchase process by using Alipay through Payment Page is provided in the section Purchase via Payment Page.
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.
- Accept a callback with redirection data.
- Go to the received URL and click the Success or Decline button (depending on the amount specified in the request).
- Accept a callback with information about the payment result.
The full information about purchase process by using Alipay through Gate is provided in the section Purchase via Gate.
Refunds by using Gate
To perform a test refund by using Gate, send a correct test request for refund of previously performed test purchase to the payment platform and accept a callback with information about the payment result. The full information about the refund process by using Alipay through Gate is provided in the section Refund by using Gate.
Analysis of payments results
As with other payment methods ecommpay offers, when using the Alipay method, you have several options to analyse the information about payments and operations performed by using the method—alone or in conjunction with other methods.
You can load and analyse all the necessary information in Dashboard, for instance you can use the analytic panels on the Analytics tab to this end.
Also, you can export the information for further analysis by using third party analytical tools. The following options are available:
- Dashboard allows you to download reports in CSV and XLS formats—by using the tools on the Payments tab. You can perform export as a one-time download to your local computer or have payment data regularly exported and delivered to email addresses you specify.
- Data API allows you to have payment information exported in JSON format and delivered to a URL you specify. The payment information is exported by using the /operations/get queries.
If you have any further questions regarding payment data analysis, contact ecommpay technical support.