Publish: 2019-04-21 | Modify: 2019-04-21
Often friends ask me how I created a multi-purpose QR code payment system on my blog. In fact, there are many open-source solutions available online to solve this problem. Here, I will share a simple method.
ShouKuanLa is an open-source tool that combines payment QR codes from Alipay, WeChat Pay, and QQ Pay into a single QR code. Payments made through this QR code are directly deposited into your account without any transaction fees.
Visit the ShouKuanLa website: https://qr.52ecy.cn/. Upload your own QR codes to combine them. This tool is open-source and relatively secure. If you are still concerned about security, you can download the source code and deploy it on your own.
ShouKuanLa source code: https://github.com/178146582/qr
OneQRCode is a purely static QR code payment tool. The code is open-source and its functionality is similar to ShouKuanLa. It also supports combining QR codes from Alipay, WeChat Pay, and QQ Pay. However, some modifications are required before it can be used.
Visit: https://github.com/mengkunsoft/OneQRCode/archive/master.zip and download the latest source code. Extract the downloaded file. The only file you need is index.html
.
Open index.html
with a text editor and modify the qqUrl/wechatUrl/aliUrl
to your corresponding payment addresses, as shown in the screenshot below.
wechatUrl
option in index.html
. The configuration method is the same for Alipay and QQ Pay. After modifying index.html
, upload it to your website and you're done.The payment principle of ShouKuanLa, OneQRCode, and other similar multi-purpose payment tools is the same. They all retrieve the UserAgent from the client-side and then redirect to different URLs or display corresponding QR codes based on the UserAgent. For example, if the client-side is Alipay, it will be redirected to the Alipay link. The UserAgent for each tool is as follows:
Alipay
: AlipayMicroMessenger
: WeChatQQ
: QQ or TIMwxp://
, which cannot directly initiate payments. It can only return a QR code for WeChat to recognize and complete the payment.Once you understand the principle, you can create your own multi-purpose QR code payment system. If you don't want to create one from scratch, you can use one of the existing open-source solutions mentioned above. Below is an example of a QR code payment system created by myself, which is a simplified version of the aforementioned solutions.
At the bottom of this article, you can find the QR codes for donations to Little Z's blog. Feel free to click and try out the payment experience.
I come from China and I am a freelancer. I specialize in Linux operations, PHP, Golang, and front-end development. I have developed open-source projects such as Zdir, ImgURL, CCAA, and OneNav.