|
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:
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:
<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
|
|
| Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy |
| ©2008 Google |