How to get past embedding a html form for paypal buttons asp.net

后端 未结 3 1208
盖世英雄少女心
盖世英雄少女心 2021-01-28 03:01

I have some experience of using paypal with an asp.net website, however this issue has me really stumped.

Root of the problem: You cant embed the html form for the payp

3条回答
  •  南笙
    南笙 (楼主)
    2021-01-28 03:20

    Had this issue with another payment provider also. You could either use their API, or you could work around it by:

    • Making the checkout button a standard imagebutton
    • Running something like ClientScript.RegisterStartupScript() to output both HTML and Javascript. The HTML should be the actual form with all hidden fields and proper id. The javascript is code which would execute on page load and submit the page.

    i.e. ClientScript.RegisterStartupScript(Me.GetType(), "PaypalSubmit", "", False)

    Hope this helps, otherwise you could use the web service API. By taking this approach you are performing a postback, outputting the HTML form (outside the .NET form because it is at the bottom of the page) and then relying on the javascript to actually submit it.

提交回复
热议问题