简体   繁体   English

带有图像按钮ASP.NET(沙盒帐户)的贝宝格式错误的项目金额

[英]PayPal with image button ASP.NET ( sandbox account) incorrectly formatted item amount

Easy one for the experts I hope. 我希望对专家来说简单。 I am a student, please help! 我是学生,请帮忙!

I have an incorrectly formatted amount when I checkout in Paypal with my asp.net page, any tips? 当我使用asp.net页面在Paypal中结帐时,我的格式格式有误,有什么提示吗?

Here is my code in c# asp: 这是我在C#ASP中的代码:

  <asp:ImageButton ID="ImageButton3" runat="server" 
       ImageUrl="~/Catalog/Images/Thumbs/buynow.jpg" 
       PostBackUrl='<%# "https://www.sandbox.paypal.com/cgi-bin/webscr?" +
              "cmd=_xclick" + 
              "&business=seller_1346751061_biz@gmail.com" +
              // seller email is also static
              "&item_name=" + Eval("ModelName") +
              // ValueX is dynamic name of product item
              "&amount=" + Eval("UnitCost") +
              // ValueY is dynamic cost of product item
              "&currency_code=AUD" // this is also static
        %>'
  />

What you try to do is simple NOT working. 您尝试做的是简单地不起作用。

The data item_name , amount etc, must be send using POST and not place them on the url using GET . 数据item_nameamount等必须使用POST发送,而不能使用GET将它们放在url上。

Also, by placing the PostBackUrl on this button you post all the page data to the paypal, and not the actually data that paypal needs. 另外,通过将PostBackUrl放置在此按钮上,可以将所有页面数据发布到Paypal,而不是Paypal实际需要的数据。

The correct way is to make a totally custom made form like paypal ask on his examples and the manual , and this can not be done that way from a usually asp.net form. 正确的方法是在他的示例和手册上制作一个完全定制的form例如paypal ask,而这通常不能通过通常的asp.net表单来完成。

One trick that you can make is to use a dynamic form maker, as on this example: 您可以采用的一种技巧是使用动态表格制作工具,例如以下示例:

http://www.codeproject.com/Articles/37539/Redirect-and-POST-in-ASP-NET http://www.codeproject.com/Articles/37539/Redirect-and-POST-in-ASP-NET

and ether make dynamic post, ether place your buttons there and ask the user to click on it. 然后ether进行动态发布,ether将您的按钮放在那儿并要求用户单击它。

Also you can consider this articles with sample code: 另外,您还可以考虑以下示例代码:

http://www.codeproject.com/Articles/42894/Introduction-to-PayPal-for-C-ASP-NET-developers http://www.codeproject.com/Articles/19184/Use-of-the-PayPal-payment-system-in-ASP-NET http://www.codeproject.com/Questions/120427/Paypal-API-Integration-into-ASP-Net-Web-Site http://www.codeproject.com/Articles/42894/Introduction-to-PayPal-for-C-ASP-NET-developers http://www.codeproject.com/Articles/19184/Use-of-the-PayPal -payment-system-in-ASP-NET http://www.codeproject.com/Questions/120427/Paypal-API-Integration-into-ASP-Net-Web-Site

And do not forget the paypal SDK for asp.net: 并且不要忘记asp.net的paypal SDK:
https://www.paypal.com/us/cgi-bin/webscr?cmd=p/pdn/sdk_asp_net_how-it-works-outside https://www.paypal.com/us/cgi-bin/webscr?cmd=p/pdn/sdk_asp_net_how-it-works-outside

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM