0

我试图为我的网站创建一个谷歌结帐付款。在这个链接

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>
4

1 回答 1

0
  1. 该部分向您展示了您需要生成XML什么(XML 代表您的checkout-shopping-cart)(使用任何平台/语言,在您的情况下为 RR)、base64 编码并最终为其创建签名(您还将对其进行 base64 编码)。HMAC-SHA-1

  2. HTML部分向您展示了将 base64 编码的 XML 和签名放在哪里。在这种情况下,它直接HTML FORM POST指向 Google - 请注意占位符:

    • <input type="hidden" name="cart" value="REPLACE_WITH_ENCODED_CART">
    • <input type="hidden" name="signature" value="REPLACE_WITH_SIGNATURE">
于 2013-02-04T21:48:09.527 回答