Hobgoblin11 Posted August 31, 2010 Share Posted August 31, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/212223-how-can-i-get-paypal-to-send-variables-back-to-me-once-completed/ Share on other sites More sharing options...
samshel Posted August 31, 2010 Share Posted August 31, 2010 you may want to check Paypal IPN and callback URL Quote Link to comment https://forums.phpfreaks.com/topic/212223-how-can-i-get-paypal-to-send-variables-back-to-me-once-completed/#findComment-1105853 Share on other sites More sharing options...
Hobgoblin11 Posted August 31, 2010 Author Share Posted August 31, 2010 you may want to check Paypal IPN and callback URL Thanks, just trying to get my head around IPN now actually, I'll check out callback URL. Cheers Quote Link to comment https://forums.phpfreaks.com/topic/212223-how-can-i-get-paypal-to-send-variables-back-to-me-once-completed/#findComment-1105854 Share on other sites More sharing options...
Rifts Posted September 1, 2010 Share Posted September 1, 2010 this would be SUPER easy to do using paypal IPN. if you need more help lemme know Quote Link to comment https://forums.phpfreaks.com/topic/212223-how-can-i-get-paypal-to-send-variables-back-to-me-once-completed/#findComment-1105881 Share on other sites More sharing options...
Hobgoblin11 Posted September 3, 2010 Author Share Posted September 3, 2010 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! Quote Link to comment https://forums.phpfreaks.com/topic/212223-how-can-i-get-paypal-to-send-variables-back-to-me-once-completed/#findComment-1106915 Share on other sites More sharing options...
Rifts Posted September 3, 2010 Share Posted September 3, 2010 yeah you are correct Quote Link to comment https://forums.phpfreaks.com/topic/212223-how-can-i-get-paypal-to-send-variables-back-to-me-once-completed/#findComment-1106929 Share on other sites More sharing options...
Hobgoblin11 Posted September 12, 2010 Author Share Posted September 12, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/212223-how-can-i-get-paypal-to-send-variables-back-to-me-once-completed/#findComment-1110305 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.