klover2 / wechatpay-node-v3-ts

微信支付v3
MIT License
575 stars 88 forks source link

支付回调解密解析错误 #42

Closed geekape closed 1 year ago

geekape commented 1 year ago

求大佬帮忙看看,已经测试过好多回了

2023-01-14 10:35:55,877 ERROR 479036 [-/140.207.54.79/-/1ms POST /wx-notify] nodejs.Error: Unsupported state or unable to authenticate data
    at Decipheriv.final (node:internal/crypto/cipher:193:29)
    at Pay.decipher_gcm (/www/wwwroot/text-to-speech.com/node_modules/.pnpm/registry.npmmirror.com+wechatpay-node-v3@2.1.0/node_modules/wechatpay-node-v3/dist/index.js:332:18)
    at WxController.notify (/www/wwwroot/text-to-speech.com/app/controller/wx.js:51:24)
    at Object.callFn (/www/wwwroot/text-to-speech.com/node_modules/.pnpm/egg-core@4.27.0/node_modules/egg-core/lib/utils/index.js:44:21)
    at Object.classControllerMiddleware (/www/wwwroot/text-to-speech.com/node_modules/.pnpm/egg-core@4.27.0/node_modules/egg-core/lib/loader/mixin/controller.js:87:20)
    at Object.callFn (/www/wwwroot/text-to-speech.com/node_modules/.pnpm/@eggjs+router@2.0.1/node_modules/@eggjs/router/lib/utils.js:12:21)
    at wrappedController (/www/wwwroot/text-to-speech.com/node_modules/.pnpm/@eggjs+router@2.0.1/node_modules/@eggjs/router/lib/egg_router.js:322:18)
    at dispatch (/www/wwwroot/text-to-speech.com/node_modules/.pnpm/koa-compose@3.2.1/node_modules/koa-compose/index.js:44:32)
    at next (/www/wwwroot/text-to-speech.com/node_modules/.pnpm/koa-compose@3.2.1/node_modules/koa-compose/index.js:45:18)
    at /www/wwwroot/text-to-speech.com/node_modules/.pnpm/@eggjs+router@2.0.1/node_modules/@eggjs/router/lib/router.js:186:18

微信请求的参数

 {
      'content-length': '915',
      connection: 'Keep-Alive',
      'user-agent': 'Mozilla/4.0',
      accept: '*/*',
      host: '124.71.58.207',
      'wechatpay-nonce': '4WiViQ2LN9P3oniM5oKUDCk1E601oWco',
      'content-type': 'application/json',
      'wechatpay-serial': '476A463785C200B7A7D13CB6A521663B91EECB53',
      'wechatpay-signature': 'QYVsHeRe5gOxntBAUyZaCvtF4Exc2T/JkhGMNwBgbopejYPSGpH5+lGoRpwoSF0R+9Q5IR0jZUoLIg3nR91Koot7sIE6WzdaeRVXP0NTFVgPVUZmbH7E1q3NqJU0nNSD45+wXVZfbThZrfw5eVYFUeVicukXqcTtZpXiY/Efu76fgl+ePVkAYM+F/nqGPA/Tk8NG0KAIKBoZylr+OVh6wlwECpfRv0IAxRfvvv+7o6S0ebxbGDd2C2XXnoNooP/ZHarM0wI+F5XGOWXPD7Baj/KuzcuPC3d5I+VRLhnk1fm/XRskNucIQZW/X30P4LBCPhheSHPksHm2UpJZe7AP4Q==',
      'wechatpay-signature-type': 'WECHATPAY2-SHA256-RSA2048',
      pragma: 'no-cache',
      'wechatpay-timestamp': '1673663801'
    }

我的代码 image

klover2 commented 1 year ago

求大佬帮忙看看,已经测试过好多回了

2023-01-14 10:35:55,877 ERROR 479036 [-/140.207.54.79/-/1ms POST /wx-notify] nodejs.Error: Unsupported state or unable to authenticate data
    at Decipheriv.final (node:internal/crypto/cipher:193:29)
    at Pay.decipher_gcm (/www/wwwroot/text-to-speech.com/node_modules/.pnpm/registry.npmmirror.com+wechatpay-node-v3@2.1.0/node_modules/wechatpay-node-v3/dist/index.js:332:18)
    at WxController.notify (/www/wwwroot/text-to-speech.com/app/controller/wx.js:51:24)
    at Object.callFn (/www/wwwroot/text-to-speech.com/node_modules/.pnpm/egg-core@4.27.0/node_modules/egg-core/lib/utils/index.js:44:21)
    at Object.classControllerMiddleware (/www/wwwroot/text-to-speech.com/node_modules/.pnpm/egg-core@4.27.0/node_modules/egg-core/lib/loader/mixin/controller.js:87:20)
    at Object.callFn (/www/wwwroot/text-to-speech.com/node_modules/.pnpm/@eggjs+router@2.0.1/node_modules/@eggjs/router/lib/utils.js:12:21)
    at wrappedController (/www/wwwroot/text-to-speech.com/node_modules/.pnpm/@eggjs+router@2.0.1/node_modules/@eggjs/router/lib/egg_router.js:322:18)
    at dispatch (/www/wwwroot/text-to-speech.com/node_modules/.pnpm/koa-compose@3.2.1/node_modules/koa-compose/index.js:44:32)
    at next (/www/wwwroot/text-to-speech.com/node_modules/.pnpm/koa-compose@3.2.1/node_modules/koa-compose/index.js:45:18)
    at /www/wwwroot/text-to-speech.com/node_modules/.pnpm/@eggjs+router@2.0.1/node_modules/@eggjs/router/lib/router.js:186:18

