微信服务商公众号或小程序支付需注意事项

Unified Order API: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/pay/MiniProgramPay/chapter8_1.shtml
Payment API from HTML5 Websites: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/pay/OfficialPayMent/chapter5_3.shtml
Call Payment API for Mini Program: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/pay/MiniProgramPay/chapter7_3.shtml

注意appId必须为商户公众号或小程序的appId,而非服务商的appId,否则小程序唤起支付组件报错:支付验证签名失败
注意签名秘钥仍为服务商的签名秘钥,加签方式支持HMAC-SHA256MD5

<xml>
  <appid>wx2d69f58a2e1e8f7b</appid>
  <mch_id>118875960</mch_id>
  <sub_appid>wx325516311812fe28</sub_appid>
  <sub_mch_id>816669565</sub_mch_id>
  <device_info>appblog.cn</device_info>
  <nonce_str>47935594547358776612633452350712</nonce_str>
  <sign>c518340bfb47bc8ac914b2fb81706664e99307991190b8337634e980762eac08</sign>
  <sign_type>HMAC-SHA256</sign_type>
  <body>purchase the grand palace ticket</body>
  <attach>product_code=WECHAT_PAY|payment_type=INAPP_PAYMENT</attach>
  <out_trade_no>132020121602295028</out_trade_no>
  <fee_type>THB</fee_type>
  <total_fee>50000</total_fee>
  <spbill_create_ip>127.0.0.1</spbill_create_ip>
  <time_start>20201216174529</time_start>
  <time_expire>20201216184529</time_expire>
  <notify_url>https://mall-callback.appblog.cn/wechatpay/payment/wechat_pay/jsapi</notify_url>
  <trade_type>JSAPI</trade_type>
  <sub_openid>o53Oc5eRiEVLY8oUvTLMBQ_GvOT0</sub_openid>
  <receipt>Y</receipt>
</xml>
<xml>
<return_code><![CDATA[SUCCESS]]></return_code>
<return_msg><![CDATA[OK]]></return_msg>
<appid><![CDATA[wx2d69f58a2e1e8f7b]]></appid>
<mch_id><![CDATA[118875960]]></mch_id>
<sub_mch_id><![CDATA[816669565]]></sub_mch_id>
<device_info><![CDATA[appblog.cn]]></device_info>
<nonce_str><![CDATA[0tCrtGajKIu9gMNZ]]></nonce_str>
<sign><![CDATA[03509C25B2B26320924223D8DFA5C15460E98FDB59E1650D92DB28920AADF5ED]]></sign>
<result_code><![CDATA[SUCCESS]]></result_code>
<prepay_id><![CDATA[wx16174530589259728a3e59c4c660050000]]></prepay_id>
<trade_type><![CDATA[JSAPI]]></trade_type>
<sub_appid><![CDATA[wx325516311812fe28]]></sub_appid>
</xml>
{
    "code":"SUCCESS",
    "data":{
        "order_no":"122020121613613028",
        "order_amount":"500.00",
        "order_currency":"THB",
        "order_status":"WaitPay",
        "pay_params":{
            "timeStamp":"1608111930",
            "package":"prepay_id=wx16174530589259728a3e59c4c660050000",
            "paySign":"3b2841d8058f87a8a340b0cbae17f2b5c86a3ec91cce25faf9b0652280736caa",
            "appId":"wx325516311812fe28",
            "signType":"HMAC-SHA256",
            "nonceStr":"20201216174530576"
        },
        "create_time":"2020-12-16 16:55:29"
    },
    "message":"success"
}

版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/03/25/precautions-for-wechat-service-provider-official-account-or-applet-payment/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
打赏
海报
微信服务商公众号或小程序支付需注意事项
Unified Order API: https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/pay/MiniProgramPay/chapter8_1.shtml Payment API from HTML5 Websites: https://pay.……
<<上一篇
下一篇>>
文章目录
关闭
目 录