PAYPAL IPN MADE EASY!
Before we go the implementation of the code, let us make sure that you have full understanding of how IPN (Instant Payment Notification) works. The IPN PROCESSOR page is not meant to be accessed directly from the payee’s browser. Payees are not supposed to access this page on their browser or be automatically re-directed to this page. The IPN processor page is invoked or called only by the PAYPAL SERVER every time there is a transaction that involves your Paypal Account. This is the reason why you will not see any HTML code in the ipn_processor page. The page that the user should see after his purchase is not the IPN Processor page but the AUTO-RETURN page. This is where many developers get confused about. The auto-return page is most commonly used to as page where the payee is redirected to after the payment. On some implementations, another technology called PDT (Payment Data Transfer) is incorporated to this page. The IPN processor page has already occurred in the background way before the payee is redirected to the auto-return page. The IPN is a way for you to perform internal business logics like order logging, order fulfillment, order notification, etc. Here’s a typical step-by-step action of how the IPN PROCESSOR PAGE is called.
1. PAYEE CLICKS THE BUY BUTTON
2. PAYEE IS REDIRECTED TO PAYPAL WHERE HE ENTERS HIS CREDIT CARD INFORMATION
3. PAYPAL CALLS THE IPN PROCESSOR PAGE (THE PAYEE DOES NOT SEE THIS AS IT HAPPENS BEHIND THE SCENES)
4. PAYPAL REDIRECTS THE PAYEE TO THE AUTO-RETURN PAGE
PAYPAL IPN is a technology that runs behind the scene. You typically don't type the IPN URL on your address bar to access it; it is called directly by Paypal gateway. And unlike ordinary webpages, the HTML output of any IPN implementation is not displayed on your browser making debugging very tricky and challenging. When an error occurs in the middle of the code, there is no visible error that will manifest where the problem came from. Unless you are willing to do a trial and error for each line of code in your IPN processor, you're facing quite a headache. Our intelligent IPN processor has a built-in DEBUGGER in the form of an audit trail that makes implementing IPN a breeze. It logs each crucial action of your IPN events in text file that you can later review via your browser using a utility that we also provide. The IPN idea is easy and simple, but when you start adding functions to it like manipulating databases, generating an email notification and that kind of stuff, that is when potential errors could invalidate your whole IPN. Our utility WILL PINPOINT and SHOW YOU EXACTLY WHERE THAT ERROR OCCURED in your program so you won't have to spend countless hours debugging something that you couldn't see. Remember, ALL IPN implementations do not display any visible output on your browser! They all happen in the background.
Substitute your own domain for any occurrence of: mydomainname.com
1. Do not modify any part of the source code just yet.
2. Upload the files into your public asp or html folder.
3. On your browser, access the PAYPAL IPN PAGE DIRECTLY.
4. On a separate browser window, access the log viewer page.
You should see the audit trail that was generated by the Paypal IPN page.
5. Try refreshing http://www.mydomainname.com/ ipn_processor.asp then again loading http://www.mydomainname.com/view_ipn_log.asp, you should see that the log keeps growing because it logs everything that happens in the IPN processor page.
6. Once you have confirmed that your audit trail log is successfully auditing every action happening on your IPN page, then you may begin substituting your own configuration.
7. The file custom_configuration.asp contains the most setup like
- Name of your log file
- Your company name and email
- Your database file and connection declarations
Q: The audit trail log seems not catching any IPN event.
A: Make sure that you have tested the IPN processor first by typing its address directly on you browser. Make sure also that you have the IPN processor properly configured in your Paypal account setup.
To check login to https://www.paypal.com
Click Instant Payment Notification Preferences
Enter the URL of your IPN processor. Example: http://www. mydomainname.com /ipn_processor.asp
Q:The IPN does not seem to create a log file, even after directly accessing the URL of the IPN processor.
A: Everything else can be traced by this script except ONLY IF it is not able to create the log file. This can happen very seldom and is also easy to fix. If you are hosting your site on a different server like a 3rd party ASP host, request them to give you file create permission on that folder where you put your log file. Give the exact folder and file name. If you are hosting your site on your own server, configure IIS to give the correct access rights to IUSR_<PCNAME>
Q. My server does not seem to have MSXML2 installed because an error occurs every time I create that object.
A. Download copy then install it. It can be found at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmsxml/html/msxmlcabfile.asp
Go to Paypal IPN Made-Easy Product Page