IntroductionThe process of submitting a payment to Google Checkout begins with a user clicking a "Buy Now" button. This document describes precisely how to create this button. Step 1. Setup your config.phpLocated somewhere in your search path, but in the ./lib/ directory by default, is a file called "config.php". In order for anything to work with this library, you must edit this file and provide the following: - Your Merchant ID
- Your Merchant Key
- Your Callback URL
Finding Your Merchant Information- Login to your Google Checkout seller account.
- Click on the Settings tab.
- Click on "Integration" in your left navigation.
- On this next page you will find the information we are looking for. Look for the following:
Account information
Google merchant ID
6355xxxxxx60346
Google merchant key
T6BxxxxxxxxxxxoYRbhgStep 2. Create Your Button in PHPOnce your config file is setup properly, then creating a button is as simple as: - Instantiate a shopping cart.
- Add items to the cart.
- Output the cart's button as HTML.
Take a look at the following sample code: include("lib/config.php");
include("lib/GoogleCheckoutCart.php");
$cart = new GoogleShoppingCart();
$item = new CartItem("Demo Purchase","Some stuff","1.00",1);
$cart->addPrivateData("MyAccountID","345");
$cart->addItem($item);
$cart->callbackURL = CALLBACK_URL;
print $cart->button->toHTML($cart);
|