繁体   English   中英

Google Checkout“ XML代码并发送客户端到服务器” Ruby on Rails

[英]Google Checkout “XML code and send client-to-server” Ruby on Rails

我试图为我的网站创建Google Checkout付款。 在此链接

https://developers.google.com/checkout/developer/interactive_demo

我创建了一个代码演示示例,这是我的选择

在此处输入图片说明

然后页面生成以下代码:

  <!-- 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 
              &lt;a href=&quot;http://login.example.com&quot;&gt;account page&lt;/a&gt;.
            </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.

谁能向我解释该XML代码与我必须放在Rails项目中的位置有关?

我知道这段代码,进入了我的视野,但是我必须将XML放在哪里??? 谢谢你的帮助

<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>
  1. XML部分向您显示需要生成什么(XML代表您的checkout-shopping-cart )(使用任何平台/语言,在您的情况下为RR),base64编码并最终为其创建HMAC-SHA-1签名。也将进行base64编码)。

  2. HTML部分向您展示了将base64编码的XML和签名放在哪里。 在这种情况下,这是直接发送给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.

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