Integrating Google Checkout

6 posts by 2 authors in: Forums > CMS Builder
Last Post: June 6, 2008   (RSS)

Re: [gdl2306] Integrating Google Checkout

By Dave - June 6, 2008

Hi Gerald, welcome to the CMS Builder forum! :)

The first step is to figure out the code to make google checkout work with a regular html page. The next step is to figure out how to automatically generate that code with CMS Builder.

Can you post an example of the html google checkout needs? I'll see if I can make any suggestions. I've done a few paypal integrations with CMS Builder and I imagine it's similar.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Integrating Google Checkout

By gdl2306 - June 6, 2008

Thanks. Huge improvement to PageBuilder, by the way.

Google code per product is


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

<input type="hidden" name="item_name_1" value="Peanut Butter"/>
<input type="hidden" name="item_description_1" value="Chunky peanut butter."/>
<input type="hidden" name="item_quantity_1" value="1"/>
<input type="hidden" name="item_price_1" value="3.99"/>
<input type="hidden" name="item_currency_1" value="USD"/>

<input type="hidden" name="ship_method_name_1" value="UPS Ground"/>
<input type="hidden" name="ship_method_price_1" value="10.99"/>

<input type="hidden" name="tax_rate" value="0.0875"/>
<input type="hidden" name="tax_us_state" value="NY"/>

<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=1234567890&w=180&h=46&style=white&variant=text&loc=en_US"
height="46" width="180"/>

</form>

Gerald

Re: [gdl2306] Integrating Google Checkout

By Dave - June 6, 2008

Hi Gerald,

So what I'm thinking is you could just create fields for the values that you need to change. You probably have some of them setup already. In this case you'd need: name, description, price, and shipping (assuming it will always be UPS Ground"). It tax_rate and other values won't change we can leave those as is.

Then you'd insert those in the content as follows. Not that I'm using the PHP htmlspecialchars() function to encode the values so if there is a " in the value it doesn't break the tag. Also, I'll use the variable name $product, but feel free to use whatever your variable name is called.

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

<input type="hidden" name="item_name_1" value="<?php echo htmlspecialchars($product['name']); ?>"/>
<input type="hidden" name="item_description_1" value="<?php echo htmlspecialchars($product['description']); ?>"/>
<input type="hidden" name="item_quantity_1" value="1"/>
<input type="hidden" name="item_price_1" value="<?php echo htmlspecialchars($product['price']); ?>"/>
<input type="hidden" name="item_currency_1" value="USD"/>

<input type="hidden" name="ship_method_name_1" value="UPS Ground"/>
<input type="hidden" name="ship_method_price_1" value="<?php echo htmlspecialchars($product['shipping']); ?>"/>

<input type="hidden" name="tax_rate" value="0.0875"/>
<input type="hidden" name="tax_us_state" value="NY"/>

<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=1234567890&w=180&h=46&style=white&variant=text&loc=en_US"
height="46" width="180"/>

</form>


Does that example make sense? Give it a try and let me know if you have any questions or need more help!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Integrating Google Checkout

By gdl2306 - June 6, 2008

Thanks Dave. Just realized I am being a bit thick as I can produce this code for every product by simply including it within php loops. Cheers. Gerald

Re: [gdl2306] Integrating Google Checkout

By Dave - June 6, 2008

No problem at all, we're here to help! :)
Dave Edis - Senior Developer
interactivetools.com