通过rest api执行paypal付款时始终获得INVALID_RESOURCE_ID

时间:2017-01-16 07:41:42

标签: paypal paypal-sandbox paypal-rest-sdk

请帮助!

当执行paypal批准的付款时,我总是低于JSON响应,这让我非常沮丧:(

{
  "name": "INVALID_RESOURCE_ID",
  "message": "Requested resource ID was not found.",
  "information_link": "https://developer.paypal.com/webapps/developer/docs/api/#INVALID_RESOURCE_ID",
  "debug_id": "a09bc8e96fc48"
}

这是我的papal api请求代码,与paypal文档相同

$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.sandbox.paypal.com/v1/payments/payment/PAY-18X32451H0459092JKO7KFUI/execute",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\"payer_id\": \"<Some id here>\"}",
  CURLOPT_HTTPHEADER => array(
    "authorization: Bearer A101.gMSMRy4uGwjHLcnY4mbzRXLkm9ct0wfPl2M5sV82B3rO01L_ipJHyA65kbIg8kz9.2_AHXRp5zZaZSEfqz-P3x8eai9y",
    "cache-control: no-cache",
    "content-type: application/json"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

请帮忙。

0 个答案:

没有答案