PayPal订阅获取交易清单

问题描述 投票:0回答:1

我正在建立在线商店。目前我在https://api.sandbox.paypal.com

我创建了订阅,客户批准了。一切正常,如文档中所述。在这里

https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions

现在,我需要获取此订阅的实际付款,以使我的门户与Paypal付款同步。

我猜我需要按这里的说明List transactions for subscription

https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_transactions

但是当我调用此路径时

/v1/billing/subscriptions/I-T99999999999/transactions?start_time=2014-11-11T05:09:16.000Z&end_time=2020-11-11T05:09:16.000Z

我正在获取空数组作为响应。即使没有交易,我也希望具有这样的结构:

{
  "transactions": [],
  "links": [
    {
      "href": "https://api.paypal.com/v1/billing/subscriptions/I-T99999999999/transactions?start_time=2014-11-11T05:09:16.000Z&end_time=2020-11-11T05:09:16.000Z",
      "rel": "self",
      "method": "GET"
    }
  ]
}

但是我得到的是没有错误的空响应。

php paypal-subscriptions
1个回答
1
投票

我正面临着同样的问题,但我发现可以解决的问题。

我可以通过从计费协议中调用不赞成使用的方法来列出订阅交易。

v1/payments/billing-agreements/{{0}}/transactions?start_date={{1}}&end_date={{2}}

链接到文档:

https://developer.paypal.com/docs/api/payments.billing-agreements/v1/#billing-agreements_transactions

您将获得这样的示例响应:

{
    "agreement_transaction_list": [{
        "transaction_id": "I-WBT8MCXV1XD5",
        "status": "Created",
        "transaction_type": "Recurring Payment",
        "payer_name": "Test Payer",
        "time_stamp": "2019-11-17T01:36:59Z",
        "time_zone": "GMT"
    }, {
        "transaction_id": "2V3487226T084702S",
        "status": "Updated",
        "transaction_type": "Recurring Payment",
        "amount": {
            "currency": "BRL",
            "value": "-24.90"
        },
        "fee_amount": {
            "currency": "BRL",
            "value": "0.00"
        },
        "net_amount": {
            "currency": "BRL",
            "value": "-24.90"
        },
        "payer_email": "[email protected]",
        "payer_name": "John Doe's Test Store",
        "time_stamp": "2019-11-17T01:37:01Z",
        "time_zone": "GMT"
    }]
}
© www.soinside.com 2019 - 2024. All rights reserved.