1. OneQRCode
    1. 注意事项
    2. 原理
  2. License

OneQRCode

微信、支付宝、QQ 三合一收款二维码(单页版)

注意事项

原理

在 微信、支付宝、QQ 中扫描到一个网址二维码后,一般会通过内置的浏览器打开这个网址。通过判断内置浏览器的 UA,即可得出当前扫码的具体支付平台。

1
2
3
4
5
6
7
8
9
if(navigator.userAgent.match(/Alipay/i)) {
// 支付宝
} else if(navigator.userAgent.match(/MicroMessenger\//i)) {
// 微信
} else if(navigator.userAgent.match(/QQ\//i)) {
// QQ
} else {
// 其它
}

其中,支付宝可以通过直接跳转收款链接唤起付款功能,而 QQ、微信 则需展示出对应的收款码,由用户自行长按识别真正的收款二维码实现唤起付款。

详细请阅读:

多合一收款二维码原理及实现

详细使用说明请查阅项目wiki

License

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
MIT License

Copyright (c) 2018 mengkun

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.
script>