谷歌结帐在ASP.Net MVC [英] Google Checkout in ASP.Net MVC

查看:154
本文介绍了谷歌结帐在ASP.Net MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用谷歌结帐(我有一个ImageButton的同一项PostBackUrl设置为谷歌地址传递隐藏字段的值)的正常工作一个相当简单的ASP.Net网站。

I have a fairly simple ASP.Net site that uses google checkout (I have an imagebutton with the PostBackUrl set to the Google address passing values of hidden fields) which works fine.

我一直在这个移动应用程序来MVC,我不知道如何处理这个问题。我想过使用jQuery形式,但我不相信这会在这种情况下工作,因为有些时候,他们正在重新定向到谷歌的网页。有没有人使用谷歌结帐在一个asp.net MVC应用程序?

I've been moving this app to MVC and I'm not sure how to handle this. I thought about using jQuery form but I don't believe this would work in this situation because there are times when they're redirected to the google pages. Has anyone used google checkout in an asp.net MVC app?

推荐答案

您可以做同样的事情,你做之前,只是你最终做手工。

You can do the same thing as you were doing before, just you end up doing it manually.

听起来你只使用基本的版本,是吗?

Sounds like you're using just the basic version, yes?

您创建具有操作设置为谷歌结帐过程HTML表单,加入适当的隐藏字段(控制器向下传递的模型将被填充瓦特/那些正确的价值观),然后你有一个提交按钮(或者,如果你像preFER)。

You create an HTML form that has the Action set to the Google checkout process, add in the proper Hidden fields (the model your controller passes down would be populated w/ the correct values for those) and then you have a submit button (or image if you prefer).

那么,一个例子了谷歌的基本的HTML页面,修改了某些MVC-ISH岬会是这样的:

So, an example off Google's Basic HTML page, modified for some MVC-ish-ness would be something like this:

<form method="POST"
  action="https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/<%= Model.MerchantId %>"
      accept-charset="utf-8">

  <input type="hidden" name="item_name_1" value="<%= Model.Item.Name %>"/>  
  <input type="hidden" name="item_description_1" value="<%= Model.Item.Description %>>  
  <input type="hidden" name="item_quantity_1" value="<%= Model.Item.Quantity %>"/>  
  <input type="hidden" name="item_price_1" value="<%= Model.Item.Price %>"/>  
  <input type="hidden" name="item_currency_1" value="<%= Model.Item.Currency %>"/>  
  <input type="hidden" name="ship_method_name_1" value="<%= Model.Shipping.Price %>"/>  
  <input type="hidden" name="ship_method_price_1" value="<%= Model.Shipping.Price %>"/>  
  <input type="hidden" name="ship_method_currency_1" value="<%= Model.Shipping.Currency %>"/>  
  <input type="hidden" name="tax_rate" value="<%= Model.Tax.Rate %>"/>  
  <input type="hidden" name="tax_us_state" value="<%= Model.Tax.State %>"/>  
  <input type="hidden" name="_charset_"/>  
  <input type="image" name="Google Checkout" alt="Fast checkout through Google"
src="http://checkout.google.com/buttons/checkout.gif?merchant_id=<%= Model.MerchantId %>&w=180&h=46&style=white&variant=text&loc=en_US"
height="46" width="180"/>  
</form>  

显然,你可以做一切更加MVC-ISH使用的形式助手Html.Hidden等,但它显示出你需要做什么,真正的基本版本。

Obviously, you could make all that even more MVC-ish by using the form helper Html.Hidden and so on, but that shows the really basic version of what you need to do.

这篇关于谷歌结帐在ASP.Net MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