微信支付服务商APP支付开发记录

服务端请求:

<xml>
  <appid>wx28f9d88adc6a2f8c</appid>
  <mch_id>118875960</mch_id>
  <sub_appid>wxbd832f28f5f626fb</sub_appid>
  <sub_mch_id>516669865</sub_mch_id>
  <device_info>lianlianpay</device_info>
  <nonce_str>09204659701415739073230554964275</nonce_str>
  <sign>1483a434a49ab0652fe12a4ad3ac5cbdd2ded39010674cf8be32e43d7fae5ebd</sign>
  <sign_type>HMAC-SHA256</sign_type>
  <body>test</body>
  <attach>product_code=WECHAT_PAY|payment_type=APP_PAYMENT</attach>
  <out_trade_no>132021031902460031</out_trade_no>
  <fee_type>USD</fee_type>
  <total_fee>5080</total_fee>
  <spbill_create_ip>127.0.0.1</spbill_create_ip>
  <time_start>20210319161732</time_start>
  <time_expire>20210319171732</time_expire>
  <notify_url>https://callback.appblog.cn/wechatpay/app/payment</notify_url>
  <trade_type>APP</trade_type>
</xml>

服务端响应:

<xml>
<return_code><![CDATA[SUCCESS]]></return_code>
<return_msg><![CDATA[OK]]></return_msg>
<appid><![CDATA[wx28f9d88adc6a2f8c]]></appid>
<mch_id><![CDATA[118875960]]></mch_id>
<sub_mch_id><![CDATA[516669865]]></sub_mch_id>
<device_info><![CDATA[lianlianpay]]></device_info>
<nonce_str><![CDATA[aIg8QOpFNEv4BBNg]]></nonce_str>
<sign><![CDATA[73B194ECEFEBD7D17C344453B77172CB79A73C4C92BFFE18F1B3E0AEF62D19AA]]></sign>
<result_code><![CDATA[SUCCESS]]></result_code>
<prepay_id><![CDATA[wx19161733475542f14dbbf3d154c1760000]]></prepay_id>
<trade_type><![CDATA[APP]]></trade_type>
<sub_appid><![CDATA[wxbd832f28f5f626fb]]></sub_appid>
</xml>

网关响应:

{
    "code": 200,
    "message": "success",
    "data": {
        "order_id": "122021031613446007",
        "order_status": "Wait_Pay",
        "order_amount": "50.80",
        "order_currency": "USD",
        "create_time": "2021-03-16 10:06:55",
        "pay_params": {
            "package": "Sign=WXPay",
            "appid": "wxbd832f28f5f626fb",
            "sign": "d0a0df7888739febefe7b8ab439525f5364b1117cb67f0b8c42227bd85267323",
            "partnerid": "118875960",
            "prepayid": "wx19161733475542f14dbbf3d154c1760000",
            "noncestr": "20210319161733600",
            "timestamp": "1616141853"
        }
    },
    "trace_id": "e36b57debc88311d"
}

Android客户端唤起请求:

int wxSdkVersion = wxApi.getWXAppSupportAPI();
if (wxSdkVersion >= Build.PAY_SUPPORTED_SDK_INT) {
    PayReq req = new PayReq();
    req.appId = "wxbd832f28f5f626fb";
    req.partnerId = "118875960";
    req.prepayId = "wx19161733475542f14dbbf3d154c1760000";
    req.nonceStr = "20210319161733600";
    req.timeStamp = "1616141853";
    req.packageValue = "Sign=WXPay";
    req.sign = "d0a0df7888739febefe7b8ab439525f5364b1117cb67f0b8c42227bd85267323";
    //req.extData = "app data"; // optional
    wxApi.sendReq(req);
} else {
    Toast.makeText(MainActivity.this, "not supported", Toast.LENGTH_LONG).show();
}

版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/04/02/wechat-pay-service-provider-app-payment-development/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
打赏
海报
微信支付服务商APP支付开发记录
Call Payment API from APP:https://pay.weixin.qq.com/wiki/doc/api/wxpay/en/pay/In-AppPay/chapter6_3.shtml APP Payment Development Guide:https://pa……
<<上一篇
下一篇>>
文章目录
关闭
目 录