0

I'm a little confused about the Paypal API and the order in which it works and the relationship between REST and NVP.

My requirement is to access a customers Paypal account, look up sales and perform refunds for them. I don't want them to have to log in everytime but i don't want them to have to log into their own Paypal account and fiddle with the complicated API credential section to grant my application rights - This is too complex for the average user.

What i do want to do is to forward them to a Paypal page that they sign into, which grants me access to their paypal account indefinately with a security token.

I've implemented the Identity routines (https://developer.paypal.com/docs/api/identity/) which allow me get a renewable refresh_token and access_token, however i've realised that this only grants me access to basic profile information (I think?!) as calls to /refund fail with an invalid scope.

What i don't understand, is why Paypal's REST Api has documentation for Sale/Refund via /v1/payments/sale/sale_id/refund but when i try to use it with the access_token from the identity routines, it tells me i don't have the correct scope. It seems like the user has to authorise this every time via a redirection to Paypal?!

I've also found the 'classic' Permissions API which appears to let me do what i want to do (https://developer.paypal.com/docs/classic/permissions-service/integration-guide/PermissionsAbout/) however it seems to use the classic NVP methods of Paypal. I was hoping to use REST and keep it all modern.

The permission section does mention a method called 'GetAccessToken' (https://developer.paypal.com/docs/classic/api/permissions/GetAccessToken_API_Operation/) which appears to return an access token - Can this access token then use used in the REST API where it requires an Access_token (Authorization: Bearer Access-Token')

Do i use the NVP Permission (https://svcs.paypal.com/Permissions/RequestPermissions) to grant myself access via logon, then use the GetAccessToken in classic Paypal to get myself a token for the REST Apis?!

Would someone kindly give me an overview to acheieve this? Grant my application permissions then perform a refund on a sale (preferably using REST Api).

Thanks!

4

1 回答 1

1

REST 将是不可能的——没有 REST API 可以从帐户中提取交易列表,因此它无法满足您的需求。

权限服务将是获取客户帐户权限的适当途径。您需要确保请求TRANSACTION_SEARCHTRANSACTION_DETAILSREFUND权限才能提供您描述的功能。

权限服务返回的访问令牌与 REST API 使用的访问令牌不同,因为权限服务较旧并且早于 REST API。它实际上更接近于 Oauth1 实现(尽管不完全是)。商家 SDK内置了必要的方法来获取令牌和令牌机密(您将从权限服务中获取)并将它们转换为代表客户的 PayPal 帐户运行调用所需的必要标头。

于 2016-06-15T15:56:02.747 回答