Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

L_COST1 showing +$0.02 difference between cart item amounts and order amounts? #892

Closed
robwatson-intechra opened this issue Oct 3, 2017 · 12 comments
Assignees
Milestone

Comments

@robwatson-intechra
Copy link

robwatson-intechra commented Oct 3, 2017

We had a customer who tried to apply a coupon code discount (15% off) to a $179.00 order that is comprised of 6 items at $29.83 each plus one free item at $0.00. That would have yielded an order amount of $152.15. But the PayPal processor claimed that the item amounts didn't match. The specific error from PayPal was:

PayFlow API call failed. Error Code: 7 Detailed Error Message: Field format error: 10413-The totals of the cart item amounts do not match order amounts.

Below are the full but privacy-edited error log entries. They show how the PayFlow Request array [AMT] has 152.15, an [L_COST0] of 29.83 (regular price), [L_QTY0] of 6 (number of items ordered) and [L_QTY1] of 1 (free item added) but an [L_COST1] of 0.02. The discount amount is reflected in [L_COST2] of -26.83

The Response array [AMT] value is 152.17. That L_COST1 apparently needs to be 0.00 for the transaction to process as 152.15. I can't even find any L_COST1 in this plugin's code, though.

I think it might have something to do with this line -->

$paypal_args['ITEMAMT'] = $paypal_args['L_COST0'] * $paypal_args['L_QTY0'];
but I'm not sure.

2017-09-29T00:25:53+00:00 INFO PayFlow Request: Array
(
    [tender] => C
    [trxtype] => S
    [acct] => ****
    [expdate] => 0821
    [amt] => 152.15
    [currency] => USD
    [dutyamt] => 
    [freightamt] => 0
    [taxamt] => 0
    [taxexempt] => 
    [custom] => {"order_id":204700,"order_key":"wc_order_xxxxxxxxxxxxx"}
    [comment1] => 
    [comment2] => 
    [cvv2] => ****
    [recurring] => 
    [swipe] => 
    [orderid] => 204700
    [orderdesc] => Order 204700
    [billtoemail] => xxxxxxxxxx@xxxxxx.com
    [billtophonenum] => 
    [billtofirstname] => xxxxxxx
    [billtomiddlename] => 
    [billtolastname] => xxxxxxx
    [billtostreet] => xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    [billtocity] => xxxxxxxxxxxxxxxxxx
    [billtostate] => xx
    [billtozip] => xxxxx
    [billtocountry] => ID
    [origid] => 
    [custref] => 
    [custcode] => 
    [custip] => xxx.xx.xx.xx
    [invnum] => 204700
    [ponum] => 
    [starttime] => 
    [endtime] => 
    [securetoken] => 
    [partialauth] => 
    [authcode] => 
    [merchdescr] => xxxxxxxxxxxxx
    [SHIPTOFIRSTNAME] => xxxxxxxxx
    [SHIPTOLASTNAME] => xxxxxxxx
    [SHIPTOSTREET] => xxxxxxxxxxxxxx
    [SHIPTOCITY] => xxxxxxxxxxxxx
    [SHIPTOSTATE] => xx
    [SHIPTOCOUNTRY] => xx
    [SHIPTOZIP] => xxxxx-xxxx
    [ITEMAMT] => 152.17
    [L_NUMBER0] => xxxxxxxxx
    [L_NAME0] => xxxxxxxxxxx
    [L_COST0] => 29.83
    [L_QTY0] => 6
    [L_SKU0] => xxxxxxxxxxx
    [L_NUMBER1] => xxxxxxxxxxx
    [L_NAME1] => xxxxxxxxxxx
    [L_COST1] => 0.02
    [L_QTY1] => 1
    [L_SKU1] => xxxxxxxxxxx
    [L_NUMBER2] => 
    [L_NAME2] => Discount
    [L_COST2] => -26.83
    [L_QTY2] => 1
)

