yansongda / pay

可能是我用过的最优雅的 Alipay/WeChat/Douyin/Unipay/江苏银行 的支付 SDK 扩展包了
http://pay.yansongda.cn
MIT License
5.01k stars 1.03k forks source link

分账添加接收方失败 #1022

Closed gm-fire closed 4 days ago

gm-fire commented 2 weeks ago

包版本号

v3.x

问题描述

分账添加接收方失败

你的代码

image

报错详情

appid 没法赋值进去body

sdk 日志

2024-08-29T17:13:08.018070+08:00 > yansongda.pay.INFO > [wechat][LaunchPlugin] 插件装载完毕 {"rocket":{"Yansongda\Pay\Rocket":{"radar":{"url":"https://api.mch.weixin.qq.com/v3/profitsharing/receivers/add","method":"POST","headers":{"Host":["api.mch.weixin.qq.com"],"Accept":["application/json, text/plain, application/x-gzip"],"User-Agent":["yansongda/pay-v3"],"Content-Type":["application/json; charset=utf-8"],"Authorization":["WECHATPAY2-SHA256-RSA2048 mchid=\"13xxxxx325\",nonce_str=\"sBPFZ4YamOy8BH62xre8a8dc5sYtXLE1\",timestamp=\"1724922787\",serial_no=\"42007A09390BC6B38B2C045DCB0FED2DE67FC5FF\",signature=\"Sa3uA3udddddk5mYTX4+shV6KD2uTVb/Ng+FMjcaraQtsp/l86hvkV5CEghb/LeJsF72oWnQJk3y6pa66WYlx4g1oUj+qm+oUhbg90zl8kIRHNu8EuPRb4b5tZ0343IdwauYqxRz9nxTELC/MZmP2JQWw==\""]},"body":"{\"appid\":\"\",\"type\":\"PERSONAL_OPENID\",\"account\":\"xxxx--3s1LT_TtmY\",\"relation_type\":\"STAFF\"}"},"params":{"appid":"wx3084xxxx","type":"PERSONAL_OPENID","account":"xxxx--3s1LT_TtmY","relation_type":"STAFF"},"payload":{"appid":"","type":"PERSONAL_OPENID","account":"xxxx--3s1LT_TtmY","relation_type":"STAFF"},"packer":"Yansongda\Pay\Contract\PackerInterface","direction":"Yansongda\Pay\Contract\DirectionInterface","destination":{"code":"PARAM_ERROR","detail":{"location":"body","value":0},"message":"输入源“/body/appid”映射到值字段“公众账号ID”字符串规则校验失败,字符数 0,小于最小值 1"},"destination_origin":{}}}}

以上内容只做隐私处理

nginx/apache 日志

涉及到 异步通知、同步通知 的问题,请贴出来

yansongda commented 2 weeks ago

Pay::config($config) 中的 $config 配置不对吧

gm-fire commented 2 weeks ago

Pay::config($config) 中的 $config 配置不对吧

array(4) { ["wechat"]=> array(1) { ["default"]=> array(27) { ["appid"]=> string(0) "" ["app_id"]=> string(0) "" ["app_secret"]=> string(0) "" ["miniapp_id"]=> string(18) "wx3xxxf5" ["mch_id"]=> string(10) "16xxx5" ["key"]=> string(32) "OnxxxV" ["key_v3"]=> string(32) "r4xxx8" ["mode"]=> int(0) ["sub_mch_id"]=> string(0) "" ["sub_appid"]=> string(0) "" ["sub_app_id"]=> string(0) "" ["sub_miniapp_id"]=> string(0) "" ["notify_url"]=> string(66) "/notifyx/type/wechat" ["cert_client"]=> string(60) "/certs/apiclient_cert.pem" ["cert_key"]=> string(59) "/certs/apiclient_key.pem" ["log"]=> array(3) { ["enable"]=> bool(true) ["file"]=> string(66) "/epaylogs/wechat-2024-08-29.log" ["level"]=> string(5) "debug" } ["profit_sharing"]=> string(1) "1" ["mp_app_id"]=> string(0) "" ["mini_app_id"]=> string(18) "wx30xxxxx8bdf5" ["combine_mch_id"]=> string(0) "" ["mch_secret_key"]=> string(32) "r4xxxA8" ["mch_secret_cert"]=> string(59) "/certs/apiclient_key.pem" ["mch_public_cert_path"]=> string(60) "/certs/apiclient_cert.pem" ["sub_mp_app_id"]=> string(0) "" ["sub_mini_app_id"]=> string(0) "" ["http"]=> array(2) { ["timeout"]=> int(10) ["connect_timeout"]=> int(10) } ["return_url"]=> string(66) "/returnx/type/wechat" } } ["logger"]=> array(3) { ["enable"]=> bool(true) ["file"]=> string(66) "/epaylogs/wechat-2024-08-29.log" ["level"]=> string(5) "debug" } ["http"]=> array(2) { ["timeout"]=> int(10) ["connect_timeout"]=> int(10) } ["_force"]=> bool(true) }

config打印出来appid确实是空的,但是mini_app_id有值,微信小程序不是调用mini_app_id吗?

gm-fire commented 2 weeks ago
image

加上'_type' => 'mini'一样的报错

yansongda commented 2 weeks ago

可以自行debug 一下:https://github.com/yansongda/pay/blob/master/src/Plugin/Wechat/V3/Extend/ProfitSharing/AddReceiverPlugin.php#L79

gm-fire commented 2 weeks ago

可以自行debug 一下:https://github.com/yansongda/pay/blob/master/src/Plugin/Wechat/V3/Extend/ProfitSharing/AddReceiverPlugin.php#L79

ok

yansongda commented 1 week ago

这个咱们后来有结论么?

gm-fire commented 4 days ago

这个咱们后来有结论么?

我是把小程序的appid给公众号appid也写上去就可以了。应该是我使用的版本有点落后了。

image
yansongda commented 4 days ago

那应该是版本落后了。。。

方便的时候可以升级一下