Home > OS >  How to access all transactions my PayPal account received via Api?
How to access all transactions my PayPal account received via Api?

Time:01-15

I have a bussiness account on PayPal and I need to use the API to get all transactions (money that other people paid me on PayPal) in my account. So far I managed to obtain the access_token using the API however when I try to access the transactions I get an error. My code (PHP) is below:

$context = stream_context_create(array(

    "http" => array(
    
        "ignore_errors" => true,
        "method"  => "GET",
        "header" => array(
        
            "Content-Type: application/json",
            "Authorization: Bearer " . "access_token"
            
        )
        
    )
    
));

echo file_get_contents("https://api-m.paypal.com/v1/reporting/transactions?start_date=2022-01-01T00:00:00-0700&end_date=2022-01-12T23:59:59-0700&fields=all",0,$context);

I always get this as the response:

{"localizedMessage":"No permission for the requested operation. ","suppressed":[],"name":"PERMISSION_DENIED","message":"No permission for the requested operation. ","details":[{"field":null,"value":null,"location":null,"issue":"No permission for the requested operation. "}],"information_link":"https://developer.paypal.com/docs/classic/products/permissions/","debug_id":"45cb548f7bddb"}

I followed the information link in the response but it ends up in a 404 page. Maybe what I need is not the transactions API but I have no idea what part of the API would grant me access to all the payments people made to me... any idea?

CodePudding user response:

For enter image description here

After enabling and saving that permission, the change may take up to 9 hours to have an effect if you have a cached access token from previous oauth2 calls to use the API. But, you can simply terminate your old access token to thus get a new one instead of waiting 9 hours.

  •  Tags:  
  • Related