Page 1 of 1

Performing a PHP action once when the page loads

Posted: Sat Mar 03, 2007 5:24 pm
by Jennysaur
Hi everybody! I'm new to this forum, and to PHP...(6 months strong and counting,) and I'm having a little issue trying to get a bit of my shopping cart script to work. I have to set it up so that my quantity drops by one once someone purchases an item, but the code goes outside the site to paypal, and it doesn't seem possible. I was thinking that I could have the update occur when the success page loads, but have not been able to figure that out. Any suggestions?

Thank you! 8O

Posted: Sat Mar 03, 2007 9:55 pm
by Ambush Commander
Which PayPal API are you using? It should be returning control to your server after the transaction is successful.

Posted: Mon Mar 05, 2007 1:28 pm
by RobertGonzalez
Do you have any code that you could provide so we can what is happening?

Posted: Tue Mar 06, 2007 4:24 am
by Kieran Huggins
There's something called a "callback" where paypal can optionally "POST" to a URL when a payment is successful, sort of a notification system. It's in the Paypal manual somewhere

Posted: Tue Mar 06, 2007 8:19 am
by Begby
Yes, the paypal thingy is called PayPal IPN. You setup a post url where it will either post to a form, or send XML to a webservice. In the post is data about the order (depending on how your shopping cart is setup).

PayPal has really good documentation on it. They also have a nice developer sandbox and I think developer.paypal.com. That way you can setup a test cart and test out the IPN features with your script.