首页 新闻 会员 周边

nodejs微信开支付回调

0
悬赏园豆:5 [已解决问题] 解决于 2018-06-30 14:48

支付回调后的数据: { request:
{ method: 'POST',
  url: '/pay/notify',
  header:
  {

    accept: '*/*',
    connection: 'Keep-Alive',
    pragma: 'no-cache',
    'content-length': '833',
    host: 'www.tomandjerry.club',
    'user-agent': 'Mozilla/4.0',
    'content-type': 'text/xml' } },
    response: { status: 404, message: 'Not Found', header: {} },
    app: { subdomainOffset: 2, proxy: false, env: 'development' },
    originalUrl: '/pay/notify',
     req: '<original node req>',
    res: '<original node res>',
    socket: '<original node socket>'

}

微信回调返回的这串数据,怎么没看到类似

<xml>
  <appid><![CDATA[wx2421b1c4370ec43b]]></appid>
  <attach><![CDATA[支付测试]]></attach>
  <bank_type><![CDATA[CFT]]></bank_type>
  <fee_type><![CDATA[CNY]]></fee_type>
  <is_subscribe><![CDATA[Y]]></is_subscribe>
  <mch_id><![CDATA[10000100]]></mch_id>
  <nonce_str><![CDATA[5d2b6c2a8db53831f7eda20af46e531c]]></nonce_str>
  <openid><![CDATA[oUpF8uMEb4qRXf22hE3X68TekukE]]></openid>
  <out_trade_no><![CDATA[1409811653]]></out_trade_no>
  <result_code><![CDATA[SUCCESS]]></result_code>
  <return_code><![CDATA[SUCCESS]]></return_code>
  <sign><![CDATA[B552ED6B279343CB493C5DD0D78AB241]]></sign>
  <sub_mch_id><![CDATA[10000100]]></sub_mch_id>
  <time_end><![CDATA[20140903131540]]></time_end>
  <total_fee>1</total_fee>
<coupon_fee><![CDATA[10]]></coupon_fee>
<coupon_count><![CDATA[1]]></coupon_count>
<coupon_type><![CDATA[CASH]]></coupon_type>
<coupon_id><![CDATA[10000]]></coupon_id>
<coupon_fee><![CDATA[100]]></coupon_fee>
  <trade_type><![CDATA[JSAPI]]></trade_type>
  <transaction_id><![CDATA[1004400740201409030005092168]]></transaction_id>
</xml>

的数据

甜珊贝奇的主页 甜珊贝奇 | 初学一级 | 园豆:118
提问于:2018-06-30 09:32
< >
分享
最佳答案
0

问题还是自己解决了,主要是后台接收xml数据的解析,贴上代码:

let data = await getRawBody(ctx.req,{
  length:ctx.length,
  limit:'1mb',
  encoding:ctx.charset
});

甜珊贝奇 | 初学一级 |园豆:118 | 2018-06-30 14:47

我是来骗豆豆的(手动滑稽^__^)

舒碧 | 园豆:169 (初学一级) | 2018-06-30 14:50
其他回答(1)
0
收获园豆:5
舒碧 | 园豆:169 (初学一级) | 2018-06-30 10:04
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册