2017-09-29T00:25:55+00:00 INFO PayFlow Endpoint: https://payflowpro.paypal.com
2017-09-29T00:25:55+00:00 INFO PayFlow Response: Array
(
    [RESULT] => 7
    [PNREF] => BS0PFE304E9A
    [RESPMSG] => Field format error: 10413-The totals of the cart item amounts do not match order amounts.
    [HOSTCODE] => 10413
    [TRANSTIME] => 2017-09-29 00:25:54
    [BILLTOFIRSTNAME] => xxxxxxxxx
    [BILLTOLASTNAME] => xxxxxxxxx
    [AMT] => 152.17
    [ACCT] => xxxx
    [EXPDATE] => 0821
    [CARDTYPE] => 0
    [RAWREQUEST] => BUTTONSOURCE[24]=AngellEYE_SP_WooCommerce&VERBOSITY[4]=HIGH&USER[16]=*****&VENDOR[14]=*****&PARTNER[6]=PayPal&PWD[15]=*****&TENDER[1]=C&TRXTYPE[1]=S&ACCT[16]=****&EXPDATE[4]=****&AMT[6]=152.15&CURRENCY[3]=USD&CUSTOM[56]={"order_id":204700,"order_key":"wc_order_59cdf4aabd3a6"}&CVV2[3]=****&ORDERID[6]=204700&ORDERDESC[80]=Order 204700&BILLTOEMAIL[19]=xxxxxxx@xxxxxxx.com&BILLTOFIRSTNAME[8]=xxxxxxx&BILLTOLASTNAME[8]=xxxxxxxxx&BILLTOSTREET[63]=xxxxxxxxxxxxxxxxxx&BILLTOCITY[15]=xxxxxxxxxx&BILLTOSTATE[2]=xx&BILLTOZIP[5]=xxxxx&BILLTOCOUNTRY[2]=xx&CUSTIP[12]=xxx.xx.xx.xx&INVNUM[6]=204700&MERCHDESCR[15]=xxxxxxxxxxxxx&SHIPTOFIRSTNAME[9]=xxxxxx&SHIPTOLASTNAME[7]=xxxxxx&SHIPTOSTREET[15]=xxxxxxxxxxxxxx &SHIPTOCITY[11]=xxxxxxxx&SHIPTOSTATE[2]=xx&SHIPTOCOUNTRY[2]=xx&SHIPTOZIP[10]=xxxxx-xxxx&ITEMAMT[6]=152.17&L_NUMBER0[11]=xxxxxxxxxxx&L_NAME0[11]=xxxxxxxxxxx&L_COST0[5]=29.83&L_QTY0[1]=6&L_SKU0[11]=xxxxxxxxxxxx&L_NUMBER1[11]=xxxxxxxxxx&L_NAME1[11]=xxxxxxxxx&L_COST1[4]=0.02&L_QTY1[1]=1&L_SKU1[11]=xxxxxxxxxxxx&L_NAME2[8]=Discount&L_COST2[6]=-26.83&L_QTY2[1]=1
    [RAWRESPONSE] => RESULT=7&PNREF=BS0PFE304E9A&RESPMSG=Field format error: 10413-The totals of the cart item amounts do not match order amounts.&HOSTCODE=10413&TRANSTIME=2017-09-29 00:25:54&BILLTOFIRSTNAME=xxxxxx&BILLTOLASTNAME=xxxxxxxxxxxx&AMT=152.17&ACCT=xxxx&EXPDATE=xxxx&CARDTYPE=0
)
@angelleye
Copy link
Collaborator

@robwatson-intechra I'm sorry for the delay getting back to you on this. Somehow I missed this.

The details you've provided should help us track down what's causing this and get it resolved. We'll do that ASAP. Until then, if you disable the option to "Send Line Items to PayPal" in the PayFlow settings this error should go away. Please give that a try and let me know if it helps.

This is something that creeps up every once in a while because of the way WC handles calculations and rounding. We eliminated this for the most part, but you've apparently found some combination of settings that caused it. Again, we'll get it resolved ASAP and get this updated released to fix it.

@robwatson-intechra
Copy link
Author

Thank you! I appreciate you making this a high priority. I'm checking with the business owner on whether the workaround will be viable for a short time period, but that sounds reasonable until it gets fixed.

@kcppdevelopers
Copy link
Contributor

@angelleye I am little bit confused about log file, Can you please ask to website URL for more troubleshot?

@robwatson-intechra
Copy link
Author

@kcppdevelopers The website URL is https://intechrahealth.com

@angelleye
Copy link
Collaborator

@robwatson-intechra Would you be able to submit a ticket here and provide temporary login credentials so we can troubleshoot more directly if necessary?

@angelleye
Copy link
Collaborator

@iMansoorAliKhan Make sure to assign the ticket to @kcppdevelopers when you see it please, and update here to let him know it's ready.

@iMansoorAliKhan
Copy link

Ok, I think I might have missed this notification. I will take care of it for sure.

@robwatson-intechra
Copy link
Author

I've submitted it as ticket #402257

@angelleye
Copy link
Collaborator

@kcppdevelopers Looks like they've provided credentials for us in the ticket, so we need to get this worked out please.

@kcppdevelopers
Copy link
Contributor

@angelleye @iMansoorAliKhan

I have review website and found @robwatson-intechra using Version 1.4.6.1 of PayPal for WooCommerce plugin, current version is 1.4.6.4.

I have test same scenario with 1.4.6.4 version and it's working fine on my demo server.

@robwatson-intechra
Copy link
Author

I've updated the plugin now on the live site. So is this particular issue definitely and directly addressed in 1.4.6.4? Sorry if my not having updated the plugin caused more turmoil than necessary.

@angelleye
Copy link
Collaborator

@robwatson-intechra Woo does funky things with rounding in calculations at times, so this particular issue is something we've battled for quite some time. It used to be a lot worse than it is now, and we don't get many reports of this at all any more, but every once in a while it pops up again depending on somebody's unique configuration.

We now have functions in our plugin specific to running all of these calculations and weeding out conflicts, and @kcppdevelopers tested the scenario you outlined in our latest version which is working just fine. So yes, based on our tests you should be fixed if you update.

We're actually just about to release a 1.4.6.4 that resolves an issue with WC 3.2 that was just released, so you may want to wait until you see that and get both of them updated together.

I'm going to close this issue, but feel free to respond again if you have more problems and we'll dig deeper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants