Google Groups Home
Help | Sign in
Recent pages and files
Allowing buyers to specify their own price, product name, description, or quantity    

 

This article will show you how to implement Google Checkout buttons that allow the user to fill in some input fields prior to cart submission. This feature is useful if you sell products or services that do not have fixed descriptions or unit prices.

First, because this technique works with the HTML API only, you must enable the HTML API in your settings. This can be done in your Google Checkout Merchant Center as follows:
  1. Sign in to your Google Checkout merchant account at https://checkout.google.com/sell/.
  2. Click the Settings tab.
  3. Click Integration.
  4. Remove the check from the box next to For extra security, my company will only post digitally signed XML shopping carts. (Google should reject all others).
  5. Click Save.

If you're not familiar with the HTML API, please refer to the HTML API Developer's Guide as necessary.

The HTML API is composed of a series of hidden input name/value pairs, such as <input type="hidden" name="item_price_1" value="9.99"/>. However, instead of providing predefined values for these name/value pairs, you could substitute blank fields for the user to fill in by following these two simple steps:
  1. Change the type of the input field from hidden to text (for example, from <input type="hidden" ... /> to <input type="text" ... /> ).
  2. Remove the value parameter from the input field.
Applying these two steps to <input type="hidden" name="item_price_1" value="9.99"/> results in <input type="text" name="item_price_1"/>.

As a full example, the following HTML form will create a Google Checkout button with an input field for the price:

* Be sure to use your Merchant ID in place of '1234567890' in the POST URL and the button image src URL:

<!-- Google Checkout button with a blank price field -->
<form method="POST" action="https://sandbox.google.com/checkout/cws/v2/Merchant/1234567890/checkoutForm" accept-charset="utf-8">
 
  <!-- Product Name -->
  <b>Peanut Butter</b>
  <input type="hidden" name="item_name_1" value="Peanut Butter"/>
  <br/>

  <!-- Product Description -->
  <i>Chunky peanut butter</i>
  <input type="hidden" name="item_description_1" value="Chunky peanut butter."/>
  <br/>

  <!-- Quantity -->
  <input type="hidden" name="item_quantity_1" value="1"/>
 
  <!-- Unit Price -->
  Price: $
  <input type="text" name="item_price_1"/>
  <br/>

  <!-- charset=UTF-8; Do not remove this line -->
  <input type="hidden" name="_charset_"/>

  <!-- Display Google Checkout button -->
  <input type="image" name="Google Checkout" alt="Fast checkout through Google" src="http://sandbox.google.com/checkout/buttons/checkout.gif?merchant_id=1234567890&w=180&h=46&style=white&variant=text&loc=en_US"
height="46" width="180"/>


</form>


In the above example, the first three input fields are of type hidden with predefined values while the unit price (item_price_1) field is a text field without a value parameter.

This form will create an input field above the Google Checkout button so the user can specify his own price as shown below:


As shown in this example, adding some descriptive text such as "Price: $" in front of the input field would help the user know what to enter in the input field.

You can follow the two steps outlined above to turn any HTML API name/value pair into a user-specified input field.

More Examples

Blank Product Name
Name: <input type="text" name="item_name_1"/>
Blank Product Description
Description: <input type="text" name="item_description_1"/>
Blank Quantity
Quantity: <input type="text" name="item_quantity_1"/>
Blank Unit Price
Price: $<input type="text" name="item_price_1"/>


Version: 
Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google