Jump to content

Paypal Order Failed on return to cube cart FIX !!!!�


Guest foto-time

Recommended Posts

Guest foto-time

As many of you paypal standard/IPN users, I have experienced the same infamous "your oder failed" error when customer is redirected back to my store. The root cause i found out is the timming - sometimes paypal calls IPN.php after paypal redirects customer to the confirmed.php. Another problem is, if customer pay it via echeck, even if ipn.php is called first, the order status will still be pending, thus customer will see "your order failed" too.

Long story in short, I have found a solution for it.

Here is how to:

you only need to modify confirmed.inc.php in includes/content directory.

find:

$cart = new cart();




after that, add:




///////////////////////////

// Added by paypal auto return fix

///////////////////////////

$logflag = TRUE;

///////////////////////////

// End

///////////////////////////




find:




################################################################################

############

// Following lines added for Sir William's PayPal AutoReturn Fix

} elseif(isset($_GET['tx']) && isset($_GET['st'])) {

 $basket['gateway'] = "PayPal";

################################################################################

############




after that, add:




///////////////////////////

// Added by paypal auto return fix

///////////////////////////

$module = fetchDbConfig("PayPal");

///////////////////////////

// End

///////////////////////////






find:




$success = success();




after that, add:




///////////////////////////

// Added by paypal auto return fix

///////////////////////////

if ( ( $success == FALSE ) && (isset($_GET['tx']) && isset($_GET['st'])) )

{

	$success = pdtcheck();

}

////////////////////////////////

// End

////////////////////////////////




finally, add the following 2 methods at the end of the file (just before the 
?>
):




////////////////////////////////

// Added by paypal auto return fix

////////////////////////////////

function pdtcheck()

{

	global $db, $glob, $module, $basket;

	// read the post from PayPal system and add 'cmd'

	$req = 'cmd=_notify-synch';



	$tx_token = $_GET['tx'];

	logMsg( "" );

	logMsg( "Using PDT to check order status for tx:".$tx_token );

	$auth_token = "this is provied by paypal - check your paypal PDT config";

	$req .= "&tx=$tx_token&at=$auth_token";



	// post back to PayPal system to validate

	$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";

	$header .= "Content-Type: application/x-www-form-urlencoded\r\n";

	$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";

	$fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);

	// If possible, securely post back to paypal using HTTPS

	// Your PHP server will need to be SSL enabled

	// $fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);



	if (!$fp)

	{

		// HTTP ERROR

		logMsg ("HTTP ERROR");

	}

	else

	{

		fputs ($fp, $header . $req);

		// read the body data

		$res = '';

		$headerdone = false;

		while (!feof($fp))

		{

			$line = fgets ($fp, 1024);

				if (strcmp($line, "\r\n") == 0)

				{

					// read the header

					$headerdone = true;

				}

				else if ($headerdone)

				{

					// header has been read. now read the contents

					$res .= $line;

				}

		}



		// parse the data

		$lines = explode("\n", $res);

		$keyarray = array();

		if (strcmp ($lines[0], "SUCCESS") == 0)

		{

			for ($i=1; $i<count($lines);$i++)

			{

				list($key,$val) = explode("=", $lines[$i]);

				$keyarray[urldecode($key)] = urldecode($val);

			}



			/**

			 * Check invoie, amount and receiver_email are correct

			 */

			$amount = $keyarray['payment_gross'];

			$invoiceId = $keyarray['invoice'];

			$receiver_email = $keyarray['receiver_email'];

			$sqlstat = "SELECT * FROM ".$glob['dbprefix']."CubeCart_order_sum WHERE cart_order_id = ".$db->mySQLSafe($invoiceId);

			$result = $db->select( $sqlstat );

			if ( ($result[0]['prod_total'] == $amount ) && ( strcmp( $module['email'], $receiver_email ) == 0 ) )

			{

				logMsg ("Verify Success");

				return TRUE;

			}

			else

			{

				logMsg ( "Verify Failed, Paypal response follows:" );

				logMsg ( "		Amount = " . $amount );

			  logMsg ( "	   Invoice = " . $invoiceId );

			  logMsg ( "Receiver Email = " . $receiver_email );

				return FALSE;

			}

		}

		else

		{

			logMsg ( "Payment Failed, Paypal response follows:" );

			logMsg ( $res );

			return FALSE;

		}

	}

	fclose ($fp);

}



