Class Gregphoto_Service_Google_Checkout

Description

A class for creating the Google Checkout forms for selling items from your own website

  • version: 0.1
  • author: Greg Neustaetter [www.gregphoto.net]

Located in /Googlecheckout.php (line 8)


	
			
Variable Summary
Method Summary
Gregphoto_Service_Google_Checkout __construct (string $merchant_id, string $merchant_key)
void addItem (string $name, string $description, double $price, int $quantity, [string $privateData = false], [string $taxTable = false])
void addItemsXML (DOMElement $itemsNode)
void generateXML ()
string getHTMLForm ()
string getSignature ()
string getURL ()
string getXML ()
string HMAC_SHA1 (string $data, string $key)
void printXML ()
void setCurrency (string $currency)
void setDefaultXML (string $value, [string $type = 'file'])
void setMode (string $mode)
void setShipping (string $name, double $price, [string $type = 'flat'], [array $options = array()])
void setStateTax (string $state, double $rate)
Variables
string $continueShoppingUrl = false (line 31)

Url the user will be sent to if they choose to continue shopping after purchasing the items in the cart

  • access: public
mixed $defaultCurrency = 'USD' (line 16)
  • access: protected
mixed $defaultXML = false (line 18)
  • access: protected
string $editCartUrl = false (line 25)

Url the user will be sent to if they choose to edit their cart

  • access: public
mixed $flatRateShipping = array() (line 13)
  • access: protected
mixed $items = array() (line 12)
  • access: protected
mixed $merchantCalcShipping = array() (line 15)
  • access: protected
mixed $merchant_id (line 9)
  • access: protected
mixed $merchant_key (line 10)
  • access: protected
mixed $pickupShipping = array() (line 14)
  • access: protected
Boolean $shippingTaxed = false (line 37)

Whether or not shipping should be taxed

  • access: public
mixed $stateTax = array() (line 17)
  • access: protected
mixed $urlPrefix = 'https://checkout.google.com/' (line 19)
  • access: protected
mixed $xml (line 11)
  • access: protected
Methods
Constructor __construct (line 48)

Instantiates the class

  • access: public
Gregphoto_Service_Google_Checkout __construct (string $merchant_id, string $merchant_key)
  • string $merchant_id: The ten or 15 digit merchant ID assigned by Google
  • string $merchant_key: The twenty-two character merchant key assigned by Google
addItem (line 69)

Add a new item to the cart

  • access: public
void addItem (string $name, string $description, double $price, int $quantity, [string $privateData = false], [string $taxTable = false])
  • string $name: The part name/number
  • string $description: The part description
  • double $price: The unit price of the item in the default currency. May be positive or negative.
  • int $quantity: The quantity of the item.
  • string $privateData: Additional data to include with the item. This will not be shown to the user checking out.
  • string $taxTable: The alternative tax table to be used when computing tax for this item
addItemsXML (line 161)

Adds item elements to the XML for all items added with the addItem method

  • access: protected
void addItemsXML (DOMElement $itemsNode)
  • DOMElement $itemsNode: The <items> node of the XML
generateXML (line 87)

Creates the cart XML

  • access: protected
void generateXML ()
getHTMLForm (line 227)

Returns the HTML checkout button and form code with the cart XML and signature. This should be called last.

  • return: The HTML code for the form
  • access: public
string getHTMLForm ()
getSignature (line 325)

Get the HMAC_SHA1 encoded signature required for communicating with Google Checkout

  • return: The signature
  • access: public
string getSignature ()
getURL (line 256)

Gets the URL for sending the request to Google Checkout

  • return: The url
  • access: public
string getURL ()
getXML (line 278)

Gets a string representation of the cart XML

  • return: The XML string
  • access: public
string getXML ()
HMAC_SHA1 (line 300)

Implements the HMAC_SHA1 encryption

  • return: The encrypted data, in a binary format
  • access: public
string HMAC_SHA1 (string $data, string $key)
  • string $data: The data to be encrypted
  • string $key: The key for encryption
printXML (line 287)

For debugging, prints the generated XML to the screen

  • access: public
void printXML ()
setCurrency (line 185)

Sets the currency for the cart. The default currency is USD. You do not need to call this unless you are using a different currency

  • access: public
void setCurrency (string $currency)
  • string $currency: The currency code for the cart.
setDefaultXML (line 266)

Allows the user to specify a base XML file or string that will be used instead of generating the entire string. The user can then add items to this XML using the addItem method.

  • access: public
void setDefaultXML (string $value, [string $type = 'file'])
  • string $value: The file path or the XML string
  • string $type: Either 'file' or 'string', defaults to 'file'. If file, the value argument must be the path to the file and the file must be readable by the webserver.
setMode (line 245)

Sets the mode of the operation to use either the sandbox or live Google Checkout site. You only need to call this if using the sandbox as the class defaults to using the live site.

  • access: public
void setMode (string $mode)
  • string $mode: Either 'sandbox' or 'checkout'.
setShipping (line 197)

Adds a general shipping rule. You may add multiple rules of which the user may choose one

  • access: public
void setShipping (string $name, double $price, [string $type = 'flat'], [array $options = array()])
  • string $name: The name that will be shown to the user
  • double $price: The price of this shipping option. This is the price for shipping the entire contents of the cart.
  • string $type: Available options are 'flat', 'pickup', or 'merchantCalc'. MerchantCalc is not currently operational.
  • array $options: Adds additional options to the rule - this doesn't currently do anything.
setStateTax (line 218)

Sets a tax rate for a given state

  • access: public
void setStateTax (string $state, double $rate)
  • string $state: The two letter state code, i.e. 'CA'
  • double $rate: The tax rate, for example .0875 would be 8.75% tax rate

Documentation generated on Sat, 01 Jul 2006 12:24:03 -0700 by phpDocumentor 1.3.0RC3