Alipay's official logo | 支付宝官方图标
Screenshot of the Payment Checkout Pane, when the Alipay method is enabled.
Screenshot of the Commerce Alipay settings form in the payment methods rules.

Alipay integration for the Drupal Commerce payment and checkout system.


Unfortunately, there isn't much of an English Alipay document describing the different services.
More information would be available in Chinese at: 平台商产品 (专为交易平台所提供的收款方案).

Currently supports the following Alipay service types:
✓ Instant Payment / 支付宝即时到账收款接口 (tested and supported)
Through an instant payment channel, an Alipay account owner is able to remit directly to seller, enabling quick gathering and withdrawal of funds, resulting in an improved utilization of funds.
(see screenshot of the payment pane on checkout when the Instant Pay payment method is enabled)

More work and testing to be done on:

  • Escrow Payment / 支付宝担保交易收款接口
    The third-party (Alipay) guarantees that the buyer can receive goods and seller can obtain the funds. The usually procedure being:
    Buyer Pays >> Seller Sends Goods >> Buyer Confirms Goods >> Seller Confirms
    Due to its more complete workflow, it is considered as one of the most trusted online payments for buyers.
  • Dual-function Payment / 支付宝双功能收款接口
    Allows the buyer to select between Instant Payment and Escrow Payment to process the funds, providing more flexibility for the buyer.
  • Delivery Confirmation / 确认发货接口
    Enables merchants to confirm the sending of goods by clicking the "Send button" without logging into their Alipay account. The corresponding product/order information would be synchronized to the corresponding Alipay account.

For more information, see: #1812228-5: 错误代码:ILLEGAL_ARGUMENT (please help).

Module currently supports Instant Payment service account types.
Other service types could be supported to some extent with some customization through the hook_commerce_alipay_parameter_alter (see API document).

Debug mode:
It is possible to enable a debugging mode, to override all transactions to a
total of 0.01 CNY, which is very useful for testing if everything has been
correctly setup or ensuring payments could effectively be received.

Installation and configuration

0 - Prerequisites:
Requires Drupal Commerce to be installed and more particularly the Commerce Payment module to be enabled (more Commerce modules would also be required: Commerce UI and Order).
More information at: Installation and uninstallation guide for Drupal Commerce.

1 - Download the module and copy it into your contributed modules folder:
[for example, your_drupal_path/sites/all/modules] and enable it from the modules administration/management page.
More information at: Installing contributed modules (Drupal 7).

2 - Configuration:
After successful installation, browse to the Payment Methods management page under:
Home » Administration » Store » Configuration » Payment methods
Path: admin/commerce/config/payment-methods or use the "Configure" link displayed on the Modules management page.

Enable the Alipay payment method, as described in the Drupal Commerce Payments User Guide.
Follow all other steps as described in the Payments User Guide (screenshots): edit the Alipay payment method (Rule) and then edit the Action Enable payment method: Alipay.

Configure the form Payment Settings as required with:
(see screenshot of the configuration form)

  • Seller's registered email address.
  • Partner ID and Key provided by Alipay's API after account registration for the corresponding type of Service.

For testing configuration settings, feel free to enable the Debug mode from the same settings form. For more information on the Debug mode, please check the paragraph above, called Debug mode (see also screenshot of the settings form debug mode option).
(Make sure all the settings are saved each time)

Useful Resources

For any questions and problems, you may find some help on the Alipay official site:
1 - Merchant Help Center:
Apply for integration consultation, and you could expect a professional
technician to contact you.
2 - User Help Center.
3 - Alipay Forum:
For general discussions, inquiries, future developments or API changes, etc...
4 - Alipay Chinese API Document.

Future developments:

There have already been some discussions around the possibility of implementing different service types with different payment methods.
A suggested 7.x-2.x branch could potentially be created to provide a better support for other service types, such as Escrow or SendConfirm.
For more information, see #1812228-5: 错误代码:ILLEGAL_ARGUMENT Ideas for future developments.

Contributions are welcome!!

Feel free to follow up in the issue queue for any contributions, bug reports, feature requests.
Tests, feedback or comments (and of course, patches) in general are highly appreciated.

Special thanks to DYdave for reviewing the project, testing and documentation.
This module was sponsored by DAVYIN | 上海戴文.

Supporting organizations: 
Development and maintenance of the module.

Project Information