嗨,我正在尝试集成Hubtel Payment Gateway,但将数组转换为字符串转换错误异常。
如果我执行CURLOPT_POSTFIELDS => http_build_query($ invoice),则收到空白响应
请帮助
$items = ["name" => "Harry Potter", "quantity" => 1, "unitPrice" => 50];
$invoice = array("items" => $items, "totalAmount" => 1, "description" => "test", "callbackUrl" => "https://localhost:8000/status","returnUrl"=>"https://localhost:8000/return","cancellationUrl"=>"https://localhost:8000/cancel",
"merchantBusinessLogoUrl"=>"https://localhost:8000/wallet","merchantAccountNumber"=>"HM0409180006","clientReference"=> '1');
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.hubtel.com/v2/pos/onlinecheckout/items/initiate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $invoice,
CURLOPT_HTTPHEADER => array(
"Authorization: Basic bjJXS0o1Qjo0saMWU4NzA4ZS0wODVkLTQ0NDwUtOTQ3ZS1hZjBiODlkNzI1OWY=",
"Content-Type: application/json",
"Postman-Token: 2bd373c8-3669-4f5f-93e9-d3001af0a9cff",
"cache-control: no-cache"
),
));