Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PERMISSION_DENIED when testing PayPal Activity REST API in the sandbox

Tags:

rest

paypal

I created a new app and I'm following the API instructions as documented here: https://developer.paypal.com/docs/api/activities/

My sandbox credentials are good, and I used them to create a bearer token, which I used (in Postman) to post a payment (https://api.sandbox.paypal.com/v1/payments/payment) with success.

However, my goal for this application is to create an activity report using the API functions linked above. For this, I turned on the appropriate "App feature option" called Transaction Search, in addition to every other app feature option.

Header:

Authorization: Bearer (new bearer token here)

My GET request:

https://api.sandbox.paypal.com/v1/activities/activities?start_time=2018-05-03T15:00:00.000Z&end_time=2018-05-02T15:30:00.000Z&page_size=10&next_page_token=1

Whatever I do, I get:

HTTP Status: 401 Unauthorized

Request body:

{
    "name": "PERMISSION_DENIED",
    "message": "No permission for the requested operation",
    "details": {
        "": "No permission for the requested operation"
    }
}

I am a US developer, and this application is for my own use.

like image 269
Jacob Bruinsma Avatar asked May 04 '18 15:05

Jacob Bruinsma


People also ask

What is PayPal sandbox API?

The PayPal sandbox is a self-contained, virtual testing environment that simulates the live PayPal production environment. The sandbox provides a shielded space where you can initiate and watch while your apps process PayPal API requests without touching any live PayPal accounts.

Does PayPal use restful API?

The PayPal REST API is organized around transaction workflows, including: orders, payments, subscriptions, invoicing, and disputes. The API uses standard verbs and returns HTTP response codes and JSON-encoded responses.

What can I do with PayPal API?

You can enable customers to make PayPal and credit card payments with only a few clicks, depending on the country. You can accept an immediate payment or authorize a payment and capture it later. You can show details for completed payments, refunds, and authorizations.


1 Answers

Final answer (for now), confirmed by a PayPal developer support technician:

PayPal doesn't yet have a REST API method available to the public, for creating this report. Use TransactionSearch in the old NVP (Name-Value-Pair) API, it's reasonably well documented and used everywhere - even though it's been deprecated since 2017.

https://developer.paypal.com/docs/classic/api/merchant/TransactionSearch_API_Operation_NVP/?mark=TransactionSearch

For those who like to work with example code, the following GitHub project shows how you could implement the API. It was helpful to me:

https://github.com/gtaylor/paypal-python

like image 146
Jacob Bruinsma Avatar answered Sep 18 '22 23:09

Jacob Bruinsma