Accept payment with PayPal then auto-update MySQL db?

Hello,

A client has approached me seeking the following for a web site…

He wants to add ‘Events’ to his site and enter the number of participants that can attend each event. Easy enough.

He then would like to receive deposits for ‘bookings’ made on the site.
So if an event costs an individual £50, and there were 15 places for it, once the payment was made he would receive 10% of the £50 through PayPal and confirmation of this would then update the MySQL database to say only 14 places were available.

Should I be looking to use PayPal IPN along with PHP and a MySQL database. I’m comfortable with the last two, but never used PP IPN.

I assumed the SQL table structure could be:

attendees - if necessary
id | username | email | event_id

bookings
id | event_id | date_of_payment | paypal_email_id | amount

events
id | date_of_event | title_of_event

Is this the right way? Where should I start with PayPal integration?

Thanks for any helpers.

Hi there yes you need to use paypals IPN (instant payment notification) to do this.

I managed to do it with some help a few weeks back.

This should help

http://www.micahcarrick.com/04-19-2005/php-paypal-ipn-integration-class.html

Has anyone else done something similar?

I’ve now setup a PayPal Sandbox account, but not sure what the best procedure is for testing this and making sure my application will work.

Thanks for any advice.

PayPal IPN sounds right for what you want to do. When I first started looking into it it sounded complicated but it turned out to be much easier to use than I expected. Read here for more info. You’ll need to set up the IPN callback URL to load a page on your site when a payment has been authorised. Testing just involves making payments and handling the callback.