2015-01-06 219 views
0

我使用下面的代碼貝寶確認付款由從IOS

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

的響應是空雖然頭等等看行。我需要根據PayPal來檢查在應用上進行的付款是否成功。

回答

0

的$頭應該是這樣的:在這裏沒有使用=>

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

注意,只需直接添加頁眉項目