dpus81500574 2019-04-25 08:24
浏览 81

Curl中的错误异常数组到字符串转换

Hi I'm trying to to Integrate Hubtel Payment Gateway but getting Array to string Conversion Error Exception .

if i do CURLOPT_POSTFIELDS =>http_build_query ($invoice), im getting blank response

please help

  $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"
        ),
      ));

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 划分vlan后不通了
    • ¥15 GDI处理通道视频时总是带有白色锯齿
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)
    • ¥15 自适应 AR 模型 参数估计Matlab程序
    • ¥100 角动量包络面如何用MATLAB绘制
    • ¥15 merge函数占用内存过大
    • ¥15 使用EMD去噪处理RML2016数据集时候的原理
    • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大