Jump to content

How can I get Paypal to send variables back to me once completed?


Hobgoblin11

Recommended Posts

OK, I think this should belong on this board.

 

I am trying to write something that does the following (simplified for ease of understanding):

 

User has signed into my website and has a session variable with their user id in it. There is a table in the mySQL databse that contains details about the user. (this part is already working)

User wants to pay for a trip, so clicks a customised Paypal button that takes him to the Paypal site. The item has an trip id associated with it.

Once the transaction has been completed, I want to feed information back to my website, and insert the 'item id' and 'user id' into a field in a table in the database.

 

Any idea how I might do this!? Whilst I have a basic script that will insert a row into my table, it relies on variables being sent from the page it is on, thus will not work when the user is redirected to Paypal, as I cannot find a way to send variables to paypal about the item, and then have them send it back to me once the transaction is complete.

 

My PHP is self-taught so sorry if this way of doing things seems a bit scrappy.

Oky dokey, after a couple of days off, I've nabbed the standard Paypal listener off their site and have it working from paypal's sandbox. Obviously I need to adapt and expand it further

 

How do I now send my custom variables, is it as simple as including a couple of lines like this in my button?

 

<input type="hidden" name="tripid" value="<?php echo $tripid; ?>">

<input type="hidden" name="userid" value="<?php echo $userid; ?>">

 

Thanks a lot, your help is really appreciated!

  • 2 weeks later...

OK, another small question - how does IPN handle pending payments? Will it call my listener again, once the payment status changes to completed, with the same details and transaction number? There doesn't seem to be much documentation on this.

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.