Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

External download manager using Paypal_IPN


TechieTW

Recommended Posts

I am using an external download processor that needs to verify purchase of an item. I am trying to send the $payer_email and $item_number to another url from inside ipn.php. I placed my script in between line 111 & 112 of ipn.php. It looks something like this:

 

echo "<script type='text/javascript'>location.href ='http://mydomain.com/specialfolder/myverifypurchase.php?email=$payer_email&item=$item_number';</script>";

 

My order is changed to VERIFIED, but my data does not send. Can anyone help me with the placement or perhaps a better syntax to use for the data transfer? This one really has me stumped.

Don't give up. I see light ahead...!

Link to comment
Share on other sites

I don't know IPN that well, but unless a human opens that page in a javascript enabled browser will that code ever run. For this, you'll need PHP an the easiest way (read: least code) would be with file_get_contents:

 

$null = file_get_contents('http://mydomain.com/specialfolder/myverifypurchase.php?email=' . $_GET['payer_email'] . '&item=' . $_GET['item_number'], false);
$null = NULL;

 

Now, this is assuming that those variables are passed in the URL to IPN, so it might work, it might now, but it'll get you started.

Please use the forums for support! I am happy to help you here, but I am unable to offer free technical support over instant messenger or e-mail.

Link to comment
Share on other sites

Basically I am trying to send data FROM ipn.php TO another .php page at a different location on my site.

The URL (for example's sake) is http://mydomain.com/specialfolder/myverifypurchase.php

The data I am trying to send is variable definitions from the Paypal IPN data.

 

Maybe I'm not understanding the syntax but doesn't this command READ? How would I send the data?

 

I'm sorry, I'm new to PHP. Also, is there an E-Book out there that you could recomend? One that I can download right away?

 

Thanks for your quick reply and recommendation.

Don't give up. I see light ahead...!

Link to comment
Share on other sites

In order to read the webpage, you have to send data. Since you're calling the page with IPN's variables added to the URL, the information is passed to your target file and ipn.php simply discards whatever data's sent back. You could have the myverifypurchase.php file print a success or error message and then have ipn.php interpret that value to know if it was successful or not.

 

Simply put, it's a few lines shorter than using cURL and it'll do the same thing.

Please use the forums for support! I am happy to help you here, but I am unable to offer free technical support over instant messenger or e-mail.

Link to comment
Share on other sites

Thanks for clarifying. Do you know where in the post payment process I can safely redirect the buyer to my download page? (what .php file and if possible, what line?) I'm reading/learning as I go with this modification. I just don't want to redirect until the order and it's details have been used by osCommerce. I want to inject my redirect right after that process is done but before the continue button is clicked. (if possible).

 

Thanks again for your time.

Don't give up. I see light ahead...!

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...