How to Get Paypal Account Balance via API – PHP Solution

By | September 12, 2013

If you need to verify your Paypal account balance for any reason, a simple script will help you to do this.

First of all, you need to request API credintials, if you haven’t done this yet. A detailed instruction is available here. Actually interface is a bit different, but it still can be found under “My account” section.

Then you can use an official Paypal script, that can be found at their official page.

You just need to change the following string to make it working:

 $environment = ‘sandbox’;

You may want to check it first, but actually this script cannot do anything wrong. That’s why I suggest you to set

$environment = ‘live’;

This will not damage your account.

$API_UserName = urlencode(‘my_api_username’);
$API_Password = urlencode(‘my_api_password’);
$API_Signature = urlencode(‘my_api_signature’);

Check your Paypal account for these values. You can see the guide above.

If you need a variable that contains your Paypal balance (usually you need just the balance) – it’s $httpParsedResponseAr[“L_AMT0”].

Leave a Reply

Your email address will not be published. Required fields are marked *