Paypal Rest API付款没有给出响应PHP

时间:2019-02-24 17:56:09

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

我遵循了https://developer.paypal.com/docs/integration/direct/create-single-payout/上的示例,但是当我尝试运行代码时,我没有收到错误消息,甚至没有收到来自贝宝的响应。

我已经尝试了几乎所有内容的调整,但是似乎没有任何效果,我读了一些有关SSL问题的文章,因此我继续尝试研究更多有关SSL问题的方法,但找不到任何东西。这是我的php代码:

function payOut(){
   $data = '{
  "sender_batch_header": {
    "email_subject": "You have a payout!",
  },
 "items": [
{
  "recipient_type": "EMAIL",
  "amount": {
    "value": "9.87",
    "currency": "USD"
  },
  "note": "Thanks for your patronage!",
  "sender_item_id": "201403140001",
  "receiver": "yepni@gmail.com"
}
  ]
    }';

 curl_setopt($ch, CURLOPT_URL, 
"https://api.sandbox.paypal.com/v1/payments/payouts?sync_mode=true");
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSLVERSION , 6); //NEW ADDITION
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 

  curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  "Content-Type: application/json",
  "Authorization: Bearer $token", 
  "Content-length: ".strlen($data))
);
}

我的令牌是正确的,从字面上看,我似乎无法获得任何答案。

0 个答案:

没有答案