Paypal返回URL未正确触发

时间:2017-12-12 11:18:24

标签: c# asp.net-mvc paypal paypal-sandbox

我们的网站有一次付款按钮。

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
    <input type="hidden" name="custom" value="@Model.UserId.ToString()">
    <input type="hidden" name="notify_url" value="http://www.testweb.com/paypal/IpnHandler">
    <input type="hidden" name="return" value="http://www.testweb.com/paypal/Onetimeyearlysuccess">
    <input type="hidden" name="cancel_return" value="http://www.testweb.com/paypal/cancel">
    <input type="hidden" name="cmd" value="_s-xclick">
    <input type="hidden" name="hosted_button_id" value="8xxxxxxC">
    <input type="image" src="@Url.Content("~/images/OneTime55year.png")" border="0" name="submit" style="width: 130px !important; height: 47px !important;" alt="PayPal - The safer, easier way to pay online!" >
</form>

完成paypal付款后,我们可以看到我们收到404错误。 问题是我们收到了错误的网址。

https://www.testweb.com/PaypalOnetimeyearlysuccess?amt=55.00&cc=USD&cm=22028&item_name=oneTimeAnnual55&st=Completed&tx=59M0424544743135Y

我们不知道为什么paypal之后丢失斜线。

正确的网址应为

https://www.testweb.com/Paypal/Onetimeyearlysuccess?amt=55.00&cc=USD&cm=22028&item_name=oneTimeAnnual55&st=Completed&tx=59M0424544743135Y

地址网址中的paypal之后需要有斜杠符号。

您也可以从paypal按钮的返回网址中看到正确的网址。

为什么会重定向到错误的地址?

另外,为了测试目的,我们更改了paypal按钮的返回URL。我们只是修改为“http://www.testweb.com/paypal/Onetimeyearlysuccesstest。”

但我们可以看到更改返回URL后,paypal不会重定向到修改后的URL。

实际上我们很困惑,我们需要知道返回网址的创建位置。

1 个答案:

答案 0 :(得分:0)

PayPal只识别'return'变量的值。关键点位于此URL(http://www.testweb.com/paypal/Onetimeyearlysuccess)。建议您创建一个没有重定向功能的固定单页,如.html,.php,.aspx等,以查看结果。