【问题标题】:Paypal unable to LIST AGREEMENT TRANSACTIONS for an agreement idPaypal 无法列出协议 ID 的协议交易
【发布时间】:2018-05-07 07:30:12
【问题描述】:

我正在使用 Paypal Rest API(计费计划和计费协议 API)在我的 PHP 应用程序中实现订阅支付。

所有 API 都运行良好。只有不工作的 api 将用于搜索 2 个日期之间的交易以达成协议。

我检查了我的请求,它与官方 API 文档中的相同。 https://developer.paypal.com/docs/api/payments.billing-agreements#billing-agreements_transactions

我正在使用 PHP 和 cURL 像这样调用 api:

<?php
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://api.sandbox.paypal.com/v1/payments/billing-agreements/<Agreement-id>/transaction?start_date=2017-06-15&end_date=2017-06-17");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{}");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");

$headers = array();
$headers[] = "Content-Type: application/json";
$headers[] = "Authorization: Bearer <My-Access-Token>";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
curl_close ($ch);
echo '<pre>';
print_r($result);
?>

总是得到这个响应:

{
   name: "MALFORMED_REQUEST",
   message: "The requested resource was not found",
   information_link: "https://developer.paypal.com/webapps/developer/docs/api/#MALFORMED_REQUEST",
   debug_id: "4cf777ecda3b"
}

请帮忙,

【问题讨论】:

    标签: php curl paypal paypal-sandbox paypal-subscriptions


    【解决方案1】:

    所以我发现了问题所在,它在 Paypal API 文档中,在 cURL 代码中我发现了这个:

    样品申请

    curl -v -X GET https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-1TJ3GAGG82Y9/transaction?start_date=2017-06-15&end_date=2017-06-17 \
    -H "Content-Type:application/json" \
    -H "Authorization: Bearer Access-Token" \
    -d '{}'
    

    但 cURL URL 应该是 https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-1TJ3GAGG82Y9/transactions?start_date=2017-06-15&amp;end_date=2017-06-17

    /transaction/ 应该是复数 (/transactions/)。

    【讨论】:

      猜你喜欢
      • 2015-06-20
      • 2014-11-22
      • 2018-07-03
      • 1970-01-01
      • 1970-01-01
      • 2020-10-05
      • 2017-01-18
      • 1970-01-01
      • 2016-03-09
      相关资源
      最近更新 更多