【问题标题】:PayPal Confirm Payment Made From iOsPayPal 确认从 iOs 进行的付款
【发布时间】:2015-01-06 17:07:14
【问题描述】:

我正在使用以下代码

    $header = array(
                    'Accept' => 'application/json',
                    'Authorization' => 'Bearer ' . $accessToken );

    $url = 'https://api.sandbox.paypal.com/v1/payments/payment/' . $data['PaymentId'];

    //cURL starts
    $crl = curl_init();
    curl_setopt($crl, CURLOPT_URL, $url);
    curl_setopt($crl, CURLOPT_HTTPHEADER,$header);
    curl_setopt($crl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($crl, CURLOPT_HTTPGET,true);
    $reply = curl_exec($crl);

   //error handling for cURL
    if ($reply === false) {
       print_r('Curl error: ' . curl_error($crl));
    }
    curl_close($crl);
    //cURL ends

    //decoding the json data
    $decoded_data = json_decode($reply, true);

虽然标题等看起来不错,但响应为空。我需要 curl 到 PayPal 以检查应用上的付款是否成功。

【问题讨论】:

    标签: php curl paypal


    【解决方案1】:

    $header 应该是这样的:

    $header = array('Accept:application/json', 'Authorization: Bearer ' . $accessToken);

    注意这里没有使用=>,直接添加表头项即可

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-01-19
      • 2016-08-22
      • 2011-12-02
      • 1970-01-01
      • 1970-01-01
      • 2011-12-24
      • 2014-08-23
      • 2017-06-21
      相关资源
      最近更新 更多