w7corp / easywechat

📦 一个 PHP 微信 SDK
https://easywechat.com
MIT License
10.27k stars 2.4k forks source link

Unsupported option "appid" passed to "Symfony\Component\HttpClient\CurlHttpClient" #2708

Closed jiningrich closed 1 year ago

jiningrich commented 1 year ago

我用的环境

问题及现象

调用付款码支付API post方法才不报错,能正确返回,使用postXml与postJson都会报同样的错误 配置是复制的文档 https://easywechat.com/6.x/pay/index.html 的 $config参数,进行配置,下面post成功与 postXml 和 postJson 失败均使用一个配置,同一个EasyWeChat\Pay\Application实例

$response = $app->getClient()->postXml(('pay/micropay', [
参数和下面一样
])
$response = $app->getClient()->postJson('pay/micropay', [
            "appid" => '自己服务号的APPID',
            "mch_id" => $account->getMerchantId(),
            'out_trade_no' => time(),
            'body' => '测试',
            'total_fee' => 1,
            'spbill_create_ip' => '自己的IP4地址',
            'auth_code' => ‘自己微信付款码’,
        ]);

//报错
Symfony\ Component\ HttpClient\ Exception\ InvalidArgumentException

Unsupported option "appid" passed to "Symfony\Component\HttpClient\CurlHttpClient", did you mean "timeout", "headers", "normalized_headers", "query", "auth_basic", "auth_bearer", "body", "json", "user_data", "max_redirects", "http_version", "base_uri", "buffer", "on_progress", "resolve", "proxy", "no_proxy", "max_duration", "bindto", "verify_peer", "verify_host", "cafile", "capath", "local_cert", "local_pk", "passphrase", "ciphers", "peer_fingerprint", "capture_peer_cert_chain", "crypto_method", "extra", "auth_ntlm"?

post 调用付款码支付API成功代码

$response = $app->getClient()->post('pay/micropay', [
            'xml' =>[
                "appid" => '自己服务号的APPID',
                "mch_id" => $account->getMerchantId(),
                'out_trade_no' => time(),
                'body' => '测试',
                'total_fee' => 1,
                'spbill_create_ip' => '自己的IP4地址',
                'auth_code' => ‘自己微信付款码’,
            ]
        ])