Paypal Ipn integration with asp.net MVC

前端 未结 2 1692
执笔经年
执笔经年 2021-01-16 00:28

HomeControler/Index.cshtml page is as below

相关标签:
2条回答
  • 2021-01-16 01:12

    You can check ipn on your localhost. You need to set up your router to accept and redirect incoming calls to your localhost. Then go to paypal.sandbox. Using their tools you can mimic different IPN responses to your localhost(of course using your outside Ip address).

    In this way, sandbox sends tcp/Ip messages to your machine, your router redirects it to your machine which is hosting the test website.

    It is best not to try to send a message to sandbox and expect to receive and capture the response back. It is not that sandbox is not working correctly. It is.

    The problem is if sandbox responds quickly then your test machine(whilst in debug mode) may not be fast enough to capture the return tcp/ip packet. You could use another machine to start a transaction on your localhost website. i.e. decoupling test transaction path.

    Hope this helps.

    0 讨论(0)
  • 2021-01-16 01:20

    If I remember correctly, the IPN is an asynchronous call that can come at anytime after the transaction (its generally "instant", sometimes not so much). But this comes from PayPal, who cannot access http://localhost. To test IPN you need to deploy to an actual internet site that anyone can access. It's been a few years since I worked with IPN - but that was my general experience. Setup some logging in your application, publish, then do your test transactions.

    EDIT:

    Also - I think you can give it your WAN IP address (not local), open up the ports in your router, and instead use that IP address (note you may need to enable remote connections with IIS Express - see IIS Express enable external request):

    <input type="hidden" name="notify_url" value="https://97.25.43.21:13769/Home/Ipn">
    
    0 讨论(0)
提交回复
热议问题