Tuesday, March 20, 2007

Paypal - Instant Payment Notification & Website Payment Preferences

When you use Paypal it is also important to tie these transactions into your own backend systems.

For example fi you only have 10 products to sell, you want to make sure you decrement the number of items on stock or if you are using it for a holiday home booking system, you don't want a double booking.

There are two ways to achieve this. You can use IPN (instant payment notification) or you can set the Auto Return for Website Payments in your Website Payment options. Both options interact with a url on your server which you specify (profile/wesite payment preferences/return url or profile/instant payment notification preferences/ Instant Payment Notification (IPN) URL) in a slightly different way.

You need to put a file on your server that interacts with paypal. The example is using IPN and Classic ASP.

Things to note about this approach, as Paypal calls this from behind the scenes, users will never see it and session and application variables cannot be used. The events on that page will be fired but never shown on screen.

You can use the Auto Return Function and this is rendered on screen either by a click or be a timed redirect. It can use session and application variables and it can be used to show a thank you message to your customers.

It would be best to create functionality for both scenarios so that your site captures all paypal activity and not just the ones that redirect which may not happen.

Hope this helps

No comments: