[英]Google Checkout “XML code and send client-to-server” Ruby on Rails
I trying to create a google checkout payment for my site. 我试图为我的网站创建Google Checkout付款。 In this link
在此链接
https://developers.google.com/checkout/developer/interactive_demo
https://developers.google.com/checkout/developer/interactive_demo
I create a demo of how my code will be, here are my options 我创建了一个代码演示示例,这是我的选择
Then the page generate this code: 然后页面生成以下代码:
<!-- Sell digital goods with description-based delivery of download instructions (with tax, no shipping) -->
<?xml version="1.0" encoding="UTF-8"?>
<checkout-shopping-cart xmlns="http://checkout.google.com/schema/2">
<shopping-cart>
<items>
<item>
<item-name>Super Software 5000</item-name>
<item-description>Super Software 5000 improves download speeds.</item-description>
<unit-price currency="USD">1.00</unit-price>
<quantity>1</quantity>
<digital-content>
<display-disposition>OPTIMISTIC</display-disposition>
<description>
It may take up to 24 hours to process your new storage. You will
be able to see your increased storage on your
<a href="http://login.example.com">account page</a>.
</description>
</digital-content>
</item>
</items>
</shopping-cart>
<checkout-flow-support>
<merchant-checkout-flow-support/>
</checkout-flow-support>
</checkout-shopping-cart>
<!-- No tax code -->
<!-- No shipping code -->
You need to encode and sign the above XML code before posting it.
Can anyone explain to me what I have to do with this xml code I where I have to put it on my rails project???? 谁能向我解释该XML代码与我必须放在Rails项目中的位置有关?
I know this code, goes into my view, but where I have to put the XML??? 我知道这段代码,进入了我的视野,但是我必须将XML放在哪里??? Thanks for your help
谢谢你的帮助
<form method="POST"
action="https://sandbox.google.com/checkout/api/checkout/v2/checkout/Merchant/REPLACE_WITH_YOUR_SANDBOX_MERCHANT_ID">
<input type="hidden" name="cart" value="REPLACE_WITH_ENCODED_CART">
<input type="hidden" name="signature" value="REPLACE_WITH_SIGNATURE">
<!-- Button code -->
<input type="image" name="Google Checkout"
alt="Fast checkout through Google"
src="http://sandbox.google.com/checkout/buttons/checkout.gif?merchant_id=REPLACE_WITH_YOUR_SANDBOX_MERCHANT_ID&w=180&h=46&style=white&variant=text&loc=en_US"
height="46"
width="180">
</form>
The XML
section shows you what (XML representing your checkout-shopping-cart
) you need to generate (using whatever platform/language, in your case RR), base64 encode and finally create a HMAC-SHA-1
signature for it (which you will also base64 encode). XML
部分向您显示需要生成什么(XML代表您的checkout-shopping-cart
)(使用任何平台/语言,在您的情况下为RR),base64编码并最终为其创建HMAC-SHA-1
签名。也将进行base64编码)。
The HTML
section shows you where you would put both base64 encoded XML and the signature. HTML
部分向您展示了将base64编码的XML和签名放在哪里。 In this case, it's a direct HTML FORM POST
to Google - note the placeholders: 在这种情况下,这是直接发送给Google的
HTML FORM POST
请注意占位符:
<input type="hidden" name="cart" value="REPLACE_WITH_ENCODED_CART">
<input type="hidden" name="signature" value="REPLACE_WITH_SIGNATURE">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.