简体   繁体   中英

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?

Here is my code in 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 .

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.

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.

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

and ether make dynamic post, ether place your buttons there and ask the user to click on it.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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