Archived

This topic is now archived and is closed to further replies.

go77306

Paypal IPN/Auto return payment failed solution

70 posts in this topic

Arrrgggggg, I have a problem with that patch :)

My IPN works, but I had an error message "Order Failed".

So I applied your patch (copy/paste), but I have a big error and I don't find where is the problem ;) :

Parse error: parse error, unexpected T_VARIABLE in /home/users/g/gwelhenot/www/boutique/cubecart/includes/content/confirmed.inc.php on line 85




The line 85 contain that :


    $success = pdtcheck();

An idea ?

Tanks !!

Share this post


Link to post
Share on other sites

Works a treat for a fresh 3.0.10 installation. Will this be worked into the standard installation in the near future?

Matt

Share this post


Link to post
Share on other sites

I have 3.0.10 ... and it doesn't work :)

And sometimes, I have an error like :

Error : No gateway selected ..

The only solution to fix it is to replace the file by a backup.

very strange ;)

Share this post


Link to post
Share on other sites

[fixed]

I just updated my PayPal account in "Business" and it seems to work.

Share this post


Link to post
Share on other sites

I have 3.0.10 ... and it doesn't work :)

And sometimes, I have an error like :

Error : No gateway selected ..

The only solution to fix it is to replace the file by a backup.

very strange :sourcerer:

Hi,

Did you apply this mod in v3.0.10 or it is working by default?

Best Regards

Share this post


Link to post
Share on other sites

If you add the above two methods to your file, make sure to replace the auth_token with the ones provided by paypal.

I tried to implement this fix, but have no PayPal token. We're using the API Certificate method, and PayPal says, "A given PayPal account can only be configured to use one of the two authentication methods, API Certificate or API Signature, at one time." The "token" is the "API Signature."

Any solution for this problem for API Certificates?

Share this post


Link to post
Share on other sites

Just discovered an important point, which I think was touched on further back in the thread. With this mod, the email address that you use for Paypal and the email address you have entered in the store settings (to receive order notifications to), *must* be the same.

If they are not, you will receive money fine, but your customers will get "Your order failed" messages and the order will not be updated to "Processing".

Thanks to the OP for this great fix :-)

Matt

Share this post


Link to post
Share on other sites

Issues with IPN, I get this error and I THINK I've done all the steps correctly...

This is the error message I get!

Warning: fopen(/2006-Jun-08.log): failed to open stream: Permission denied in /homepages/5/d159930759/htdocs/includes/content/confirmed.inc.php on line 273

can't open file

This is the code pasted in my confirmed.inc.php

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

$myFile = "/homepages/5/d159930759/htdocs/".date("Y-M-d").".log";

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

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

fwrite($fh, $stringData);

fclose($fh);

Share this post


Link to post
Share on other sites

Thank you so so much for this fix. I have been pulling my hair out over the past few weeks trying to make sense of why the orders come back failed when they actually credit the account and change the status to processing in admin.

I must ask support why this fix has not been put forward for inclusion in the source files?? It was post a few months ago and im sure many other people have had similar issues??? Could you at least make this post a sticky?

Anyway, you have stopped my frustration and I can now progress with my cart development :lol:

Have a good weekend. Im off down the pub....

Peter :D:cat::cry::^^::D:D:D:D:D:D :D

Share this post


Link to post
Share on other sites

If you add the above two methods to your file, make sure to replace the auth_token with the ones provided by paypal.

I tried to implement this fix, but have no PayPal token. We're using the API Certificate method, and PayPal says, "A given PayPal account can only be configured to use one of the two authentication methods, API Certificate or API Signature, at one time." The "token" is the "API Signature."

Any solution for this problem for API Certificates?

When I set up IPN I received a identity token which is a long list of letters and numbers. It THAT the auth_token if so where do I replace that code?? Clarity would be appreciated. :lol:

Share this post


Link to post
Share on other sites

If you add the above two methods to your file, make sure to replace the auth_token with the ones provided by paypal.

I tried to implement this fix, but have no PayPal token. We're using the API Certificate method, and PayPal says, "A given PayPal account can only be configured to use one of the two authentication methods, API Certificate or API Signature, at one time." The "token" is the "API Signature."

Any solution for this problem for API Certificates?

When I set up IPN I received a identity token which is a long list of letters and numbers. It THAT the auth_token if so where do I replace that code?? Clarity would be appreciated. :lol:

Log onto your Paypal account, goto your profile, click on website payment preferences, goto Payment Data Transfer, and you will see a long token number there. That is the one you to make a note of and paste between the quotes in the $auto_token field below.

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

