dongpankao6133 2017-11-23 10:50
浏览 73
已采纳

Paypal无法列出协议ID的协议交易

I am using Paypal Rest API (Billing Plan and Billing Agreement API) to implement subscription payment in my PHP application.

All API working perfectly. Only the api not working that will be used to search transactions between 2 dates for an agreement.

I checked my request, it is same as in official API doc. https://developer.paypal.com/docs/api/payments.billing-agreements#billing-agreements_transactions

I am using PHP and cURL to call api like this:

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

Always getting this response:

{
   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"
}

Plz help,

  • 写回答

1条回答 默认 最新

  • dongzouche9108 2017-11-23 13:48
    关注

    So i found whats the issue, it is in Paypal API doc, in cURL code i found this:

    Sample Request

    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 '{}'
    

    but the cURL URL should be https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-1TJ3GAGG82Y9/transactions?start_date=2017-06-15&end_date=2017-06-17

    The /transaction/ should be plural (/transactions/).

    enter image description here

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在sql server里完成筛选
  • ¥15 请问为什么我配置IPsec后PC1 ping不通 PC2,抓包出来数据包也并没有被加密
  • ¥200 求博主教我搞定neo4j简易问答系统,有偿
  • ¥15 nginx的使用与作用
  • ¥100 关于#VijeoCitect#的问题,如何解决?(标签-ar|关键词-数据类型)
  • ¥15 一个矿井排水监控系统的plc梯形图,求各程序段都是什么意思
  • ¥50 安卓10如何在没有root权限的情况下设置开机自动启动指定app?
  • ¥15 ats2837 spi2从机的代码
  • ¥200 wsl2 vllm qwen1.5部署问题
  • ¥100 有偿求数字经济对经贸的影响机制的一个数学模型,弄不出来已经快要碎掉了