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 E-wallet
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
  • Alipay supports purchases via web and mobile application versions by using QR code
  • We recommend that you perform all operations by using Internet Explorer
  • In some cases there is a limit for payment lifetime—30 minutes. For more information refer to the ECommPay key account manager
Onboarding and access fee Refer to your ECommPay Key Account Manager
Note:

* 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 Plugins Gate Dashboard (Old 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 method.

The full sequence and particularities of the purchase process are provided below.



Figure: Purchase sequence when using Payment Page

  1. Customer initiates payment by using the web service.
  2. The merchant web service sends to the specified ECommPay URL the payment request for processing the payment by using Payment Page.
  3. The payment platform receives the request for processing the payment by using Payment Page.
  4. The payment platform performs the initial request processing that involves validation of the required parameters and signature.
  5. Payment Page is generated into the ECommPay payment platform as specified in the project settings and the request parameters.
  6. The payment form is displayed to the customer.
  7. The customer selects Alipay payment method and agrees to use the method (or accepts the method already selected on the form and agrees).
  8. The payment platform receives the payment request for payment processing in the Alipay service.
  9. The payment platform performs the internal payment request processing and sends it to the Alipay service.
  10. The payment request is processed on the Alipay side.
  11. The Alipay service generates the data for redirecting the customer to the Alipay form and sends it to the payment platform.
  12. The payment platform sends to Payment Page the data for redirecting the customer to the Alipay service.
  13. The customer is redirected to the Alipay service.
  14. The customer completes required steps to perform purchase.
  15. The payment is processed on the Alipay side.
  16. The Alipay service sends the payment result notification to the payment form.
  17. The payment platform sends the callback to the web service.
  18. The payment platform sends payment results to Payment Page.
  19. 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:

  1. 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
  2. The available currencies of purchase specify with ECommPay key account manager.
  3. There is one more mandatory parameter—language_code. In the language_code parameter, you must use zh code of Payment Page.
  4. If you need to have payment form displayed with the Alipay method selected, set the force_payment_method parameter to alipay.
  5. If required, you can also add any other additional parameters Payment Page supports.
  6. 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 Payment Page invocation parameters.

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:

  1. Send a request with all the required parameters and signature to the ECommPay URL.
  2. Perform redirecting customer to the Alipay service.
  3. Get the callback with the payment result from the payment platform.


Figure: Purchase sequence when using Gate

  1. Customer initiates payment on the merchant web service by using Alipay payment method.
  2. The web service sends the request for processing the payment by using Gate to the specified ECommPay URL.
  3. The payment platform receives the request for processing the payment by using Gate.
  4. The payment platform performs the initial request processing that includes validation of the required parameters and signature.
  5. The payment platform sends to the web service response with request receipt confirmation and correctness check result. For more information, see Response format.
  6. The payment platform performs the internal payment request processing and sends it to the Alipay service.
  7. The payment request is processed on the Alipay side.
  8. The Alipay service generates the data for redirecting the customer to the Alipay service and sends it to the payment platform.
  9. The payment platform sends to the web service data for redirecting the customer to the Alipay service.
  10. The customer is redirected to the Alipay service.
  11. The customer completes required steps to perform purchase.
  12. The payment is processed on the Alipay side.
  13. The Alipay service sends the payment result notification to the payment form.
  14. The payment platform sends the callback to the web service.
  15. 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:
  1. 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.
  2. 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—Additional payment information submission.
  3. The available currencies of purchase specify with ECommPay key account manager.
  4. 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 type
  • title—object title
  • data—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 the type parameter which can have one of the following values:
    • qr_url—QR code is passed as a link the image. In this case the data parameter contains a URL.
    • qr_img—QR code is passed as an image. In this case the data parameter contains a string encoded using the Base64 scheme.
    • qr_data—QR code is passed as a string. In this case the data 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. The type parameter of such objects is assigned the add_info value, while the data 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 the QR Code Timeout value, while the lifespan is specified in seconds in the data 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

  1. A customer orders a refund on the merchant's web service side.
  2. Merchant's web service sends the request for the refund processing by using Gate to the appropriate ECommPay URL.
  3. Gate redirects the request to the ECommPay payment platform.
  4. The payment platform performs all the necessary checks and processes the request.
  5. The reply with the request processing results is sent to the merchant's web service. For more information, see Response format.
  6. The payment platform redirects the refund request to the Alipay service.
  7. The payment is processed on the Alipay side.
  8. Alipay sends the result notification to the payment platform.
  9. The payment platform sends a callback with the payment result to the web service.
  10. 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:
  1. 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.
  2. 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
  3. 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:

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.