本文介绍了PayPal REST API的“列出付款"不返回任何条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用PayPal REST API来获取付款清单.通常,这些付款将通过eBay支付.

I'm trying to use PayPal REST API to get a list of payments. Typically these payments will have been made via eBay.

当我尝试沙盒时,我可以获取令牌,然后按预期获取付款清单.但是当我切换到实时状态时,列表始终为空.

When I try the sandbox I can get a token, and then get a list of payments as expected. But when I switch to live the list is always empty.

例如,使用curl:

curl https://api.paypal.com/v1/oauth2/token \
 -H "Accept: application/json" \
 -H "Accept-Language: en_US" \
 -u "ASnXAXXXXXXXXXXXXXXXXXXXXXPP7sBaB:EGWXXXXXXXXXXXXXXXXXXXXXXXs-NU" \
 -d "grant_type=client_credentials"

<response>
{"scope":"https://api.paypal.com/v1/payments/.* https://api.paypal.com/v1/vault /credit-card https://api.paypal.com/v1/vault/credit-card/.* openid","access_token":"dzXXXXXXXXXXXXXXXXXXHJs-XXXXXA","token_type":"Bearer","app_id":"APP-1JCXXXXXXXXXXX08","expires_in":28800}

然后,我从响应正文中获取令牌,并调用付款清单资源:

Then I take the token from the response body and call the payments list resource:

 curl -v -X GET https://api.paypal.com/v1/payments/payment \
 -H "Content-Type:application/json" \
 -H "Authorization: Bearer dzXXXXXXXXXXXXXXXXXXHJs-XXXXXA"

<response>
{"count":0}

帐户中实际上有付款,所以我做错什么了吗?我还没有设法用谷歌搜索出任何有用的答案.我在一篇帖子中看到一条建议,也许只有通过REST API进行的付款才由REST API返回?如果是这种情况(那么其余的API将被有限地使用),那么还有另一种方法来获取已收到的付款清单吗?再说一次,到目前为止,我在Paypal文档或Google中找不到一个是幸运的.

There are actually payments in the account, so am I doing something wrong? I've not managed to google up any useful answers. I saw a suggestion on one post that maybe only payments made via the REST API are returned by the REST API? If that is the case (then the rest API would be of limited used) then is there another way to get a list of payments received? Again, I've had no luck in finding one in the paypal docs or google so far.

感谢您的任何建议或帮助.

Thanks for any advice or help.

推荐答案

我也遇到了这个问题.奇怪的是,PayPal REST API似乎仅返回通过 REST API进行付款的结果.看到这里: https://stackoverflow.com/a/18139747

I also ran into this issue. Strangely, It seems that the PayPal REST API only returns results for payments made through the REST API. See here: https://stackoverflow.com/a/18139747

在改进REST API之前,经典API仍将是这样做的方法.

Classic API will remain the way to do this until the REST API is improved.

这篇关于PayPal REST API的“列出付款"不返回任何条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 07:19