WeChat APIby IT-Projects LLC https://apps.odoo.com/apps/modules/12.0/wechat/ , Ivan Yelizariev https://apps.odoo.com/apps/modules/12.0/wechat/
QR-based payments (25 lines of code)
|Lines of code||717|
|License||See License tab|
|Also available in version||v 11.0|
Technical module to integrate Odoo with WeChat
Tested and maintained by
IT Projects Labs
- Buyer scans merchant's QR code to pay order (扫码支付)
- Merchant scans buyer's QR code to send order payment information (刷卡支付)
Need a custom miniprogram for WeChat (微信小程序)?
Contact our partner in China
- +86 18611909110
pip install wechatpy pip install wechatpy[cryptography] # to update existing installation use pip install -U wechatpy
Be sure that your server available for requests from outside world (i.e. it shall not be avaialble in local network only)
If you have several databases, you need to check that all requests are sent to the desired database. The notification request from the WeChat cloud does not contain session cookies. So, if Odoo cannot determine which database to use, it will return a 404 error (Page not found). In order for the requests to send to the desired database, you need to configure dbfilter.
Check WeChat documentation or contact WeChat Support about obtaining APP credentials.
- Activate Developer Mode
- Open menu [[ Settings ]] >> Parameters >> System Parameters
- Create following parameters
- wechat.mch_id -- Vendor ID
- wechat.sub_mch_id -- Sub Vendor ID
- wechat.sandbox -- set to 0 or delete to disable. Any other value to means that sandbox is activated.
- wechat.mch_cert, wechat.mch_key -- path to key and certificate files at server. Example of values:
- wechat.mch_cert: /path/to/apiclient_cert.pem
- wechat.mch_key: /path/to/apiclient_key.pem
- wechat.payment_result_notification_url -- optional. Use it if doesn't work automatiically. The url must be http(s)://YOUR_HOST/wechat/callback.
If you get error invalid out_trade_no, it means that you use the same credentials in new database and odoo sends Wechat Order IDs that were previously used in another system. To resolve this do as following:
- Go to [[ Settings ]] >> Technical >> Sequence & Identifiers >> Sequences
- Find record WeChat Order, Wechat Refund or Wechat Micropay, depending on which request has the problem
- Change either Prefix, Suffix or Next Number
- If you get the error again, try to increase Next Number
Wechat records (Orders, Micropays, Refunds, etc.) can be found at [[ Invoicing ]] >> Configuration >> Wechat. If you don't have that menu, you need to configure Show Full Accounting Features for your user first:
- Activate Developer Mode
- Open menu [[ Settings ]] >> Users & Companies >> Users
- Open user you need
- Activate Show Full Accounting Features
The MIT License (MIT) Copyright 2020 IT-Projects Labs Copyright 2015-2020 IT-Projects LLC Copyright 2014-2015 Ivan Yelizariev Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module
- The author can leave a single reply to each comment.
- This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
- If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.