Q:

Paypal integration with forms

How can I work paypal so that a user can fill out a form(registering an account, in this case) after buying a product on paypal site?
Visual Aid:
1.Site(user presses buy)
2.Paypal(user fills out credit card info)
3.Site(user registers an account for the product they are buying
The only option I could find on the paypal website is redirect to url, so I thought of messing around with response headers but then thought better of it, since they could be manipulated to get the product free.
Is there an api or something for this? I would prefer a time and cost effective solution.

A:

Instant Payment Notification (IPN) is the way to go.  When any transaction happens on your PayPal account the PayPal server will POST the transaction data to a listener script you  have on your server.  Your script can receive this data, look at the txn_type (as well as many other parameters) and proceed accordingly.  
The IPN's happen in real-time so you can automate tasks and users won't have to wait on anything.  It also allows you to handle things like e-checks or pending payments of any kind because you'll get one IPN when it's pending (but wouldn't want to fully register at that point) and then another IPN when the pending payment either clears or fails so you can update your records accordingly.

