Commerce Wechatpay
Categories
Component ID
Component name
Component type
Maintenance status
Development status
Component security advisory coverage
Downloads
Component created
Component changed
Component body
Wechat (Weixin) payment solution for Drupal Commerce
This module is currently under maintenance and keep updating in Github
Requirements
- SDK package overtrue/wechat
在安装本模å—å‰ï¼Œè¯·ä¸‹è½½overtrueçš„wechatSDK,并放入"libraries"文件夹ä¸
Please download SDK package and put inside "libraries" folder before install this module
cd PATH_TO_DRUPAL/sites/all/libraries git clone https://github.com/overtrue/wechat.git overtrue_wechat cd overtrue_wechat git checkout 3.3.13 # Recommended version is 3.3.13 composer install -vvv # Install dependencies.更多关于æ¤SDK的信æ¯è¯·å‚考文档
More inforamtion about overtrue_wechat please see docs
Installation
- Follow the default way of set-up a payment module for Drupal Commerce, take a look at commerce_paypal installation if you don't understand.
- Configure Wechat payment (only for Merchat pay - 公众巿”¯ä»˜)
Set an authorized URL alias in Wechat back-office, image example
在微信公众平å°çš„åŽå°ï¼Œå°†å¦‚下地å€è®¾ç½®ä¸ºä¸€ä¸ªæ”¯ä»˜æŽˆæƒç›®å½•, 图片示例
http://YOUR_DOMAIN.COM/ALIAS_TO_DRUPAL_ROOT/commerce_wechatpay/checkout/
Payment methods
-
Merchant pay (jsapi)(公众巿”¯ä»˜)
Requires opening payment page in Wechat browser, otherwise will return error. This method is good when developing all-browse-in-wechat web page.
-
QR code pay (native)(æ‰«ç æ”¯ä»˜)
(本模å—ä½¿ç”¨çš„æ˜¯æ‰«ç æ”¯ä»˜çš„æ”¯ä»˜æ¨¡å¼äºŒï¼Œæ‰€ä»¥æ— éœ€è®¾ç½®æ‰«ç æ”¯ä»˜çš„æ”¯ä»˜å›žè°ƒURL)
(This module uses wechat scan&pay mode 2, so no need to set redirect URL on scan&pay settings area)
Provides a QR code image when going to the off-site payment gateway, allows user to scan the QR code and pay directly in Wechat. If opening payment page in Wechat browser, user can long-press the QRcode to pay (wechat build-in feature) but will not be returned back to successful page.
API docs
Overwrite main class handler
use the API to change to your class first
function YOUR_MODULE_commerce_wechatpay_class_name_alter(&$class_name) {
$class_name = 'YOUR_OWN_HANDLER_CLASS';
}
then define your class, it's recommand if you extend from the original class
Class YOUR_OWN_HANDLER_CLASS extends CommerceWechatpay {
public function orderId2outTradeNo ($order_num)
{
// I want my own way for transfering order_id to out_trade_no
return md5('some_secret_string'.md5($order_num));
}
// other overwritten, blabla
}
Overwrite javascript process handler
use the API to change to your js process handler first
function YOUR_MODULE_commerce_wechatpay_javascript_handler_name_alter(&$js_function_name) {
$js_function_name = 'YOUR_OWN_JS_HANDLER_FUNCTION';
}
then define your javascript function
window.YOUR_OWN_JS_HANDLER_FUNCTION = function(configs, return_success_url, return_failure_url)
{
// some overwritten, blabla
}Sponsorship
Current maintainers:
- Qiangjun Ran (jungle) - https://drupal.org/user/2919723
This module is sponsored by:
