2011-08-02 176 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);在結束而不是返回查看()