Using Paypal IPN with website running on localhost -


I want to integrate PayPal Instant Payment Notification (Paypal IPN) in my ASP.NET website. The website is in development mode and it runs on the local host.

After this tutorial () I created a script which is a symbol of IPN notification. This IPN notification hits the IPN handler of my website.

However, when my IPN handler returns the information back to PayPal sandbox, PayPal always pays INVALID. I think this is expected because PayPal did not send the original IPN message.

However, I want to test the code when the IPN message is verified by PayPal. I do not currently have any way to do this. PayPal Docs say that I should keep that code when the message is verified in the block, when the message is invalid.

  If (feedback == "verify") {// block any code here and below if put in another code} and if (response == "INVALID") {}  

This technique is very inauspicious and incomplete for me. When I am stationed on a live server, I have to change my code.

Is there any better way to check IPNs using localhost?

The snippet you've shown is the right way to do this, I'm not sure Why do you think that when you are alive you have to change anything .. ??

According to the correct / incorrect, according to what I like to do, only $ verified parameters are determined. / P>

  if (response == "verified") {$ verified = true; } And if (response == "INVALID") {$ verified = false; }  

You can use from that point in your script ($ verified) to handle some tasks, whatever code you want to do, when a successful call is made, Then he should go inside the verified code block, and if he is not verified, then he should go to another block, or if there is (verified!) Block.

I usually do the same thing for all IPNs, but I have a field in my database to store IPN status. In my own reporting or web application like this I Easily sort out verified and unverified data, and I can process them, though I want to.

Docs says that when you test with a local form, the data is not coming from PayPal, so they will always remain unverified. If you want to fully test the real data from PayPal, you can use the IPN simulator available in your PayPal Developer account, either in the Sandbox or by installing IPN in your Sandbox vendor account and actually processing any payment can do.

Of course, you will need to make sure that your IPN script is configured to handle both the sandbox and the live transaction, but assuming that you will receive a verified IPN in those tests, Because actually the data came from PayPal's sandbox server.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -