• Resolved mfassier

    (@mfassier)


    So yesterday this started to happen to people checking out with their credit card via PPpro. The amounts are passed correctly if one checks out with Paypal, you land on the PP page with proper amounts. If you enter your CC info, the cart complains with 10427-Shipping total is invalid. For some reason the three decimal in shipping calculation is not being rounded off resulting in PP refusing the call. Not sure where to go from here… This is a big deal right now, we have a bunch of orders failing and people p*** off because of it. Any assistance appreciated.

    This is the order’s message in WC.
    PayPal Pro payment failed (Correlation ID: whatever). Payment was rejected due to an error: (10427) β€œ10427-Shipping total is invalid.”

    04-25-2015 @ 11:40:34 – Processing order #2954
    04-25-2015 @ 11:40:34 – Do payment request Array
    (
    [DPFields] => Array
    (
    [paymentaction] => Sale
    [ipaddress] => xx.xx.xxxx.xx
    [returnfmfdetails] =>
    )

    [CCDetails] => Array
    (
    [creditcardtype] => Visa
    [acct] => ****
    [expdate] => 062018
    [cvv2] => ****
    [startdate] =>
    [issuenumber] =>
    )

    [PayerInfo] => Array
    (
    [email] => xxxxxx@xxxx.com
    [firstname] => Test1
    [lastname] => Test2
    )

    [BillingAddress] => Array
    (
    [street] => Street
    [street2] =>
    [city] => City
    [state] => QC
    [countrycode] => CA
    [zip] => J0L 1N0
    [phonenum] => xxx-xxx-xxxx
    )

    [ShippingAddress] => Array
    (
    [shiptoname] => Test1 Test2
    [shiptostreet] => Street
    [shiptostreet2] =>
    [shiptocity] => City
    [shiptostate] => QC
    [shiptozip] => J0L 1N0
    [shiptocountry] => CA
    [shiptophonenum] =>
    )

    [PaymentDetails] => Array
    (
    [amt] => 152.77
    [currencycode] => CAD
    [insuranceamt] =>
    [shipdiscamt] =>
    [handlingamt] =>
    [desc] =>
    [custom] =>
    [invnum] => 2954
    [notifyurl] =>
    [recurring] =>
    [taxamt] => 19.9
    [shippingamt] => 13.871
    [itemamt] => 119.00
    )

    [OrderItems] => Array
    (
    [0] => Array
    (
    [l_name] => xxxx
    [l_desc] =>
    [l_amt] => 119.00
    [l_number] => x-x-x
    [l_qty] => 1
    [l_taxamt] =>
    [l_ebayitemnumber] =>
    [l_ebayitemauctiontxnid] =>
    [l_ebayitemorderid] =>
    )

    )

    [Secure3D] => Array
    (
    )

    )

    04-25-2015 @ 11:40:35 – Request: Array
    (
    [USER] => *****
    [PWD] => *****
    [VERSION] => 112.0
    [BUTTONSOURCE] => AngellEYE_SP_WooCommerce
    [SIGNATURE] => *****
    [METHOD] => DoDirectPayment
    [PAYMENTACTION] => Sale
    [IPADDRESS] => xxxx.xxx.xxx.xx
    [CREDITCARDTYPE] => Visa
    [ACCT] => xxxxxxxx
    [EXPDATE] => xxx
    [CVV2] => xxx
    [EMAIL] => xxx@x.coxm
    [FIRSTNAME] => Test1
    [LASTNAME] => Test2
    [STREET] => Street
    [CITY] => City
    [STATE] => QC
    [COUNTRYCODE] => CA
    [ZIP] => J0L 1N0
    [PHONENUM] => 514-xxx-xxxxx
    [AMT] => 152.77
    [CURRENCYCODE] => CAD
    [INVNUM] => 2954
    [TAXAMT] => 19.9
    [SHIPPINGAMT] => 13.871
    [ITEMAMT] => 119.00
    [L_NAME0] => Caleo
    [L_AMT0] => 119.00
    [L_NUMBER0] => xxx-xxx-240-02
    [L_QTY0] => 1
    [SHIPTONAME] => Test1 Test2
    [SHIPTOSTREET] => Street
    [SHIPTOCITY] => City
    [SHIPTOSTATE] => QC
    [SHIPTOZIP] => J0L 1N0
    [SHIPTOCOUNTRY] => CA
    )

    04-25-2015 @ 11:40:35 – Response: Array
    (
    [TIMESTAMP] => 2015-04-25T15:47:56Z
    [CORRELATIONID] => xxxxxxxx
    [ACK] => Failure
    [VERSION] => 112.0
    [BUILD] => 16204765
    [L_ERRORCODE0] => 10427
    [L_ERRORCODE1] => 10413
    [L_SHORTMESSAGE0] => Transaction refused because of an invalid argument. See additional error messages for details.
    [L_SHORTMESSAGE1] => Transaction refused because of an invalid argument. See additional error messages for details.
    [L_LONGMESSAGE0] => Shipping total is invalid.
    [L_LONGMESSAGE1] => The totals of the cart item amounts do not match order amounts.
    [L_SEVERITYCODE0] => Error
    [L_SEVERITYCODE1] => Error
    [AMT] => 138.90
    [CURRENCYCODE] => CAD
    )

    04-25-2015 @ 11:40:35 – Error Array
    (
    [0] => Array
    (
    [L_ERRORCODE] => 10427
    [L_SHORTMESSAGE] => Transaction refused because of an invalid argument. See additional error messages for details.
    [L_LONGMESSAGE] => Shipping total is invalid.
    [L_SEVERITYCODE] => Error
    )

    [1] => Array
    (
    [L_ERRORCODE] => 10413
    [L_SHORTMESSAGE] => Transaction refused because of an invalid argument. See additional error messages for details.
    [L_LONGMESSAGE] => The totals of the cart item amounts do not match order amounts.
    [L_SEVERITYCODE] => Error
    )

    )

    https://wordpress.org/plugins/paypal-for-woocommerce/

Viewing 15 replies - 1 through 15 (of 22 total)
  • Plugin Contributor angelleye

    (@angelleye)

    So this just started happening one day after working fine for a while..?? Did anything get adjusted on that day that could be causing the problem with shipping amounts?

    What shipping calculator are you using? Are you just working with table rates entered into the features provided with WooCommerce by default, or are you working with some sort of an extension/plugin?

    Please give me as much info as you can so that I can try to reproduce your configuration on my test server and see if I end up with the same problem.

    Thread Starter mfassier

    (@mfassier)

    Thanks for your quick feedback. As a matter of fact, we managed to fix this about an hour ago. We rewrote part of wc-gateway-paypal-pro-angelleye.php to round off the shipping value being passed with 3 decimals.

    We’re using Canada Post to calculate shipping and although it had been working fine for 6 months now, I can only imagine than an update broke this. I do believe there was an WC update on Friday morning, but I did not apply it so I’ll check with my colleague.

    Plugin Contributor angelleye

    (@angelleye)

    Ok, I’m glad you were able to get it resolved. I’ve created an issue in our GitHub repo so we’ll do the same thing in our next update.

    Thread Starter mfassier

    (@mfassier)

    Well that was a big fat lie… We’ve indeed fixed the shipping calculation issue, but now taxes aren’t properly rounded down – they’re always rounded up – resulting in a one-cent mismatch for Paypal, thus killing the transaction. We’re struggling here, using PHP_ROUND_HALF_UP doesn’t seem to do any good. We didn’t even know where this issue comes from in the first place, this setup has been working for months ! Now, if a transaction happens to fall down from .05, then it gets rounded up and Paypal complains. If it’s above, then the transaction goes thru resulting in a “lottery” for our clients πŸ™‚

    Plugin Contributor angelleye

    (@angelleye)

    These rounding issues with taxes are one of the things we’re working to get resolved in the next update. It’s proven difficult to reproduce and troubleshoot because it does not happen all the time.

    What I can tell you is that it seems to occur more when setting up pricing to include taxes in WooCommerce. If you can get away with not doing that the order total errors should go away.

    Our next update is hopefully going to resolve that, but we’ve been a little bit delayed trying to ensure it’s entirely fixed (as well as working on other big adjustments.)

    Sorry I don’t have a better immediate fix for you, but I can tell you that we are working on it.

    Thread Starter mfassier

    (@mfassier)

    Thanks for the quick reply. Actually, we’re not including taxes in WC, taxes are calculated on the subtotal. What do you figure the timeframe is for a fix ?

    Thread Starter mfassier

    (@mfassier)

    Going out on a limb here : this used to work fine, could I roll back to 1.1.6.1 to see if problem goes away ? This would likely help to find the culprit too. Where can I find a previous version ?

    Plugin Contributor angelleye

    (@angelleye)

    I don’t think the issue was raised from our plugin getting updated, but rather some changes WC made in their 2.3 update. That’s what has made this so hard to troubleshoot and fix. As soon as we think we have it fixed they release an update that changes everything and it comes back again.

    Thread Starter mfassier

    (@mfassier)

    Me again. We’re still stuck with this problem and after traveling to the moon and back, the solution was in fact extremely simple : in PaypalExpres, $shipping is rounded, in PaypalPro, it wasn’t.
    Added $shipping = number_format($shipping,2,'.',''); at line 871 of the pro module and it looks like it’s all good.

    Plugin Contributor angelleye

    (@angelleye)

    @mfassier, thanks for the feedback. I’ll take a look at that. That may be something we have already fixed in our dev branch on GitHub, but it’s just been delayed getting the actual update released. Sorry for the headaches!

    I was having the same problem because our shipping is calculated as a percentage of order total.

    Looking at the code in wc-gateway-paypal-pro-angelleye.php, and checking around line 871, as per mfassier’s suggestion, that is the section for checking the credit card number.

    I added the same code he mentioned,
    $shipping = number_format($shipping,2,’.’,”);
    at lines 1711 & 1721.

    Perhaps it comes out to the same thing, but for me I added the code into the section where the shipping is calculated.

    I had turned on logging, but had neglected to create the directory where the log file goes by default, so I was glad to find this post and not have to debug the code myself. I’ll see with the next order if this fixes it.

    Plugin Contributor angelleye

    (@angelleye)

    I’m pretty sure we have this all fixed up in our dev branch on GitHub now. We’ve been doing lots of testing and I can’t reproduce these errors anymore like I could before.

    We just have 2 other little things we need to complete before officially releasing 1.1.6.3. Won’t be much longer.

    Just updated WP – same problem here. Adding at line 871: $shipping = number_format($shipping,2,'.',''); fixed the problem.

    Plugin Contributor angelleye

    (@angelleye)

    @danaxelrod

    Thanks for the feedback. Yes, that will fix it (in many cases) but don’t be surprised if you see it again. Depending on the calculations involved simply formatting the number doesn’t always help.

    We have added some general checks and balances to the update so that if the calculations don’t come out correctly it’s adjusted accordingly. I’m just wrapping up a couple of more small things and finalizing testing and then this update will be ready. Shouldn’t be much longer!

    Thank you. Please update us about the fix asap. We have customers unable to checkout at the moment.

Viewing 15 replies - 1 through 15 (of 22 total)
  • The topic ‘10427-Shipping total is invalid.’ is closed to new replies.