Globally cache WeChat access_token, jsapi ticket, etc.
Multi-channel forwarding of WeChat callback messages.
Simplify WeChat oauth2 authentication process.
Simplify the WeChat payment process.
Simplify the WeChat JSSDK signature process.
Register app:
https://wx.aiportal.net/register?key=test&appid=wx06766a90ab72960e&secret=05bd8b6064a9941b72ee44d5b3bfdb6a
access_token:
https://wx.aiportal.net/app/test/api
https://wx.aiportal.net/app/test/api/new
OAuth2:
First follow the test account: WeChat test account and then use WeChat to open the link: https://wx.aiportal.net/app/test/auth/info?call=/echo
WeChat scan code payment:
<img src="https://wx.aiportal.net/app/aiportal/pay/qrcode?fee=1&name=支付测试&call=/echo"><img>
WeChat official account payment: (version 2.02)
<script src="/app/aiportal/pay/js?fee=1&var=payConfig&call=/echo&openid=o62SMjlZ378PMI6j5b5x8HAoX9YA"></script>
function pop_pay(config) {
// 弹出微信支付界面
WeixinJSBridge.invoke('getBrandWCPayRequest', payConfig, function (res) {
alert(res.err_msg);
});
}
Reference page: https://wx.aiportal.net/example/jspay.html
WeChat JSSDK configuration:
<script src="/app/test/js/config?debug=true"></script>
Reference page: https://wx.aiportal.net/example/jsapi.html
/register?key=...&appid=...&secret=...
&token=&aes=
&mch_id=&mch_key=&server_ip=
&expires=&call=/msg&call=/api&call=...
Parameter description:
key: Customized app name, supports Chinese, or can be a randomly generated string. (required)
appid: The appid of the WeChat official account. (required)
secret: The secret of the WeChat official account. (required)
token, aes: the secret key used to encrypt and decrypt WeChat callback messages. (/msg interface)
If this parameter is set, the background application can directly receive and reply to WeChat callback messages in json plain text format. (/msg/json interface)
mch_id, mch_key, server_ip: Account number, secret key and server IP used for WeChat payment. (/pay interface) If this parameter is set, a simple url request can be used to implement the WeChat payment function.
expires: Expiration time, in seconds. If this parameter is set, the registration information will be automatically deleted after expiration. call: available API, can be repeated multiple times. If this parameter is set, the app registration information can only be used for the listed API interfaces.
New features:
Starting from v2.02, parameter content is allowed to be supplemented by merge. That is, the three parameters of key, appid, and secret are required. Other optional parameters will be automatically merged into the current registration information, and there is no need to submit them all at once.
Starting from v2.03, it is allowed to use the /app/ path to view the registered parameter content, where confidential parameters are replaced by ********.
The access_token global cache automatically obtains the latest access_token value and caches it in the proxy server memory.
The access_token global cache supports multi-process and multi-server sharing of access_token, and can also be obtained unlimited times, simplifying the development difficulty of background services.
After calling the /register interface to complete the registration, use the registered test name to call the /api interface:
/app/test/api
/app/test/qyapi
Force refresh access_token:
/app/test/api/new
/app/test/qyapi/new
The multi-channel forwarding of WeChat callback messages can forward the callback messages of WeChat official accounts to multiple background services, and return the first non-empty processing result in the order in which the call parameters are set.
If the token and aes parameters are set in the /register interface, the /msg/json interface supports the automatic encryption and decryption service of WeChat messages, and the background call URL can directly use the json plaintext protocol to achieve interaction.
/app/test/msg?call=...&call=...
/app/test/msg/json?call=...&call=...
snsapi_base method login verification:
/app/test/auth?call=...&state=&lang=
snsapi_info method login verification:
/app/test/auth/info?call=...&state=&lang=
When the verification is successful, the call URL will receive a json data packet (POST), including the user's openid, unionid, and other user information.
state and lang are optional parameters, please refer to WeChat official documentation for specific meanings.
WeChat payment QR code: Return the QR code image directly, and users can pay by scanning the code using WeChat.
/app/test/pay/qrcode?fee=...&name=&call=&...
Payment on the official account webpage: The payment window is opened on the official account webpage to complete the payment. (Reference implementation:/example/jspay.html)
/app/test/pay/js?openid=...&fee=...&name=&call=&...
Unified ordering: The server can call the unified ordering interface to obtain payment orders, eliminating signature calculation and other steps.
/app/test/pay?fee=...&name=&call=&...
Parameter description:
fee: order amount, unit cents. (required)
openid: The user's openid under the official account. (Required for web payment) Allows the use of client cookies to pass this parameter.
name: Order name. call: callback notification URL. After the order is successfully paid, the payment results will be sent to this URL. (JSON)
Other parameters (advanced usage): Support other order parameters listed in the WeChat unified ordering interface. Please refer to WeChat official documentation for details. (sign, sign_type are automatically generated by the program and cannot be overwritten)
jsapi_ticket global cache:
/app/test/jsapi
JSSDK permission verification configuration: directly return wx.config({...}); to obtain all API permissions by default.
Optional parameters:
debug: true or false.
apilist: comma separated list of JSSDK APIs.
<script src="/app/test/js/config?debug=true"></script>
WeChat card and coupon signature:
/app/test/js/card