微信请求的参数

 {
      'content-length': '915',
      connection: 'Keep-Alive',
      'user-agent': 'Mozilla/4.0',
      accept: '*/*',
      host: '124.71.58.207',
      'wechatpay-nonce': '4WiViQ2LN9P3oniM5oKUDCk1E601oWco',
      'content-type': 'application/json',
      'wechatpay-serial': '476A463785C200B7A7D13CB6A521663B91EECB53',
      'wechatpay-signature': 'QYVsHeRe5gOxntBAUyZaCvtF4Exc2T/JkhGMNwBgbopejYPSGpH5+lGoRpwoSF0R+9Q5IR0jZUoLIg3nR91Koot7sIE6WzdaeRVXP0NTFVgPVUZmbH7E1q3NqJU0nNSD45+wXVZfbThZrfw5eVYFUeVicukXqcTtZpXiY/Efu76fgl+ePVkAYM+F/nqGPA/Tk8NG0KAIKBoZylr+OVh6wlwECpfRv0IAxRfvvv+7o6S0ebxbGDd2C2XXnoNooP/ZHarM0wI+F5XGOWXPD7Baj/KuzcuPC3d5I+VRLhnk1fm/XRskNucIQZW/X30P4LBCPhheSHPksHm2UpJZe7AP4Q==',
      'wechatpay-signature-type': 'WECHATPAY2-SHA256-RSA2048',
      pragma: 'no-cache',
      'wechatpay-timestamp': '1673663801'
    }

我的代码 image image 你这个怎么是空的

klover2 commented 1 year ago

求大佬帮忙看看,已经测试过好多回了

2023-01-14 10:35:55,877 ERROR 479036 [-/140.207.54.79/-/1ms POST /wx-notify] nodejs.Error: Unsupported state or unable to authenticate data
    at Decipheriv.final (node:internal/crypto/cipher:193:29)
    at Pay.decipher_gcm (/www/wwwroot/text-to-speech.com/node_modules/.pnpm/registry.npmmirror.com+wechatpay-node-v3@2.1.0/node_modules/wechatpay-node-v3/dist/index.js:332:18)
    at WxController.notify (/www/wwwroot/text-to-speech.com/app/controller/wx.js:51:24)
    at Object.callFn (/www/wwwroot/text-to-speech.com/node_modules/.pnpm/egg-core@4.27.0/node_modules/egg-core/lib/utils/index.js:44:21)
    at Object.classControllerMiddleware (/www/wwwroot/text-to-speech.com/node_modules/.pnpm/egg-core@4.27.0/node_modules/egg-core/lib/loader/mixin/controller.js:87:20)
    at Object.callFn (/www/wwwroot/text-to-speech.com/node_modules/.pnpm/@eggjs+router@2.0.1/node_modules/@eggjs/router/lib/utils.js:12:21)
    at wrappedController (/www/wwwroot/text-to-speech.com/node_modules/.pnpm/@eggjs+router@2.0.1/node_modules/@eggjs/router/lib/egg_router.js:322:18)
    at dispatch (/www/wwwroot/text-to-speech.com/node_modules/.pnpm/koa-compose@3.2.1/node_modules/koa-compose/index.js:44:32)
    at next (/www/wwwroot/text-to-speech.com/node_modules/.pnpm/koa-compose@3.2.1/node_modules/koa-compose/index.js:45:18)
    at /www/wwwroot/text-to-speech.com/node_modules/.pnpm/@eggjs+router@2.0.1/node_modules/@eggjs/router/lib/router.js:186:18

微信请求的参数

 {
      'content-length': '915',
      connection: 'Keep-Alive',
      'user-agent': 'Mozilla/4.0',
      accept: '*/*',
      host: '124.71.58.207',
      'wechatpay-nonce': '4WiViQ2LN9P3oniM5oKUDCk1E601oWco',
      'content-type': 'application/json',
      'wechatpay-serial': '476A463785C200B7A7D13CB6A521663B91EECB53',
      'wechatpay-signature': 'QYVsHeRe5gOxntBAUyZaCvtF4Exc2T/JkhGMNwBgbopejYPSGpH5+lGoRpwoSF0R+9Q5IR0jZUoLIg3nR91Koot7sIE6WzdaeRVXP0NTFVgPVUZmbH7E1q3NqJU0nNSD45+wXVZfbThZrfw5eVYFUeVicukXqcTtZpXiY/Efu76fgl+ePVkAYM+F/nqGPA/Tk8NG0KAIKBoZylr+OVh6wlwECpfRv0IAxRfvvv+7o6S0ebxbGDd2C2XXnoNooP/ZHarM0wI+F5XGOWXPD7Baj/KuzcuPC3d5I+VRLhnk1fm/XRskNucIQZW/X30P4LBCPhheSHPksHm2UpJZe7AP4Q==',
      'wechatpay-signature-type': 'WECHATPAY2-SHA256-RSA2048',
      pragma: 'no-cache',
      'wechatpay-timestamp': '1673663801'
    }

我的代码 image

参考 https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_2_5.shtml

qingfengmy commented 3 months ago

请问大佬,associated_data取哪个值?