Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / Configuring the Zen Cart Admin / PayPal Express Checkout support / [Fixed v1.5.0] Payments STD (IPN) issue where order is not received in ZC

[Fixed v1.5.0] Payments STD (IPN) issue where order is not received in ZC

Locked

Started by uneek on 10 Nov 2010, 12:48 AM · Views: 7,491

Results 1 to 20 of 42
This thread is locked. New replies are disabled.
10 Nov 2010, 12:48 AM
#1
uneek avatar

uneek

New Zenner

Join Date:
Mar 2008
Posts:
27
Plugin Contributions:
0

Post #1 by uneek

I have a client who is having intermittent issues where some orders are not received into ZC, but the PP notification of a payment is received.

ZC Version is 1.3.9g and PHP 5.2.14

I have reviewed a log of one of the issues and will insert it below:

First Log File

Nov 09 2010 8:32 -- IPN PROCESSING INITIATED.
*** Originating IP: 66.211.170.66 notify.paypal.com

Nov 09 2010 8:32 -- Breakpoint: 0 - Initializing debugging.

Nov 09 2010 8:32 -- Breakpoint: Flag Status:
isECtransaction = 0
isDPtransaction = 0

Nov 09 2010 8:32 -- IPN NOTICE :: No POST data to process -- Bad IPN data

Nov 09 2010 8:32 -- Breakpoint: 1 - Collected data from PayPal notification

Nov 09 2010 8:32 -- IPN INFO :: Transaction email details.
From IPN = INFO@.COM.AU | SALES@.COM.AU
From CONFIG = info@******.com.au

Nov 09 2010 8:32 -- Breakpoint: 2 - Validated transaction components

Nov 09 2010 8:32 -- Breakpoint: 3 - Communication method verified

Nov 09 2010 8:32 -- IPN NOTICE :: Could not find matched txn_id record in DB. Therefore is new to us.

Nov 09 2010 8:32 -- Breakpoint: 4 - Details: txn_type=unique ordersID = 0 IPN_id=0

Relevant data from POST:
txn_type = unique
parent_txn_id = None
txn_id = 89684349KY011424R

Nov 09 2010 8:32 -- IPN NOTICE :: IPN pausing: waiting for PDT to process. Sleeping 10 seconds ...

Nov 09 2010 8:32 -- Breakpoint: 5 - Transaction type (txn_type) = cart [parentLookup=unique]

Nov 09 2010 8:32 -- IPN NOTICE :: This is a detailed-cart transaction

Nov 09 2010 8:32 -- IPN NOTICE :: This is a detailed-cart transaction (i)

Nov 09 2010 8:32 -- IPN WARNING :: Currency/Amount Mismatch. Details:
PayPal email address = INFO@******.COM.AU
| mc_currency = AUD
| submitted_currency = AUD
| order_currency = AUD
| mc_gross = 364.92
| converted_amount = 364.91
| order_amount = 364.91494

Nov 09 2010 8:32 -- IPN NOTICE :: Failed because of currency mismatch.


Second Log File

Nov 09 2010 8:32 -- PDT PROCESSING INITIATED.
Preparing to verify transaction via PDT.

The TX token for verification is: Array
(
[tx] => 89684349KY011424R
[st] => Completed
[amt] => 364.92
[cc] => AUD
[cm] => zenid%3d45d75d5ce7c36845dbaf5a18f5809d54
[item_number] =>
[main_page] => checkout_process
[referer] => paypal
[merchant_return_link] => Return to ******
[form_charset] => UTF-8
)

Nov 09 2010 8:32 -- IPN INFO - POST VARS to be sent back (unsorted) for validation (using CURL):
To: www.paypal.com:80
Array
(
[cmd] => _notify-sync
[tx] => 89684349KY011424R
[at] => fqlAW**********YzO0S
)

Nov 09 2010 8:32 -- CURL OPTS: Array
(
[10002] => https://www.paypal.com/cgi-bin/webscr
[47] => 1
[10015] => cmd=_notify-synch&tx=89684349KY011424R&at=fqlAW**********YzO0S
[13] => 45
[78] => 30
[41] => 0
[42] => 0
[52] => 0
[19913] => 1
[64] => 0
[81] => 2
[75] => 1
[74] => 1
[84] => 2
[10018] => Zen Cart(tm) - IPN Postback
)

