Am using pay pal express checkout for a shopping cart site. My final amount is spliting into site admin fee and seller fee based on a site admin fee percentage.
In my expresscheckout.php file
if i choose site admin percentage as 10 then
10% of total amount is given to site admin and remaining to seller
$siteowner_amount = (($paymentAmount)*$admin_percentage)/100;
$seller_amount = $paymentAmount-$siteowner_amount;
$str = “&PAYMENTREQUEST_0_AMT=”.$seller_amount;
$str = $str . “&PAYMENTREQUEST_1_AMT=”.$siteowner_amount;
and also passing the total amount to my paypalfunction.php file
Am getting the correct total amount in my paypalfunction.php (sum of siteadmin fee and seller fee). and also succeed in paypal sandbox.
But my issue is that when ever am using the site admin percentage less than 10, and even though the total amount is correct , am getting the error
“10401 order total inavlid Transaction refused because of an invalid argument. See additional error messages for details.”
But its works fine for admin percentage 10 and greater. only issue with less than 10 .
i checked the sum total that i am getting in paypalfunction.php ,it is correct.
Please help.
thanks in advance
You’re doing floating-point mathematics with money. This is a bad idea because you’re generally not allowed to post transactions with fractional cents. Beware of rounding which you do not control…
To debug, take a look at the
$seller_amountand the$siteowner_amount. You’ve probably got an overlong decimal in there which needs to be carefully rounded.