// 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 = "PASTE PAYPAL TOKEN INTO HERE";

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

Hope this helps.

Peter

Share this post


Link to post
Share on other sites

When I set up IPN I received a identity token which is a long list of letters and numbers. It THAT the auth_token if so where do I replace that code?? Clarity would be appreciated. ;)

Log onto your Paypal account, goto your profile, click on website payment preferences, goto Payment Data Transfer, and you will see a long token number there. That is the one you to make a note of and paste between the quotes in the $auto_token field below.

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

// 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 = "PASTE PAYPAL TOKEN INTO HERE";

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

Hope this helps.

Peter

Well I don't get the order failed anymore but get this instead

Warning: fopen(/home/public_html//2006-Jun-23.log): failed to open stream: No such file or directory in /home/lifesong/public_html/includes/content/confirmed.inc.php on line 270

can't open file

I am assuming I put the wrong path to the log directory that I created in the public_html folder. Not sure what I need to put there if its not /home/public_html/my log directory filename/ what do I need to put or is something else wrong? I did change the permission for the directory to 777. I at least feel like I am getting closer any help is appreciated. ;)

Share this post


Link to post
Share on other sites

When I set up IPN I received a identity token which is a long list of letters and numbers. It THAT the auth_token if so where do I replace that code?? Clarity would be appreciated. :(

Log onto your Paypal account, goto your profile, click on website payment preferences, goto Payment Data Transfer, and you will see a long token number there. That is the one you to make a note of and paste between the quotes in the $auto_token field below.

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

// 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 = "PASTE PAYPAL TOKEN INTO HERE";

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

Hope this helps.

Peter

Well I don't get the order failed anymore but get this instead

Warning: fopen(/home/public_html//2006-Jun-23.log): failed to open stream: No such file or directory in /home/lifesong/public_html/includes/content/confirmed.inc.php on line 270

can't open file

I am assuming I put the wrong path to the log directory that I created in the public_html folder. Not sure what I need to put there if its not /home/public_html/my log directory filename/ what do I need to put or is something else wrong? I did change the permission for the directory to 777. I at least feel like I am getting closer any help is appreciated. :D

hi,

Like you say, looks like you got the log path incorrect. To find out the correct path, either ask your hosting company, or open up /includes/global.inc and look at the $glob['rootDir'] entry. That is the full path to your store. Create the log file directory in root of your cubecart directory and pop the full path (remembering to include your logfile directory name at the end) into the appropiate line in the code.

Hope this helps.

Peter

Share this post


Link to post
Share on other sites

I am trying to setup another cubecart 3.0.11 this time, and I have tried everything possible to get paypal IPN to work...all the orders keep coming up as orders failed, however payments are going through to paypal ok.

I have setup paypal sides of things, and pretty certain I have done everything correct, I have crosschecked multiple times.

I can't seem to apply this mod to fix this either as my server says that there is no SSL support in fsocketopen, I suspect it is the way my server is configured.

Any ideas on how to fix this or workarounds to fsocketopen??

Share this post


Link to post
Share on other sites

I've been also working with the IPN stuff, and am not able to get the IPN to correctly reduce the stock when a purchase is processed. I've tried it both in the Sandbox, and via a live paypal account.

What DOES work is changing the setting from "IPN" to "Standard", but it seems like that has some bad security implications. I can't seem to find out why IPN is better than "standard" - and I don't currently have SSL/HTTPS set up for this client, so I gather IPN is better...

Can anyone confirm the difference between IPN and Standard?

I was suprised that 3.0.11 did not include the fix discussed here, it looks pretty robust to me. I guess the reason it was not just "dropped in" is becuase you do have to modify the code put in your identity token.

Thoughs on just going from IPN(does not reduce stock) to Standard (correctly adjust stock)?

Thanks!

Share this post


Link to post
Share on other sites

I went through this mod and got the following error on a test purchase.

What does this mean?

Warning: fopen(): open_basedir restriction in effect. File(/logfoldername/2006-Jul-30.log) is not within the allowed path(s): (/home/cookie:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/cookie/public_html/includes/content/confirmed.inc.php on line 275

Warning: fopen(/logfoldername/2006-Jul-30.log): failed to open stream: Operation not permitted in /home/cookie/public_html/includes/content/confirmed.inc.php on line 275

can't open file

Share this post


Link to post
Share on other sites

I went through this mod and got the following error on a test purchase.

What does this mean?

Warning: fopen(): open_basedir restriction in effect. File(/logfoldername/2006-Jul-30.log) is not within the allowed path(s): (/home/cookie:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/cookie/public_html/includes/content/confirmed.inc.php on line 275

Warning: fopen(/logfoldername/2006-Jul-30.log): failed to open stream: Operation not permitted in /home/cookie/public_html/includes/content/confirmed.inc.php on line 275

can't open file

I figured out where I went wrong, I didnt have home/public_html/ in the log folders location...

BUT this still doesnt work for me, Im still getting the sorry error...

I have-

-got same email in Paypal and cart

-included the mod listed on page 1 pf this thread with Paypal token string pasted, and my log file location included.

-IPN is on at Paypal

-Auto return is on at Paypal

-Payment Data Transfer is On at Paypal

-return address is http://www.mystore.com/confirmed.php

-IPN URL is http://mystore.com/modules/gateway/PayPal/ipn.php

What have I missed????? I might have to bother support for some help on this perhaps....

Share this post


Link to post
Share on other sites

I just checked the Log folder and found this

[2006/Jul/31, 10:59:45]

[2006/Jul/31, 10:59:45] Using PDT to check order status for tx:3626661308517554L

[2006/Jul/31, 10:59:46] Payment Failed, Paypal response follows:

[2006/Jul/31, 10:59:46] FAIL

Error: 4003

4003, maybe I can search paypals site for that?

Hmm doesnt seem to help much..

What is Error 3105-4003?

Error 3105-4003 may appear if you click on a link for a secret question or an instant password. This error is most probably caused by invalid data.

If a link presented in an email received from PayPal does not work, the link may have been split into multiple lines by your email programme. To correct the problem, please copy and paste the link line by line until the entire link appears in the address bar of your web browser.

Share this post


Link to post
Share on other sites

The code says:

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

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

	$req = 'cmd=_notify-synch';

What exactly do I have to set here?

Share this post


Link to post
Share on other sites

2 days later and I'm still having problems. I've followed every step listed in this thread as far as fixing my code in confirmed.inc.php and verifying my PayPal settings, yet I'm still having issues.

Orders go through fine, emails are sent, payments are deducted from the buyer's account and deposited in my PayPal account, yet I'm still getting the Order Failed message every time. I'm running the latest version of CubeCart, and I've created all my IPN info with PayPal within the last 3 days, so everything should be up to date and current.

Oh, and my stock still refuses to deplete, but I'm thinking that that may correct itself once this issue is cleared up.

Any suggestions?

Share this post


Link to post
Share on other sites

okay, since the payment pro thing does not seem to work with cubecart i tried out the IPN standard version.

i followed the tutorial sticky

then i got the "your order failed" on the redirected page, although order and payment went through.

then i looked at this thread and added the code

i got the error message on redirect that it couldn't write the file and after some reading i added the appropriate line of code and now the redirect works flawlessly.

i still get the "your order failed" and no log file :)

payments go through and emails get sent ..... i don't know why cubecart is so stubborn and tells me that the order failed?

the log file says following:

[2006/Sep/19, 12:11:21] 

[2006/Sep/19, 12:11:21] Using PDT to check order status for tx:76113889YB5206737

[2006/Sep/19, 12:11:21] Payment Failed, Paypal response follows:

[2006/Sep/19, 12:11:21] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">

<TITLE>ERROR: The requested URL could not be retrieved</TITLE>

<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>

</HEAD><BODY>

<H1>ERROR</H1>

<H2>The requested URL could not be retrieved</H2>

<HR noshade size="1px">

<P>

While trying to retrieve the URL:

<A HREF="http://64.202.165.132/cgi-bin/webscr">http://64.202.165.132/cgi-bin/webscr</A>

<P>

The following error was encountered:

<UL>

<LI>

<STRONG>

Connection Failed

</STRONG>

</UL>



<P>

The system returned:

<PRE><I>	(111) Connection refused</I></PRE>



<P>

The remote host or network may be down.  Please try the request again.

<P>Your cache administrator is <A HREF="mailto:webmaster">webmaster</A>. 



<BR clear="all">

<HR noshade size="1px">

<ADDRESS>

Generated Tue, 19 Sep 2006 19:11:21 GMT by wc02.inet.mesa1.secureserver.net (squid/2.5.STABLE12)

</ADDRESS>

</BODY></HTML>

Share this post


Link to post
Share on other sites

I just gave up and changed the text in the language file from "your order has failed" to "Thanks for your order" !!!

LOL it works and I couldnt figure out how to fix it.

I know I could run into problems but its better than it was.

Share this post


Link to post
Share on other sites