function logmsg( $msg )

{

	global $logflag;

	if ( $logflag == FALSE )

	{

		return;

	}

	$today = date("Y-M-d");

	$myFile = "/location for my log files/".date("Y-M-d").".log";

	$fh = fopen($myFile, 'a') or die("can't open file");

	$stringData = date("[Y/M/d, G:i:s] ").$msg."\n";

	fwrite($fh, $stringData);

	fclose($fh);

}

////////////////////////////////

// End

////////////////////////////////






Let me explain how it works:



when user is transferred back to the confirmed.php, success() method is called first.  If IPN is called first, and if the status becomes "process", success() will return TRUE, then the payment is successful.



If IPN is not called yet, or customer sent an echeck, the status is pending, success() returns FALSE, then checkPDT() is called.



checkPDT() sends a request to paypal server with tx id received when paypal calls confirmed.php, then paypal sends back the transcation details, including invoice number, totoal amount and more.  So, in checkPDT() method, we do a db query, by using the invoice id, amount received from paypal and check wheter they matches, if everything is ok, return TRUE, otherwise, return FALSE.



If you add the above two methods to your file, make sure to replace the auth_token with the ones provided by paypal.  Also, you need to change the log location.  You can just create a directoy inside your store, give it a wired name, such as 
.$ba_ufdkj

, and give it a 777. The reason for a wired name is, people cannot guess it. oh, also password protect the log directory...it will block all http accesses.

I hope this helps :-)

now i can get to work on the rest of the site WAHOO!

sorry if this is off topic but this needs to be pinned so people can get a fix quickley without going round in circles

Link to comment
Share on other sites

  • Replies 66
  • Created
  • Last Reply

Top Posters In This Topic

Guest foto-time

Hi if you want to test it on my site your welcome to go to www.fototime.co.uk and do a dummy purchase then i will refund your paypal paymetn back i have some 1p test items on there ;-)

also im working on a shipping mod at the moment so you can also have a look at that

Hello

Many thanks for the efforts you have put in for this fix,

can admin confirm this is ok?

im using the latest version of CC

Cheers

Pete

Link to comment
Share on other sites

Guest petra123

If you add the above two methods to your file, make sure to replace the auth_token with the ones provided by paypal. Also, you need to change the log location. You can just create a directoy inside your store, give it a wired name, such as

.$ba_ufdkj

, and give it a 777. The reason for a wired name is, people cannot guess it. oh, also password protect the log directory...it will block all http accesses.

I hope this helps :-)

now i can get to work on the rest of the site WAHOO!

sorry if this is off topic but this needs to be pinned so people can get a fix quickley without going round in circles

Hi, glad someone found a fix for this problem. I just have a question - how exactly do you change the log location? Can you please be more specific. Sorry if it's a dumb question...

Thanks

Link to comment
Share on other sites

Guest PhattyMcGee

how exactly do you change the log location? Can you please be more specific. Sorry if it's a dumb question...

Thanks

I'm having the same problem...however, I dont know how to change the log location either (not a dumb question) Anyone?

Link to comment
Share on other sites

Guest foto-time

to change the log location just change the following code below

OLD CODE FOR LOG LOCATION

.$ba_ufdkj
, and give it a 777.  The reason for a wired name is, people cannot guess it. oh, also password protect the log directory...it will block all http accesses.





NEW CODE FOR LOG LOCATION




.$/logs/paypal/loglocation
, and give it a 777.  The reason for a wired name is, people cannot guess it. oh, also password protect the log directory...it will block all http accesses.





in otherwords just change the ba_ufdkj to where ever you want the log to be if you just put in a name or whatever there then its in the shops root directory else /log/xxx will put it in a directory called log from the shops root directory then in a sub directory of log called xxx 



