收藏
回答

您好,我在微信支付获取prepay_id时,为什么总是报错

总是报以下错:
Fatal error: in /www/qdpay/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 113

以下是代码
<?php
require_once('../vendor/autoload.php');


use GuzzleHttp\Client;


$client = new Client([
    // Base URI is used with relative requests
    'base_uri' => 'http://httpbin.org',
    // You can set any number of default request options.
    'timeout'  => 2.0,
]);
 
$url = 'https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi';
$arr =  ['json' => [
                "time_expire" => $time_expire,
                "amount" => [
                    "total" => 1,
                    "currency" => "CNY",
                ],
                "mchid" => "1582664661",
                "description" => "7dpay test",
                "notify_url" => "https://qdpay.gxczxx.com/qiduopay/pay_back.php",
                "payer" => [
                    "openid" => "owNrd4tKptbKTYU8k9fTycaciVL4",
                ],
                "out_trade_no" => "0000001",
                "goods_tag" => "WXG",
                "appid" => "wxe1b79231dce61413",
                "attach" => "hello",
                "scene_info" => []
            ],
            'headers' => [ 'Accept' => 'application/json' ]
        ];


$response = $client->request('POST', $url, $arr);
print_r($response);
?>
回答关注问题邀请回答
收藏
登录 后发表内容