I want to integrate Paypal Instant Payment Notifications (Paypal IPN) into my ASP.NET website. The website is in development mode and it runs on localhost.
Following this tutorial (https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNTesting/#local) I created a script that simulates a IPN notification. This IPN notification hits the IPN handler of my website.
However, when my IPN handler reposts the information back to Paypal sandbox, Paypal always returns INVALID. I guess this is expected because Paypal did not send the original IPN message.
However, I want to test the code that will run when IPN message is verified by Paypal. Currently I have no way to do it. Paypal docs say that I should put the code that runs when message is verified into the block that runs when message is invalid.
That is
if(response == "VERIFIED")
{
//put any code here in the else if block below
}
else if(response == "INVALID")
{
}
This technique appears very unclean and incomplete to me. I will have to change my code when I deploy to live server.
Is there a better way to test IPN using localhost?