get it?



hope that helps



Neil









If you add the above two methods to your file, make sure to replace the auth_token with the ones provided by paypal. Also, you need to change the log location. You can just create a directoy inside your store, give it a wired name, such as

, and give it a 777. The reason for a wired name is, people cannot guess it. oh, also password protect the log directory...it will block all http accesses.

I hope this helps :-)

now i can get to work on the rest of the site WAHOO!

sorry if this is off topic but this needs to be pinned so people can get a fix quickley without going round in circles

.$ba_ufdkj

Hi, glad someone found a fix for this problem. I just have a question - how exactly do you change the log location? Can you please be more specific. Sorry if it's a dumb question...

Thanks

Link to comment
Share on other sites

Guest Trubador

Cheers for the Fix Neil.

I too have problems with changing the log location though.

If I create a new folder in the shop root directory "/logs"

I've changed the line 272

	$myFile = "/location for my log files/".date("Y-M-d").".log";




to




	$myFile = "/logs/".date("Y-M-d").".log";




and recieve this error message




Warning: fopen(/logs/2006-Nov-27.log): failed to open stream: No such file or directory in /home/*************/public_html/shop/includes/content/confirmed.inc.php on line 272

Your help much appreciated.

Trub

Link to comment
Share on other sites

Guest Trubador

Sorted myself with placing complete root path in there...

	$myFile = "/home/XXXXXXXXXXXX/public_html/shop/logs/".date("Y-M-d").".log";




The log file now works.



However, I still receive "Paypal Order Failed" on return to cube cart.



This is the new log file.




[2006/Nov/27, 20:30:30] Using PDT to check order status for tx:4EP517363P2blah

[2006/Nov/27, 20:30:31] Verify Failed, Paypal response follows:

[2006/Nov/27, 20:30:31]		 Amount = 

[2006/Nov/27, 20:30:31]		Invoice = 061127-4EP517363P2blah

[2006/Nov/27, 20:30:31] Receiver Email = blah@blah

[2006/Nov/27, 20:30:50] 

[2006/Nov/27, 20:30:50] Using PDT to check order status for tx:4EP517363P2blah

[2006/Nov/27, 20:30:52] Verify Failed, Paypal response follows:

[2006/Nov/27, 20:30:52]		 Amount = 

[2006/Nov/27, 20:30:52]		Invoice = 061127-4EP517363P2blah

[2006/Nov/27, 20:30:52] Receiver Email = blah@blah

[2006/Nov/27, 20:31:09] 

[2006/Nov/27, 20:31:09] Using PDT to check order status for tx:4EP517363P2blah

[2006/Nov/27, 20:31:11] Verify Failed, Paypal response follows:

[2006/Nov/27, 20:31:11]		 Amount = 

[2006/Nov/27, 20:31:11]		Invoice = 061127-4EP517363P2blah

[2006/Nov/27, 20:31:11] Receiver Email = blah@blah

[2006/Nov/27, 20:31:17] 

[2006/Nov/27, 20:31:17] Using PDT to check order status for tx:4EP517363P2blah

[2006/Nov/27, 20:31:19] Verify Failed, Paypal response follows:

[2006/Nov/27, 20:31:19]		 Amount = 

[2006/Nov/27, 20:31:19]		Invoice = 061127-4EP517363P2blah

[2006/Nov/27, 20:31:19] Receiver Email = blah@blah

[2006/Nov/27, 20:31:51] 

[2006/Nov/27, 20:31:51] Using PDT to check order status for tx:4EP517363P2blah

[2006/Nov/27, 20:31:53] Verify Failed, Paypal response follows:

[2006/Nov/27, 20:31:53]		 Amount = 

[2006/Nov/27, 20:31:53]		Invoice = 061127-4EP517363P2blah

[2006/Nov/27, 20:31:53] Receiver Email = blah@blah

[2006/Nov/27, 20:31:58] 

[2006/Nov/27, 20:31:58] Using PDT to check order status for tx:4EP517363P2blah

[2006/Nov/27, 20:31:59] Payment Failed, Paypal response follows:

[2006/Nov/27, 20:31:59] FAIL

Error: 4003

I've edited tx invoice and email details.

The amount is not being shown which seems odd.

The order still went through to paypal though with the correct amount.

Cheers

Trub

Link to comment
Share on other sites

im having problems with this too

I have no problem getting my pay pal to work using the coding above. What I can't understand is what the log file is for. When I do a transaction, everything works fine, except that there is no log file in the folder that I created. Can anyone explain that to me? Thanks!

Link to comment
Share on other sites

Guest 2001web

Have any of you people having a lot of trouble tried NOT using IPN????

If you can not get IPN to work try this:

Go to your cube admin then gateways then "paypal standard and ipn" Change the drop down setting to "standard" and save your changes.

Log into your paypal account and click "profile"

Click "Instant Payment Notification Preferences" click edit and completely delete the url and turn off ipn then save.

Click "Back to Profile Summary"

Click "Website Payment Preferences" and set as follows

Auto Return: off

Return URL: delete it

Payment Data Transfer: off

Block Non-encrypted Website Payment: off

PayPal Account Optional: on

Contact Telephone : recommended to off

I have done this for several clients who were having issues.

The ONLY difference is, after the user pays they are taken to a Paypal screen that tells them they have paid.

Then they are given the choice of going to their paypal account or they can click the "return to merchant" button to go back to your site.

They still go back to the confirmed.php and the modules/gateway/paypal/ipn.php is still informed of the update and sets the order to processing not pending and reduces stock levels if you use them. This is coded into the transfer inc file already.

TRY IT when you click "return to merchant" you get the order success message every time. (if your cart is installed correctly :w00t: )

IPN has always been problematic, while I am no programmer my guess is cube can not currently cope with the speed of all the info being sent from paypal.

Using the method above is one extra click for the client but results in a LOT LESS failed orders and emails complaining about errors.

Our clients have reported that they have fewer missed sales since we implemented this change. Please do let me know how you go if you try this.

Link to comment
Share on other sites

Guest BearyCountry

Have any of you people having a lot of trouble tried NOT using IPN????

If you can not get IPN to work try this:

Go to your cube admin then gateways then "paypal standard and ipn" Change the drop down setting to "standard" and save your changes.

Log into your paypal account and click "profile"

Click "Instant Payment Notification Preferences" click edit and completely delete the url and turn off ipn then save.

Click "Back to Profile Summary"

Click "Website Payment Preferences" and set as follows

Auto Return: off

Return URL: delete it

Payment Data Transfer: off

Block Non-encrypted Website Payment: off

PayPal Account Optional: on

Contact Telephone : recommended to off

I have done this for several clients who were having issues.

The ONLY difference is, after the user pays they are taken to a Paypal screen that tells them they have paid.

Then they are given the choice of going to their paypal account or they can click the "return to merchant" button to go back to your site.

They still go back to the confirmed.php and the modules/gateway/paypal/ipn.php is still informed of the update and sets the order to processing not pending and reduces stock levels if you use them. This is coded into the transfer inc file already.

TRY IT when you click "return to merchant" you get the order success message every time. (if your cart is installed correctly :on2long: )

IPN has always been problematic, while I am no programmer my guess is cube can not currently cope with the speed of all the info being sent from paypal.

Using the method above is one extra click for the client but results in a LOT LESS failed orders and emails complaining about errors.

Our clients have reported that they have fewer missed sales since we implemented this change. Please do let me know how you go if you try this.

Ok, I tried the above and I still get the error "Error: No payment gateway variable is set!" Do you have any idea what might be the problem?

Link to comment
Share on other sites

Guest 2001web

Double check your gateway settings in your cubecart admin as follows:

1. log into admin

2. Click gateways

3. Scroll down to paypal standard and ipn and click configure

4. Set status to enabled

5. Type "paypal" in the Description box

6. For Method select "standard"

7. Click Edit config

If you still get the no gateway issue pm me.

Link to comment
Share on other sites

  • 4 weeks later...
Guest eric47905

Have any of you people having a lot of trouble tried NOT using IPN????

If you can not get IPN to work try this:

Go to your cube admin then gateways then "paypal standard and ipn" Change the drop down setting to "standard" and save your changes.

Our clients have reported that they have fewer missed sales since we implemented this change. Please do let me know how you go if you try this.

Thanks man! You Rock!

This seems to have worked. But it is weird that cubecart offers services that it cant seem to work with?

Link to comment
Share on other sites

Guest jimrobo

I went for this method after 3 days of messing around trying to get my IPN working. As soon as I switched the auto return off it worked. Also the only difference is that the user has to click to get back to paypal. there's very little difference........

Link to comment
Share on other sites

Thanks for the fix - I have updated my Admin Gateway and PayPal profile as shown and everything worked like a charm - The 'thank you for your order' return was successful. I still received a notification from my store and PayPal that an order was placed and payment received. Product was subtracted from stock. Order went to 'Processing'

My question is when you click the return to merchant link, now it states that you may be sending information unencrypted to the next page - you the know big warning...

I do not have SSL enabled. If this was implemented (SSL Certificate), would this warning still appear?

I intend to get an SSL Cert. soon within the next few days, but just curious if this will be a problem even after the SSL is enabled.

Thanks for ANY feedback you can provide.

Link to comment
Share on other sites

Help! I turned off IPN and PDF as suggested by 2001web and I have double checked all the settings in my admin panel. When I did a test sale and clicked on the 'Return to Merchant' button I just get the error message 'no payment gateway variable set. Please help, have a big headache from trying to figure it out!! Thanks.

P.S. The URL of my shop is http://www.beadtree.co.uk

Link to comment
Share on other sites

  • 3 weeks later...

Have any of you people having a lot of trouble tried NOT using IPN????

If you can not get IPN to work try this:

--snip--

Please do let me know how you go if you try this.

