Paypal GetBalance

Hi everyone. I am currently trying to get the paypal api to show me a total balance for all currencies. It kinda works.

What comes out of this code is

GetBalance Completed Successfully: Array ( [L_AMT0] => 0%2e00 [L_CURRENCYCODE0] => CAD [TIMESTAMP] => 2013%2d04%2d07T23%3a38%3a31Z [CORRELATIONID] => 3c833a0aad86 [ACK] => Success [VERSION] => 51%2e0 [BUILD] => 5555736 )

Where : [L_AMT0] => 0%2e00 is 0.00 $ CAD… cuz im from canada. But i want it to show me USD, or total for all countries.

All i want is the page and the number there. thats it.

Could anyone be generous enough to give me minutes of their personal time to help me understand this?
[php]

Untitled Document <?php $environment = 'live'; // or 'beta-sandbox' or 'live' /** * Send HTTP POST Request * * @param string The API method name * @param string The POST Message fields in &name=value pair format * @return array Parsed HTTP Response body */ function PPHttpPost($methodName_, $nvpStr_) { global $environment; $API_UserName = urlencode(xxxx); $API_Password = urlencode('xxxx'); $API_Signature = urlencode('xxx'); $API_Endpoint = "https://api-3t.paypal.com/nvp"; if("sandbox" === $environment || "beta-sandbox" === $environment) { $API_Endpoint = "https://api-3t.$environment.paypal.com/nvp"; } $version = urlencode('51.0'); // setting the curl parameters. $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $API_Endpoint); curl_setopt($ch, CURLOPT_VERBOSE, 1); // turning off the server and peer verification(TrustManager Concept). curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); // NVPRequest for submitting to server $nvpreq = "METHOD=$methodName_&VERSION=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$API_Signature$nvpStr_"; // setting the nvpreq as POST FIELD to curl curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq); // getting response from server $httpResponse = curl_exec($ch); if(!$httpResponse) { exit("$methodName_ failed: ".curl_error($ch).'('.curl_errno($ch).')'); } // Extract the RefundTransaction response details $httpResponseAr = explode("&", $httpResponse); $httpParsedResponseAr = array(); foreach ($httpResponseAr as $i => $value) { $tmpAr = explode("=", $value); if(sizeof($tmpAr) > 1) { $httpParsedResponseAr[$tmpAr[0]] = $tmpAr[1]; } } if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)) { exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint."); } return $httpParsedResponseAr; } $nvpStr=""; $httpParsedResponseAr = PPHttpPost('GetBalance', $nvpStr); if("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) { exit('GetBalance Completed Successfully: '.print_r($httpParsedResponseAr, true)); } else { exit('GetBalance failed: ' .print_r($httpParsedResponseAr, true)); } exit('GetBalance Completed Successfully: ' .print_r($L_AMTn, true)); ?> [/php]

I removed the account info incase that’s why it was reported.

Sponsor our Newsletter | Privacy Policy | Terms of Service