Re: [gdl2306] Integrating Google Checkout
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