2011-08-02 179 views
0

我想在ASP.NET MVC 3.0应用程序中使用http://paypalhelper.codeplex.com贝宝帮手需要一些帮助

这样的步骤我做:

1)在Global.asax中

PayPal.Profile.Initialize("namehere", "passwordhere", "signaturehere", "sandbox"); 

2)比对Razor视图我宣布立即购买按钮与我的测试值注册贝宝助手

@{ 
var paypalButton = PayPal.ButtonManager.BuyNowButton.Create("sellerhere", "itemname", "10.00"); 
HtmlString paypalButtonHtml = new HtmlString(paypalButton.WebSiteCode); 
} 

@paypalButtonHtml 

所以结果我有一个HTML:

<input type="hidden" name="cmd" value="_s-xclick"/> 
<input type="hidden" name="hosted_button_id" value="SECRET_VALUE_HERE"/> 
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"/> 
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"/> 

比我点击那个按钮的页面发布到我的应用程序,但我预计它会被重定向到paypal网站继续付款。

我错过了什么吗?

我该怎么办才能将用户重定向到paypal paynow页面?

回答

1

你把@paypalButtonHtml放在你自己的<form>元素之外吗?

我在生产中使用paypal助手,它工作的很棒。

0

在您的Controller代码中,转到post方法并将返回新的RedirectResult(dredirectUrl);在结束而不是返回查看()