|
|
Troubleshoot Instant Payment NotificationsEffectively diagnose processing problems and overcome some of IPN's stumbling blocks. The IPN system is one of the most powerful features of the PayPal system. Deploying it requires a certain level of programming skill, but even with perfect programming, there can be issues that arise in deploying any new system for the first time. In the case of implementing IPN, there are several things you can do to help diagnose any issues that arise. The first step in testing your IPN system is to make a live purchase on the system so that the script gets called by PayPal [Hack #65] . Adding Email to IPNA good way to help diagnose problems is to have your IPN processing page send you all the variables and their values as they were posted to the PayPal site. You can do this by inserting a server mail component function that emails you the complete form post from PayPal when your IPN page is called. You can add the code to send an email and also to include a switch to turn this function on and off with the following code, written in VBScript for Active Server Pages:
With this code added to the basic IPN processing code [Hack #65], the IPN page sends you an email with all the transaction data as posted by PayPal. This can help you determine whether the problems are with the data being passed back. Using a Return URLThe next way to test your IPN script is to
check to see if your IPN page is throwing any errors. You can do this
easily by redirecting to your IPN page after payment (using the
When this code is added to your purchase button, PayPal redirects you
back to your IPN script after payment and a form
Capturing ErrorsOne way to find out if your IPN script is causing an error is to insert error-capturing code within your IPN page. When a page error occurs, you can get an email letting you know that an error has occurred and what the error was. This example uses ASP written in VBScript. First, you have to add the following piece of code to the top of your IPN page:
That line makes sure that the page continues to process if an error is detected. Then, at the bottom of your IPN page, insert the following:
Once you add this code to your IPN script, you'll be notified via email when an error has occurred.
Using a Third-Party Testing ScriptAnother easy way to test your IPN page is to use a third-party testing script that simulates a PayPal purchase to your IPN script without having to make an actual purchase. The best third-party testing script is located at http://www.eliteweaver.co.uk/testing/ipntest.php. Test your script by simply entering your IPN page's web address. You also have to change the following line in your IPN page (the postback line) so your script does not try to send the posted data back to PayPal as it causes an Invalid response from their system:
Change it like so:
Then, you can fill in the script form with any information you like and submit it to simulate the post to your IPN script. You can find a list of all available testing scripts at http://www.paypal.com/cgi-bin/webscr?cmd=p/pdn/3p-solutions-ipntools-outside. Shannon Sofield began working with Macromedia development tools when Macromedia acquired Future Splash. Dave Nielsen is the co-founder of CloudCamp, and principal consultant at Platform D, a developer programs consulting company. He is also coauthor of PayPal Hacks. Dave Burchell got his start with computers by programming the Radio Shack TRS-80 in BASIC and the Commodore 64 in 6510 assembly. A fervent proponent of XML, Dave enjoys solving content-management problems with markup and open source software. View catalog information for PayPal Hacks Return to the Web DevCenter.
Comments on this article
1 to 1 of 1
1 to 1 of 1
|
|
|
|
|
||||||||