Nov 09 2010 8:32 -- CURL response: FAIL
Error: 4020

Nov 09 2010 8:32 -- IPN INFO (cl) - Confirmation/Validation response FAIL

Nov 09 2010 8:32 -- PDT Returned INVALID Data. Must wait for IPN to process instead.
Array
(
)

So the first log file states that there is an amount mismatch. Currency is AUD and is set to a value of 1.00000000 in the Admin. So I don't think there is an issue with the currency, but it appears the amount mismatch is to do with a rounding issue, i.e. 364.91494 does not round up to 364.92.

I have no idea where this rounding is done? Can anyone pls point me in the right direction.

Also, as it is a detailed line invoice another bug is when the item has an attribute attached to it, eg a certain flavour, then only the flavour details are shown on the invoice instead of the actual product name so it makes it hard to track down the actual item that has been purchased when the order does not exist in ZC.

Any help appreciated. Hope I have posted this in the right forum as there doesnt appear to be a forum for standard payments.

cheers

10 Nov 2010, 12:55 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #2 by drbyte

uneek:

Nov 09 2010 8:32 -- IPN WARNING :: Currency/Amount Mismatch. Details:
PayPal email address = INFO@******.COM.AU
| mc_currency = AUD
| submitted_currency = AUD
| order_currency = AUD
| mc_gross = 364.92
| converted_amount = 364.91
| order_amount = 364.91494

Nov 09 2010 8:32 -- IPN NOTICE :: Failed because of currency mismatch.

mc_gross is what PayPal says they've collected for payment.
order_amount is what Zen Cart stored as the order amount (and sent to PayPal)
converted_amount is what is calculated using the order_amount and reformatting it based on the currency formatting you specified for that currency, including limiting to decimal places you specified.

The problem is definitely with the price mismatch.
What in your store is causing the order amount to work out to more than 2 decimal places? Is this some sort of special sale or percentage discount being applied?

I don't get what you're saying about "only the flavour details are shown".

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

10 Nov 2010, 1:12 AM
#3
uneek avatar

uneek

New Zenner

Join Date:
Mar 2008
Posts:
27
Plugin Contributions:
0

Post #3 by uneek

Thanks for the quick reply.

It may be the tax, as when a product is entered the price is set in the Products Price (Gross) field as say $39.95 which automatically updates the Products Price (Net) field to $36.3182.

Now I assume the 4 decimal places could be derived from the Tax Rate, because when I edit that the Tax Rate (%) field has a value of 10.0000

Would this assumption be correct? Should I change the value of the tax rate to be 10.00% instead?

With regards to the detailed line item, if I have a product called Chocolate which has 2 options of Dark and White, then the detailed line item sent to Paypal appears as the option name, i.e. 1x Dark instead of something like 1x Chocolate - Dark.

Hope that all makes sense.

10 Nov 2010, 1:13 AM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #4 by drbyte

10.00 vs 10.0000 won't make any difference.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

10 Nov 2010, 1:15 AM
#5
uneek avatar

uneek

New Zenner

Join Date:
Mar 2008
Posts:
27
Plugin Contributions:
0

Post #5 by uneek

My currency fields are:

Decimal Places: 2
Value: 1.00000000

Should that value be set to 1.00?

10 Nov 2010, 1:17 AM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #6 by drbyte

No. 1.0000000 vs 1.00 won't make any difference.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

10 Nov 2010, 1:17 AM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #7 by drbyte

uneek:

With regards to the detailed line item, if I have a product called Chocolate which has 2 options of Dark and White, then the detailed line item sent to Paypal appears as the option name, i.e. 1x Dark instead of something like 1x Chocolate - Dark.
Try making the following change to /includes/modules/payment/paypal/paypal_functions.php
around line 771:```
// if there are attributes, loop thru them and add to description
if (isset($order->products[$i]['attributes']) && sizeof($order->products[$i]['attributes']) > 0 ) {
[B]//[/B] $optionsLI["item_name_$k"] = '';
for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {

(Just add the** //** as shown.)

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

10 Nov 2010, 1:22 AM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #8 by drbyte

uneek:

I have a client who is having intermittent issues where some orders are not received into ZC, but the PP notification of a payment is received.
When did this problem first start happening?
What changed to cause it to start when it wasn't happening previously?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

10 Nov 2010, 1:26 AM
#9
uneek avatar

uneek

New Zenner

Join Date:
Mar 2008
Posts:
27
Plugin Contributions:
0

Post #9 by uneek

Recent changes have been an upgrade from 1.3.8a to d then f then g.

Also moved to a new host recently as well.

Hard to narrow it down considering it's an intermittent problem.

10 Nov 2010, 2:21 AM
#10
uneek avatar

uneek

New Zenner

Join Date:
Mar 2008
Posts:
27
Plugin Contributions:
0

Post #10 by uneek

I also added this Military discount mod http://www.zen-cart.com/forum/showthread.php?p=380045

However, the order log I posted did not have this discount applied. I assume this would not interfere with standard orders if they dont first meet the criteria (based on customers email domain name).

10 Nov 2010, 2:31 AM
#11
uneek avatar

uneek

New Zenner

Join Date:
Mar 2008
Posts:
27
Plugin Contributions:
0

Post #11 by uneek

Actually just been through all the logs now and it appears this happened for the first time before change of host but after the upgrade.

Where abouts is the rounding done? Should I remove order total modules and replace with fresh files?

10 Nov 2010, 9:00 AM
#12
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #12 by drbyte

The rounding was done by PayPal.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

11 Nov 2010, 2:31 AM
#13
uneek avatar

uneek

New Zenner

Join Date:
Mar 2008
Posts:
27
Plugin Contributions:
0

Post #13 by uneek

Any idea how I can prevent more than 2 decimals leaving ZC? i.e. don't tell PP about anything past 2 decimals.

In fact, I don't really want anything more than 2 decimals anywhere on ZC. I don't see a need for it?

11 Nov 2010, 3:22 AM
#14
uneek avatar

uneek

New Zenner

Join Date:
Mar 2008
Posts:
27
Plugin Contributions:
0

Post #14 by uneek

Did a bit more research once I was able to find an order that had the issue and identify the products.

The 2 products in this particular order both had Specials applied to them. I removed the Specials and used the discounted price as the permanent price. The order went through successfully with no issue!

The buggy order:

mc_gross = 172.93
converted_amount = 172.94
order_amount = 172.9359

The clean order with discounts removed and discounted price set as actual price:

mc_gross = 172.94
converted_amount = 172.94
order_amount = 172.93997

So applying a special/discount appears to be causing a rounding error???

11 Nov 2010, 5:05 PM
#15
toniscraparoni avatar

toniscraparoni

Zen Follower

Join Date:
Apr 2009
Posts:
158
Plugin Contributions:
0

Post #15 by toniscraparoni

I'd posted about the same issue a few weeks ago and provided my logs. The issue is still ongoing - and extremely frustrating. After reading this thread, is it possible using the Currencies sidebox is contributing to this problem? Though I'm not sure how, given it's happened to customers from several countries, including USA, which is our default currency. We don't charge tax and use download attributes. Currently running Zen 1.3.9h, but the problem started around f or g. And without making any other changes.

Thanks for any additional insight!

If you want something done right, you have to get Zenned.
♥-My Zen Cart Mods-♥

12 Nov 2010, 1:34 AM
#16
uneek avatar

uneek

New Zenner

Join Date:
Mar 2008
Posts:
27
Plugin Contributions:
0

Post #16 by uneek

My clients site is using AUD as currency only.

I looked at the orders last night and there was 1 order with 2 items. 1 item had a special applied to it and the other didn't, and the order worked perfectly. So there is an issue with the specials, but perhaps it is only a rounding up issue:

This order worked:

mc_gross = 125.85
converted_amount = 125.85
order_amount = 125.85249

There was another order which had an item with a special in it however the order_amount did not go past 2 decimal points, and that order also worked fine.

So I'm at a loss. I think the only sure way to get around the problem is to ensure the special discount results in a somewhat rounded amount, i.e. 90.90 instead of 90.90909?

12 Nov 2010, 3:44 AM
#17
toniscraparoni avatar

toniscraparoni

Zen Follower

Join Date:
Apr 2009
Posts:
158
Plugin Contributions:
0

Post #17 by toniscraparoni

It's really getting out of hand. It's happened 4 times today alone. I had turned off the debugging logs after the first analysis was unsuccessful. Turned them back on after reading this thread earlier today and have been able to catch two of them.

Nov 11 2010 18:41 -- IPN WARNING :: Currency/Amount Mismatch. Details:
PayPal email address = ******************
| mc_currency = USD
| submitted_currency = USD
| order_currency = USD
| mc_gross = 15.85
| converted_amount = 15.86
| order_amount = 15.856

Nov 11 2010 18:41 -- IPN NOTICE :: Failed because of currency mismatch.

Nov 11 2010 19:05 -- IPN WARNING :: Currency/Amount Mismatch. Details:
PayPal email address = ******************
| mc_currency = USD
| submitted_currency = USD
| order_currency = USD
| mc_gross = 81.59
| converted_amount = 81.58
| order_amount = 81.575

Nov 11 2010 19:05 -- IPN NOTICE :: Failed because of currency mismatch.

We only accept payments in USD. Our Currencies sidebox is merely there as a courtesy for our non-USD-based customers to feel more at home. This has never been a problem before - not until around the late middle of September. I've been sending gift certificates to make up for the payments without order. Which works mathematically and sales report-wise, but it's still an inconvenience for the customer to have to re-shop. And write in, and not receive the instant gratification they wanted. But I digress. The reason I mentioned that is because I went back and checked my records and this seems to have started around that time. Again, without making any other changes to my configuration except for Zen upgrades.

I also have customers reporting the order amount sometimes changes between the time they leave the cart and arrive at Paypal. They'll have $30.00 and 10 items in the cart, but the Paypal receipt and Zen confirmation (if received LOL) comes through with one or two items and a significantly lower total. It's doubtful the return rate for the customer to go and re-shop again, for money they did not already pay, is very high. Not to mention, it reduces the rate they will return at all.

It seems there's three different totals going on between mc_gross, converted_amount and order_amount. Might there be a function we can add to the subtotal module or somewhere else in the checkout process that could "synch" them somehow? Or, maybe even simpler, could it be possible to use a string function to ensure the order total value always displays to two decimals before it goes to Paypal? Feeling a little desperate here. Thanks again for any assistance!

If you want something done right, you have to get Zenned.
♥-My Zen Cart Mods-♥

12 Nov 2010, 8:29 PM
#18
toniscraparoni avatar

toniscraparoni

Zen Follower

Join Date:
Apr 2009
Posts:
158
Plugin Contributions:
0

Post #18 by toniscraparoni

So maybe the decimal length isn't the only problem. Here's a payment without order from today:

Nov 12 2010 6:54 -- IPN WARNING :: Currency/Amount Mismatch. Details:
PayPal email address = *****************
| mc_currency = USD
| submitted_currency = USD
| order_currency = USD
| mc_gross = 13.26
| converted_amount = 13.25
| order_amount = 13.25

Nov 12 2010 6:54 -- IPN NOTICE :: Failed because of currency mismatch.

Two totals are the same this time. Usually two out of three ain't bad! LOL! Again, any help on this would be appreciated. Thanks!

If you want something done right, you have to get Zenned.
♥-My Zen Cart Mods-♥

14 Nov 2010, 5:38 PM
#19
toniscraparoni avatar

toniscraparoni

Zen Follower

Join Date:
Apr 2009
Posts:
158
Plugin Contributions:
0

Post #19 by toniscraparoni

Nov 14 2010 10:31 -- IPN WARNING :: Currency/Amount Mismatch. Details:
PayPal email address = ******************
| mc_currency = USD
| submitted_currency = USD
| order_currency = USD
| mc_gross = 8.28
| converted_amount = 8.29
| order_amount = 8.2875

Nov 14 2010 10:31 -- IPN NOTICE :: Failed because of currency mismatch.

Yoo hoo, anybody listening?

If you want something done right, you have to get Zenned.
♥-My Zen Cart Mods-♥

16 Nov 2010, 1:16 PM
#20
smoke133 avatar

smoke133

Zen Follower

Join Date:
Jul 2007
Location:
Roseville, Michigan
Posts:
188
Plugin Contributions:
0

Post #20 by smoke133

I'm having the same problem. The last order did not have any specials or discounts on it. I didn't have debug on, so I don't know what the error was. I turned it on for the next time it does it.

https://www.jhelectronics.com
Using Zencart 1.3.9h