PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, July 4, 2022

[FIXED] How to access all transactions my PayPal account received via Api?

 July 04, 2022     api, paypal     No comments   

Issue

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?


Solution

For the app/clientid you are using, have you enabled the necessary permission?

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.



Answered By - Preston PHX
Answer Checked By - Cary Denson (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

1,216,443

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © 2025 PHPFixing