Download & Extend

Google Checkout

Provides integration with Libraries API (2.x-dev) and a Drush Make script to download the google-checkout-php-sample-code.

This project is aimed at providing basic foundation for integrating your online store with the Google Checkout API using PHP.

Configuration

The Google Checkout integration can be configured by using Drupal variables. For example, the following can be placed in a site's settings.php file.

<?php
$conf
['google_checkout_merchant_id'] = '...';
$conf['google_checkout_merchant_key'] = '...';
$conf['google_checkout_server_type'] = 'sandbox'; // Defaults to production.
$conf['google_checkout_currency'] = '...'; // Defaults to USD.
?>

Example Usage

<?php
google_checkout_load_include
('item');
$cart = google_checkout_cart_init();
$cart->SetMerchantPrivateData(new MerchantPrivateData(array('uid' => $user->uid)));
$item = new GoogleItem(t('Something really nice for $17'), '', 1, 17);

...

// Communicate information to GoogleCheckout and redirect user to complete checkout.
google_checkout_cart_redirect($cart);

// Or make button.
echo $cart->CheckoutButtonCode();


/**
* Handle incoming request from Google Checkout.
*
* An acknowledgement response will automatically be sent once the hook has
* completed.
*
* @param $type
*   The request type.
* @param $root
*   The root XML element as a SimpleXML object.
* @param $serial_number
*   The serial number of the request.
*/
function hook_google_checkout_request($type, $root, $serial_number) {
  if (
$type == 'authorization-amount-notification') {
   
$order_number = (string) $root->{'google-order-number'};
   
$amount = (int) $root->{'authorization-amount'};

   
// Store it or do something cool.
 
}
}
?>

Downloads

Version Downloads Date Links
7.x-1.0 tar.gz (8.5 KB) | zip (10.42 KB) 2011-May-12 Notes

Project Information


Maintainers for Google Checkout

  • boombatower - 13 commits
    last: 1 year ago, first: 1 year ago

Issues for Google Checkout

To avoid duplicates, please search before submitting a new issue.
All issues
Bug reports