I am working on a donations page which allows a user to enter a donation amount and then pay with PayPal. I have successfully created a sandbox account with PayPal. Once this has been done, I created a business account in order to receive payments and a personal account to make payments.
What I am trying to do is to make use of the Instant Payment Notification feature, which allows the developer to verify that the user actually made the transaction on PayPal's payment page (so that I can record it in the database).
I tried posting the URL of my IPN page on the business account. The problem is that it is not accepting the URL. This is the URL I am providing:
http://localhost:54866/Default.aspx
The website is not hosted online. How can this be done please? How should I provide the URL? Thanks :)
P.S. I am using C# and ASP.NET
Yup you are right you can't give localhost (it would try to resolve to paypals own server then...) so you have to do some trickery.
What you need to do is:
Lets say your shop is going to be www.mynewshop.com
1) set that up in paypal as the IPN redirect
2) Change your HOST file to redirect www.mynewshop.com to 127.0.0.1 (eg localhost)
You can test step 2 is working by trying to type eg www.mynewshop.com in the browser - If you have a server on port 80 it will resolve to localhost:80 or say you have devweb server running on :1234 type www.mynewshop.com:1234 in browser address bar and check resolves
3) set your port on the project to be :80 (as you cannot specify anything other than :80 in paypal either I think). You can set the project test server port via project.properties - set it to NOT dynamic port and then you can set the fixed :80
What will happen is Paypal tries to redirect you back to www.mynewshop.com which your pc tries to access but behind the scenes you end up at localhost.
From memory you can also set project properies to start the browser at eg www.mynewshop.com which means even in development you appear to be using live URL. This can have its advantages e.g. it will help you spot incorrect URL/deployment differences due to localhost vs live host URL.
Have fun! :) (and mark this as answer - I know it works because I solved this myself a long time ago)