Error on Payment

Permalink 2 users found helpful
Hi,
I've implemented the ZBS in one of my clients site. It has 2 payment options(Paypal & Credit Card). I'm using Paypal Payment Pro for this. Before implementing the ZBS, the payment section works fine. But when I'm implementing the ZBS rules & trying to purchase anything it shows error. The below is the error:

For Credit Card:
Error: Order total is invalid.

For Paypal:
SetExpressCheckout API call failed.
Detailed Error Message: Order total is invalid.
Short Error Message: Transaction refused because of an invalid argument. See additional error messages for details.
Error Code: 10401
Error Severity Code: Error


After getting the above error I've follow through the Paypal form hidden fields & get the below lines.

<form action="http://vps5317.inmotionhosting.com/~netkno5/index.php/tools/packages/core_commerce/payment_method_action?paymentMethodID=5&action=authorize_payment" method="post">
<input type="hidden" value="_xclick" name="cmd">
<input type="hidden" value="1" name="address_override">
<input type="hidden" value="2" name="rm">
<input type="hidden" value="1" name="no_note">
<input type="hidden" value="Purchase from Netknots - Order #479" name="item_name">
<input type="hidden" value="Kaushik" name="first_name">
<input type="hidden" value="Sur" name="last_name">
<input type="hidden" value="11A, Strand Road" name="address1">
<input type="hidden" value="Ekta Apartment" name="address2">
<input type="hidden" value="Kolkata" name="city">
<input type="hidden" value="NJ" name="state">
<input type="hidden" value="813652" name="zip">
<input type="hidden" value="US" name="country">
<input type="hidden" value="9830082615" name="night_phone_a">
<input type="hidden" value="6.7.00" name="amount">
<input type="hidden" value="" name="email">
<input type="hidden" value="1" name="no_shipping">
<input type="hidden" value="http://vps5317.inmotionhosting.com/~netkno5/index.php/tools/packages/core_commerce/payment_method_action?paymentMethodID=5&action=notify_complete" name="notify_url">
<input type="hidden" value="http://vps5317.inmotionhosting.com/~netkno5/index.php/checkout/payment/form/" name="cancel_return">
<input type="hidden" value="http%3A%2F%2Fvps5317.inmotionhosting.com%2F%7Enetkno5%2Findex.php%2Fcheckout%2Fpayment%2Fform%2F" name="prev_step">
<input type="hidden" value="http%3A%2F%2Fvps5317.inmotionhosting.com%2F%7Enetkno5%2Findex.php%2Fcheckout%2Ffinish%2F" name="next_step">
<input type="hidden" value="aNyhPVBGaUo=" name="invoice">
<input type="hidden" value="http://vps5317.inmotionhosting.com/~netkno5/index.php/tools/packages/core_commerce/payment_method_action?paymentMethodID=5&action=process_payment&args[]=&amount=6.7.00&prev_step=http%3A%2F%2Fvps5317.inmotionhosting.com%2F%7Enetkno5%2Findex.php%2Fcheckout%2Fpayment%2Fform%2F&next_step=http%3A%2F%2Fvps5317.inmotionhosting.com%2F%7Enetkno5%2Findex.php%2Fcheckout%2Ffinish%2F&invoice=aNyhPVBGaUo%3D" name="return">
</form>


***Have a look at the amount hidden field. The value is 6.7.00.
<input type="hidden" value="6.7.00" name="amount">
I think this is the error.

Additionally when I was in the Paypal, the order summary shows blank. the screenshot is attached.

Please help me asap. The site is about to live.

Citytech

1 Attachment

citytech2
 
JohntheFish replied on at Permalink Reply
JohntheFish
This issue is being handled through ZBS support.

At the moment, it looks like either eCommerce or the payment gateway is being confused by a leading zero. ZBS returning a shipping cost of 0.75 leads to the error in the payment gateway. ZBS returning a shipping cost of 1.01 does not.

In the mean time, have any other users of eCommerce or any payment gateway encountered a similar glitch with shipping costs being confused by a leading zero?
citytech2 replied on at Permalink Best Answer Reply
citytech2
In the PayPal Website Payments Pro's controller.php I've changed two lines.
In your controller.php at line 208 it reads:
$order_total = (float) $o->getOrderTotal();

I changed it to:
$order_total = number_format($o->getOrderTotal(),2,'.','');


Also, around line 274 it has:
$fields['amount'] = (substr($o->getOrderTotal(), -3, 1) == ".") ? $o->getOrderTotal() : $o->getOrderTotal().'.00';

I changed it to:
$fields['amount'] = $o->getOrderTotal();


And it works properly.

Citytech
medicimedicine replied on at Permalink Reply
I can't believe they are still selling this add-on with so many bugs! I was freaking out when suddenly users stopped buying stuff when we raised the price... until I found out that it was because we raised it from a flat amount to a price ending in .95, and the bug was adding an extra zero, sending a request for 44.950, which was considered invalid to the credit card processor.

Thank you for your fix, Citytech.