0

I trying to create a google checkout payment for my site. In this link

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

I create a demo of how my code will be, here are my options

enter image description here

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 
              &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.

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

I know this code, goes into my view, but where I have to put the 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>
Saju
  • 3,201
  • 2
  • 23
  • 28
Jean
  • 5,201
  • 11
  • 51
  • 87

1 Answers1

0
  1. 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-1signature for it (which you will also base64 encode).

  2. The HTML section shows you where you would put both base64 encoded XML and the signature. In this case, it's a direct HTML FORM POST to Google - note the placeholders:

    • <input type="hidden" name="cart" value="REPLACE_WITH_ENCODED_CART">
    • <input type="hidden" name="signature" value="REPLACE_WITH_SIGNATURE">
EdSF
  • 11,753
  • 6
  • 42
  • 83