Whilst this fix works, unless the customer clicks on the 'Return to Merchant' button, the order is set as Pending and not Processing, even though payment has been received. Still, obviously better than the failed message! Thanks. :(

Link to comment
Share on other sites

  • 1 month later...
Guest kuebk

Sorted myself with placing complete root path in there...

	$myFile = "/home/XXXXXXXXXXXX/public_html/shop/logs/".date("Y-M-d").".log";




The log file now works.



However, I still receive "Paypal Order Failed" on return to cube cart.



This is the new log file.




[2006/Nov/27, 20:30:30] Using PDT to check order status for tx:4EP517363P2blah

[2006/Nov/27, 20:30:31] Verify Failed, Paypal response follows:

[2006/Nov/27, 20:30:31]		 Amount = 

[2006/Nov/27, 20:30:31]		Invoice = 061127-4EP517363P2blah

[2006/Nov/27, 20:30:31] Receiver Email = blah@blah

[2006/Nov/27, 20:30:50] 

[2006/Nov/27, 20:30:50] Using PDT to check order status for tx:4EP517363P2blah

[2006/Nov/27, 20:30:52] Verify Failed, Paypal response follows:

[2006/Nov/27, 20:30:52]		 Amount = 

[2006/Nov/27, 20:30:52]		Invoice = 061127-4EP517363P2blah

[2006/Nov/27, 20:30:52] Receiver Email = blah@blah

[2006/Nov/27, 20:31:09] 

[2006/Nov/27, 20:31:09] Using PDT to check order status for tx:4EP517363P2blah

[2006/Nov/27, 20:31:11] Verify Failed, Paypal response follows:

[2006/Nov/27, 20:31:11]		 Amount = 

[2006/Nov/27, 20:31:11]		Invoice = 061127-4EP517363P2blah

[2006/Nov/27, 20:31:11] Receiver Email = blah@blah

[2006/Nov/27, 20:31:17] 

[2006/Nov/27, 20:31:17] Using PDT to check order status for tx:4EP517363P2blah

[2006/Nov/27, 20:31:19] Verify Failed, Paypal response follows:

[2006/Nov/27, 20:31:19]		 Amount = 

[2006/Nov/27, 20:31:19]		Invoice = 061127-4EP517363P2blah

[2006/Nov/27, 20:31:19] Receiver Email = blah@blah

[2006/Nov/27, 20:31:51] 

[2006/Nov/27, 20:31:51] Using PDT to check order status for tx:4EP517363P2blah

[2006/Nov/27, 20:31:53] Verify Failed, Paypal response follows:

[2006/Nov/27, 20:31:53]		 Amount = 

[2006/Nov/27, 20:31:53]		Invoice = 061127-4EP517363P2blah

[2006/Nov/27, 20:31:53] Receiver Email = blah@blah

[2006/Nov/27, 20:31:58] 

[2006/Nov/27, 20:31:58] Using PDT to check order status for tx:4EP517363P2blah

[2006/Nov/27, 20:31:59] Payment Failed, Paypal response follows:

[2006/Nov/27, 20:31:59] FAIL

Error: 4003




I've edited tx invoice and email details.



The amount is not being shown which seems odd.



The order still went through to paypal though with the correct amount.



Cheers



Trub
Amount is not being shown only because this script is only compatible with US PayPal, because it is using payment_gross value to get amount, as I read on paypal forums for other currencies than USD you should use value mc_gross, here you have complete script also I added part to make it compatible with Sandbox:

im having problems with this too

I have no problem getting my pay pal to work using the coding above. What I can't understand is what the log file is for. When I do a transaction, everything works fine, except that there is no log file in the folder that I created. Can anyone explain that to me? Thanks!

It is only there for debugging reasons.

function pdtcheck()

{

	global $db, $glob, $module, $basket;

	// read the post from PayPal system and add 'cmd'

	$req = 'cmd=_notify-synch';



	$tx_token = $_GET['tx'];

	logMsg( "" );

	logMsg( "Using PDT to check order status for tx:".$tx_token );

	$auth_token = "PUT YOUR TOKEN HERE!!";

	$req .= "&tx=$tx_token&at=$auth_token";



	if($module['testMode']==1){ 

		$ipnUrl = "www.sandbox.paypal.com";

	} else {

		$ipnUrl = "www.paypal.com";

	}



	// post back to PayPal system to validate

	$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";

	$header .= "Content-Type: application/x-www-form-urlencoded\r\n";

	$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";

	$fp = fsockopen ($ipnUrl, 80, $errno, $errstr, 30);



	if (!$fp)

	{

		// HTTP ERROR

		logMsg ("HTTP ERROR");

	}

	else

	{

		fputs ($fp, $header . $req);

		// read the body data

		$res = '';

		$headerdone = false;

		while (!feof($fp))

		{

			$line = fgets ($fp, 1024);

				if (strcmp($line, "\r\n") == 0)

				{

					// read the header

					$headerdone = true;

				}

				else if ($headerdone)

				{

					// header has been read. now read the contents

					$res .= $line;

				}

		}



		// parse the data

		$lines = explode("\n", $res);

		$keyarray = array();

		if (strcmp ($lines[0], "SUCCESS") == 0)

		{

			for ($i=1; $i<count($lines);$i++)

			{

				list($key,$val) = explode("=", $lines[$i]);

				$keyarray[urldecode($key)] = urldecode($val);

			}



			/**

			 * Check invoie, amount and receiver_email are correct

			 */

		if($keyarray['mc_currency'] == "USD") {

			$amount = $keyarray['payment_gross'];

		} else {

			$amount = $keyarray['mc_gross'];

		}



			$invoiceId = $keyarray['invoice'];

			$receiver_email = $keyarray['receiver_email'];

			$sqlstat = "SELECT * FROM ".$glob['dbprefix']."CubeCart_order_sum WHERE cart_order_id = ".$db->mySQLSafe($invoiceId);

			$result = $db->select( $sqlstat );

			if ( ($result[0]['prod_total'] == $amount ) && ( strcmp( $module['email'], $receiver_email ) == 0 ) )

			{

				logMsg ("Verify Success");

				return TRUE;

			}

			else

			{

				logMsg ( "Verify Failed, Paypal response follows:" );

				logMsg ( "		Amount = " . $amount );

			  logMsg ( "	   Invoice = " . $invoiceId );

			  logMsg ( "Receiver Email = " . $receiver_email );

				return FALSE;

			}

		}

		else

		{

			logMsg ( "Payment Failed, Paypal response follows:" );

			logMsg ( $res );

			return FALSE;

		}

	}

	fclose ($fp);

}
Link to comment
Share on other sites

  • 2 weeks later...

I turned off the IPN and its working now.

Only problem is user seems to get logged out quickly.

I edited the ini.inc.php file because I was getting security warnings using the admin panel.

Link to comment
Share on other sites

  • 3 weeks later...
Guest craiga

IPN has always been problematic, while I am no programmer my guess is cube can not currently cope with the speed of all the info being sent from paypal.

With logging in ipn.php & confirmed.php - I discovered that if you don't wait the whole 10 seconds (i.e. click the supplied manual link), paypal will not have called the ipn.php before the confirmed.php is shown and this results in a failure in this case.

Furthermore, paypal can delay calling ipn.php in some cases, for example, if the business account is set for one currency but the purchaser is buying in another. Until the business account accepts the payment and adds the currency, all the calls to ipn.php will be delayed.

Perhaps the confirmed.php should check to see if a response from pay pal was received or not before it tells the user their transaction has failed. It could be similar to the transfer to paypal screen with the dots and if it times out after 20 seconds or so tell the user to: "contact the shop to confirm their transaction" rather than "the transaction failed".

Craig.

Link to comment
Share on other sites

  • 1 month later...

Have any of you people having a lot of trouble tried NOT using IPN????

If you can not get IPN to work try this:

Go to your cube admin then gateways then "paypal standard and ipn" Change the drop down setting to "standard" and save your changes.

Log into your paypal account and click "profile"

Click "Instant Payment Notification Preferences" click edit and completely delete the url and turn off ipn then save.

Click "Back to Profile Summary"

Click "Website Payment Preferences" and set as follows

Auto Return: off

Return URL: delete it

Payment Data Transfer: off

Block Non-encrypted Website Payment: off

PayPal Account Optional: on

Contact Telephone : recommended to off

I have done this for several clients who were having issues.

The ONLY difference is, after the user pays they are taken to a Paypal screen that tells them they have paid.

Then they are given the choice of going to their paypal account or they can click the "return to merchant" button to go back to your site.

They still go back to the confirmed.php and the modules/gateway/paypal/ipn.php is still informed of the update and sets the order to processing not pending and reduces stock levels if you use them. This is coded into the transfer inc file already.

TRY IT when you click "return to merchant" you get the order success message every time. (if your cart is installed correctly :cry: )

IPN has always been problematic, while I am no programmer my guess is cube can not currently cope with the speed of all the info being sent from paypal.

Using the method above is one extra click for the client but results in a LOT LESS failed orders and emails complaining about errors.

Our clients have reported that they have fewer missed sales since we implemented this change. Please do let me know how you go if you try this.

This is the only method I could get to work!

This is the 1st time I could get the "Thank you for your order" to come up in a test! (this has been driving me crazy)

Thanks 2001web :)

For others out there that may have this problem, this is what I'm running:

CubeCart Version: 3.0.16

MODS installed:

Redirect To Basket by Estelle v1.1 20070307

Custom Goup Pricing by Goober

Tabbed Descriptions by Goober

AdminNavigationMod by Rob Freemantle (Robsta)

Link to comment
Share on other sites

  • 2 weeks later...
Guest Mrs. B.

Thanks, Neil! This solved the "Payment Failed" message I would get when paying through my PayPal account. However, I'm still not getting through when trying to pay by Credit Card via PayPal. It comes up with an error message at PayPal asking to "Retry" or "Return to Home Page". And then when clicking on the latter, returns me to the PayPal home page.

Any chance you know anything about this?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...