Closed lee-stars closed 1 month ago
try catch 查看微信返回的具体错误信息,按照错误信息处理即可,一般是传递的参数类型错误
try catch 查看微信返回的具体错误信息,按照错误信息处理即可,一般是传递的参数类型错误
我先去查看一下,感谢老哥
try catch 查看微信返回的具体错误信息,按照错误信息处理即可,一般是传递的参数类型错误
老哥,好像并没有什么有效的信息呢,如下:
Yansongda\Artful\Exception\InvalidResponseException: 微信返回状态码异常,请检查参数是否错误 in D:\information\api\vendor\yansongda\pay\src\Plugin\Wechat\ResponsePlugin.php:43 Stack trace: #0 D:\information\api\vendor\yansongda\pay\src\Plugin\Wechat\ResponsePlugin.php(27): Yansongda\Pay\Plugin\Wechat\ResponsePlugin->validateResponse(Object(Yansongda\Artful\Rocket)) #1 D:\information\api\vendor\yansongda\supports\src\Pipeline.php(93): Yansongda\Pay\Plugin\Wechat\ResponsePlugin->assembly(Object(Yansongda\Artful\Rocket), Object(Closure)) #2 D:\information\api\vendor\yansongda\pay\src\Plugin\Wechat\V3\VerifySignaturePlugin.php(34): Yansongda\Supports\Pipeline->Yansongda\Supports\{closure}(Object(Yansongda\Artful\Rocket)) #3 D:\information\api\vendor\yansongda\supports\src\Pipeline.php(93): Yansongda\Pay\Plugin\Wechat\V3\VerifySignaturePlugin->assembly(Object(Yansongda\Artful\Rocket), Object(Closure)) #4 D:\information\api\vendor\yansongda\pay\src\Plugin\Wechat\V3\Pay\Mini\InvokePlugin.php(41): Yansongda\Supports\Pipeline->Yansongda\Supports\{closure}(Object(Yansongda\Artful\Rocket)) #5 D:\information\api\vendor\yansongda\supports\src\Pipeline.php(93): Yansongda\Pay\Plugin\Wechat\V3\Pay\Mini\InvokePlugin->assembly(Object(Yansongda\Artful\Rocket), Object(Closure)) #6 D:\information\api\vendor\yansongda\pay\src\Plugin\Wechat\AddRadarPlugin.php(46): Yansongda\Supports\Pipeline->Yansongda\Supports\{closure}(Object(Yansongda\Artful\Rocket)) #7 D:\information\api\vendor\yansongda\supports\src\Pipeline.php(93): Yansongda\Pay\Plugin\Wechat\AddRadarPlugin->assembly(Object(Yansongda\Artful\Rocket), Object(Closure)) #8 D:\information\api\vendor\yansongda\pay\src\Plugin\Wechat\V3\AddPayloadSignaturePlugin.php(52): Yansongda\Supports\Pipeline->Yansongda\Supports\{closure}(Object(Yansongda\Artful\Rocket)) #9 D:\information\api\vendor\yansongda\supports\src\Pipeline.php(93): Yansongda\Pay\Plugin\Wechat\V3\AddPayloadSignaturePlugin->assembly(Object(Yansongda\Artful\Rocket), Object(Closure)) #10 D:\information\api\vendor\yansongda\artful\src\Plugin\AddPayloadBodyPlugin.php(31): Yansongda\Supports\Pipeline->Yansongda\Supports\{closure}(Object(Yansongda\Artful\Rocket)) #11 D:\information\api\vendor\yansongda\supports\src\Pipeline.php(93): Yansongda\Artful\Plugin\AddPayloadBodyPlugin->assembly(Object(Yansongda\Artful\Rocket), Object(Closure)) #12 D:\information\api\vendor\yansongda\pay\src\Plugin\Wechat\V3\Pay\Mini\PayPlugin.php(59): Yansongda\Supports\Pipeline->Yansongda\Supports\{closure}(Object(Yansongda\Artful\Rocket)) #13 D:\information\api\vendor\yansongda\supports\src\Pipeline.php(93): Yansongda\Pay\Plugin\Wechat\V3\Pay\Mini\PayPlugin->assembly(Object(Yansongda\Artful\Rocket), Object(Closure)) #14 D:\information\api\vendor\yansongda\artful\src\Plugin\StartPlugin.php(22): Yansongda\Supports\Pipeline->Yansongda\Supports\{closure}(Object(Yansongda\Artful\Rocket)) #15 D:\information\api\vendor\yansongda\supports\src\Pipeline.php(93): Yansongda\Artful\Plugin\StartPlugin->assembly(Object(Yansongda\Artful\Rocket), Object(Closure)) #16 D:\information\api\vendor\yansongda\supports\src\Pipeline.php(57): Yansongda\Supports\Pipeline->Yansongda\Supports\{closure}(Object(Yansongda\Artful\Rocket)) #17 D:\information\api\vendor\yansongda\artful\src\Artful.php(257): Yansongda\Supports\Pipeline->then(Object(Closure)) #18 D:\information\api\vendor\yansongda\artful\src\Artful.php(236): Yansongda\Artful\Artful::artful(Array, Array) #19 D:\information\api\vendor\yansongda\pay\src\Provider\Wechat.php(63): Yansongda\Artful\Artful::shortcut('\\Yansongda\\Pay\\...', Array) #20 D:\information\api\app\Http\Controllers\Api\WechatPayController.php(42): Yansongda\Pay\Provider\Wechat->__call('mini', Array) #21 D:\information\api\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php(46): App\Http\Controllers\Api\WechatPayController->pay() #22 D:\information\api\vendor\laravel\framework\src\Illuminate\Routing\Route.php(260): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(App\Http\Controllers\Api\WechatPayController), 'pay') #23 D:\information\api\vendor\laravel\framework\src\Illuminate\Routing\Route.php(206): Illuminate\Routing\Route->runController() #24 D:\information\api\vendor\laravel\framework\src\Illuminate\Routing\Router.php(806): Illuminate\Routing\Route->run() #25 D:\information\api\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(144): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #26 D:\information\api\vendor\laravel\framework\src\Illuminate\Routing\Middleware\SubstituteBindings.php(50): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #27 D:\information\api\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(183): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure)) #28 D:\information\api\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(119): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #29 D:\information\api\vendor\laravel\framework\src\Illuminate\Routing\Router.php(805): Illuminate\Pipeline\Pipeline->then(Object(Closure)) #30 D:\information\api\vendor\laravel\framework\src\Illuminate\Routing\Router.php(784): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request)) #31 D:\information\api\vendor\laravel\framework\src\Illuminate\Routing\Router.php(748): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route)) #32 D:\information\api\vendor\laravel\framework\src\Illuminate\Routing\Router.php(737): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request)) #33 D:\information\api\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(200): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request)) #34 D:\information\api\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(144): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request)) #35 D:\information\api\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #36 D:\information\api\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull.php(31): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure)) #37 D:\information\api\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(183): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle(Object(Illuminate\Http\Request), Object(Closure)) #38 D:\information\api\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #39 D:\information\api\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TrimStrings.php(51): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure)) #40 D:\information\api\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(183): Illuminate\Foundation\Http\Middleware\TrimStrings->handle(Object(Illuminate\Http\Request), Object(Closure)) #41 D:\information\api\vendor\laravel\framework\src\Illuminate\Http\Middleware\ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #42 D:\information\api\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(183): Illuminate\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure)) #43 D:\information\api\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance.php(110): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #44 D:\information\api\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(183): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle(Object(Illuminate\Http\Request), Object(Closure)) #45 D:\information\api\vendor\laravel\framework\src\Illuminate\Http\Middleware\HandleCors.php(62): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #46 D:\information\api\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(183): Illuminate\Http\Middleware\HandleCors->handle(Object(Illuminate\Http\Request), Object(Closure)) #47 D:\information\api\vendor\laravel\framework\src\Illuminate\Http\Middleware\TrustProxies.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #48 D:\information\api\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(183): Illuminate\Http\Middleware\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure)) #49 D:\information\api\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(119): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #50 D:\information\api\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(175): Illuminate\Pipeline\Pipeline->then(Object(Closure)) #51 D:\information\api\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(144): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request)) #52 D:\information\api\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(1172): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request)) #53 D:\information\api\public\index.php(17): Illuminate\Foundation\Application->handleRequest(Object(Illuminate\Http\Request)) #54 {main}
dd 出 InvalidResponseException 就能看到
dd 出 InvalidResponseException 就能看到
嘿嘿,感谢老哥回复,我直接在validateResponse打印的,提示Yansongda\Artful\Exception\InvalidResponseException: 受理机构必须传入sub_mch_id ,但是我在配置文件中是传了的,配置文件如下:
`<?php
use Yansongda\Pay\Pay;
return [ 'alipay' => [ 'default' => [ // 必填-支付宝分配的 app_id 'app_id' => '2016082000295641', // 必填-应用私钥 字符串或路径 // 在 https://open.alipay.com/develop/manage 《应用详情->开发设置->接口加签方式》中设置 'app_secret_cert' => 'MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCDRjOg5DnX+8L+rB8d2MbrQ30Z7JPM4hiDhawHSwQCQ7RlmQNpl6b/N6IrPLcPFC1uii179U5Il5xTZynfjkUyJjnHusqnmHskftLJDKkmGbSUFMAlOv+NlpUWMJ2A+VUopl+9FLyqcV+XgbaWizxU3LsTtt64v89iZ2iC16H6/6a3YcP+hDZUjiNGQx9cuwi9eJyykvcwhDkFPxeBxHbfwppsul+DYUyTCcl0Ltbga/mUechk5BksW6yPPwprYHQBXyM16Jc3q5HbNxh3660FyvUBFLuVWIBs6RtR2gZCa6b8rOtCkPQKhUKvzRMlgheOowXsWdk99GjxGQDK5W4XAgMBAAECggEAYPKnjlr+nRPBnnNfR5ugzH67FToyrU0M7ZT6xygPfdyijaXDb2ggXLupeGUOjIRKSSijDrjLZ7EQMkguFHvtfmvcoDTDFaL2zq0a3oALK6gwRGxOuzAnK1naINkmeOmqiqrUab+21emEv098mRGbLNEXGCgltCtz7SiRdo/pgIPZ1wHj4MH0b0K2bFG3xwr51EyaLXKYH4j6w9YAXXsTdvzcJ+eRE0Yq4uGPfkziqg8d0xXSEt90HmCGHKo4O2eh1w1IlBcHfK0F6vkeUAtrtAV01MU2bNoRU147vKFxjDOVBlY1nIZY/drsbiPMuAfSsodL0hJxGSYivbKTX4CWgQKBgQDd0MkF5AIPPdFC+fhWdNclePRw4gUkBwPTIUljMP4o+MhJNrHp0sEy0sr1mzYsOT4J20hsbw/qTnMKGdgy784bySf6/CC7lv2hHp0wyS3Es0DRJuN+aTyyONOKGvQqd8gvuQtuYJy+hkIoHygjvC3TKndX1v66f9vCr/7TS0QPywKBgQCXgVHERHP+CarSAEDG6bzI878/5yqyJVlUeVMG5OXdlwCl0GAAl4mDvfqweUawSVFE7qiSqy3Eaok8KHkYcoRlQmAefHg/C8t2PNFfNrANDdDB99f7UhqhXTdBA6DPyW02eKIaBcXjZ7jEXZzA41a/zxZydKgHvz4pUq1BdbU5ZQKBgHyqGCDgaavpQVAUL1df6X8dALzkuqDp9GNXxOgjo+ShFefX/pv8oCqRQBJTflnSfiSKAqU2skosdwlJRzIxhrQlFPxBcaAcl0VTcGL33mo7mIU0Bw2H1d4QhAuNZIbttSvlIyCQ2edWi54DDMswusyAhHxwz88/huJfiad1GLaLAoGASIweMVNuD5lleMWyPw2x3rAJRnpVUZTc37xw6340LBWgs8XCEsZ9jN4t6s9H8CZLiiyWABWEBufU6z+eLPy5NRvBlxeXJOlq9iVNRMCVMMsKybb6b1fzdI2EZdds69LSPyEozjkxdyE1sqH468xwv8xUPV5rD7qd83+pgwzwSJkCgYBrRV0OZmicfVJ7RqbWyneBG03r7ziA0WTcLdRWDnOujQ9orhrkm+EY2evhLEkkF6TOYv4QFBGSHfGJ0SwD7ghbCQC/8oBvNvuQiPWI8B+00LwyxXNrkFOxy7UfIUdUmLoLc1s/VdBHku+JEd0YmEY+p4sjmcRnlu4AlzLxkWUTTg==', // 必填-应用公钥证书 路径 // 设置应用私钥后,即可下载得到以下3个证书 'app_public_cert_path' => '/Users/yansongda/pay/cert/appCertPublicKey_2016082000295641.crt', // 必填-支付宝公钥证书 路径 'alipay_public_cert_path' => '/Users/yansongda/pay/cert/alipayCertPublicKey_RSA2.crt', // 必填-支付宝根证书 路径 'alipay_root_cert_path' => '/Users/yansongda/pay/cert/alipayRootCert.crt', 'return_url' => 'https://yansongda.cn/alipay/return', 'notify_url' => 'https://yansongda.cn/alipay/notify', // 选填-第三方应用授权token 'app_auth_token' => '', // 选填-服务商模式下的服务商 id,当 mode 为 Pay::MODE_SERVICE 时使用该参数 'service_provider_id' => '', // 选填-默认为正常模式。可选为: MODE_NORMAL, MODE_SANDBOX, MODE_SERVICE 'mode' => Pay::MODE_NORMAL, ] ], 'wechat' => [ 'default' => [ // 必填-商户号,服务商模式下为服务商商户号 // 可在 https://pay.weixin.qq.com/ 账户中心->商户信息 查看 'mch_id' => '1601008510', // 选填-v2商户私钥 'mch_secret_key_v2' => '', // 必填-v3 商户秘钥 // 即 API v3 密钥(32字节,形如md5值),可在 账户中心->API安全 中设置 'mch_secret_key' => 'x6piZLS88888888yFD3vGEu0BFwoxX33', // 必填-商户私钥 字符串或路径 // 即 API证书 PRIVATE KEY,可在 账户中心->API安全->申请API证书 里获得 // 文件名形如:apiclient_key.pem 'mch_secret_cert' => base_path() . DIRECTORY_SEPARATOR . 'cert' . DIRECTORY_SEPARATOR .'apiclient_key.pem', // 必填-商户公钥证书路径 // 即 API证书 CERTIFICATE,可在 账户中心->API安全->申请API证书 里获得 // 文件名形如:apiclient_cert.pem 'mch_public_cert_path' => base_path() . DIRECTORY_SEPARATOR . 'cert' . DIRECTORY_SEPARATOR .'apiclient_cert.pem', // 必填-微信回调url // 不能有参数,如?号,空格等,否则会无法正确回调 'notify_url' => 'https://yansongda.cn/wechat/notify', // 选填-公众号 的 app_id // 可在 mp.weixin.qq.com 设置与开发->基本配置->开发者ID(AppID) 查看 'mp_app_id' => '', // 选填-小程序 的 app_id 'mini_app_id' => '', // 选填-app 的 app_id 'app_id' => '', // 选填-服务商模式下,子公众号 的 app_id 'sub_mp_app_id' => '', // 选填-服务商模式下,子 app 的 app_id 'sub_app_id' => '', // 选填-服务商模式下,子小程序 的 app_id 'sub_mini_app_id' => '', // 选填-服务商模式下,子商户id 'sub_mch_id' => '168411234', // 选填-微信平台公钥证书路径, optional,强烈建议 php-fpm 模式下配置此参数 'wechat_public_cert_path' => [ // '45F59D4DABF31918AFCEC556D5D2C6E376675D57' => DIR.'/Cert/wechatPublicKey.crt', ], // 选填-默认为正常模式。可选为: MODE_NORMAL, MODE_SERVICE 'mode' => Pay::MODE_NORMAL, ] ], 'unipay' => [ 'default' => [ // 必填-商户号 'mch_id' => '777290058167151', // 选填-商户密钥:为银联条码支付综合前置平台配置:https://up.95516.com/open/openapi?code=unionpay 'mch_secret_key' => '979da4cfccbae7923641daa5dd7047c2', // 必填-商户公私钥 'mch_cert_path' => DIR.'/Cert/unipayAppCert.pfx', // 必填-商户公私钥密码 'mch_cert_password' => '000000', // 必填-银联公钥证书路径 'unipay_public_cert_path' => DIR.'/Cert/unipayCertPublicKey.cer', // 必填 'return_url' => 'https://yansongda.cn/unipay/return', // 必填 'notify_url' => 'https://yansongda.cn/unipay/notify', 'mode' => Pay::MODE_NORMAL, ], ], 'douyin' => [ 'default' => [ // 选填-商户号 // 抖音开放平台 --> 应用详情 --> 支付信息 --> 产品管理 --> 商户号 'mch_id' => '73744242495132490630', // 必填-支付 Token,用于支付回调签名 // 抖音开放平台 --> 应用详情 --> 支付信息 --> 支付设置 --> Token(令牌) 'mch_secret_token' => 'douyin_mini_token', // 必填-支付 SALT,用于支付签名 // 抖音开放平台 --> 应用详情 --> 支付信息 --> 支付设置 --> SALT 'mch_secret_salt' => 'oDxWDBr4U7FAAQ8hnGDm29i4A6pbTMDKme4WLLvA', // 必填-小程序 app_id // 抖音开放平台 --> 应用详情 --> 支付信息 --> 支付设置 --> 小程序appid 'mini_app_id' => 'tt226e54d3bd581bf801', // 选填-抖音开放平台服务商id 'thirdparty_id' => '', // 选填-抖音支付回调地址 'notify_url' => 'https://yansongda.cn/douyin/notify', ], ], 'jsb' => [ 'default' => [ // 服务代码 'svr_code' => '', // 必填-合作商ID 'partner_id' => '', // 必填-公私钥对编号 'public_key_code' => '00', // 必填-商户私钥(加密签名) 'mch_secret_cert_path' => '', // 必填-商户公钥证书路径(提供江苏银行进行验证签名用) 'mch_public_cert_path' => '', // 必填-江苏银行的公钥(用于解密江苏银行返回的数据) 'jsb_public_cert_path' => '', //支付通知地址 'notify_url' => '', // 选填-默认为正常模式。可选为: MODE_NORMAL:正式环境, MODE_SANDBOX:测试环境 'mode' => Pay::MODE_NORMAL, ], ], 'logger' => [ 'enable' => false, 'file' => './logs/pay.log', 'level' => 'info', // 建议生产环境等级调整为 info,开发环境为 debug 'type' => 'single', // optional, 可选 daily. 'max_file' => 30, // optional, 当 type 为 daily 时有效,默认 30 天 ], 'http' => [ // optional 'timeout' => 5.0, 'connect_timeout' => 5.0, // 更多配置项请参考 Guzzle ], ];`
麻烦老哥给点拨一下,是服务商模式需要额外的设置,还是说传入的参数不一样么~~~
感谢作者制作好用的工具,今天使用了laravel接入了laravel-pay和composer require yansongda/pay:~3.7.0 -vvv,按照文档配置都提示标题错误【微信返回状态码异常,请检查参数是否错误】,具体错误信息应该怎么样排查呢?