|
|
Classic ASP Sample Code for Google Checkout v2.3.2 - 11/2/2007
File structure and function
There are two folders and a log file in the top level directory of google-checkout-classicasp-sample-code.
1. "demo" directory - This contains three demo files for posting carts (Checkout API) and handling callbacks (Notification API, Order Processing API, Merchant Calculation API).
- ShoppingCart.asp
- This file displays a Google Checkout button. This page is analogous to the shopping cart page (or View Cart page) on a merchant's website where the merchant's standard checkout button is also displayed. When a buyers clicks on the Google Checkout button, CartProcessing.asp page is invoked for the creation and posting of the cart to Google Checkout. To integrate Google Analytics with your Google Checkout implementation, you must insert Analytics code on the page where the Google Checkout button is placed. Also, the variable "Analytics" must be set to true when displaying the Checkout button
- CartProcessing.asp
- This file demonstrates the steps required to add items, shipping, taxes and other parameters to the cart before it is posted to the Checkout server. This file is invoked when a buyer clicks on the Google Checkout button displayed on the ShoppingCart.asp page.
- Callback.asp
- This file is used to handle the notifications (Notification API), callbacks (Merchant Calculation API) and order processing commands (Order Processing API). The path for this file must be specified in the merchant's API callback URL in Settings->Integration of the Merchant Center. This file should be modified by the merchant as per their business workflow details. Some of the intial steps performed in this file include collecting the XML sent by the Checkout server and creating an object represetation of the notification/callback for easy accessibililty. A list of possible order processing commands are provided as comments in the code inside the ProcessOrderStateChangeNotification function. ProcessMerchantCalculationCallback file should be modified to return accurate shipping price, tax and coupon/gift-certificate results as necessary.
2. "library" directory - This contains the classes defined to describe the API structure so as to easily define and add XML entries by defining objects of these classes.
- googleglobal.asp
- This file contains global variables and functions used by various classes. The Const variables in the beginning of this file must be defined by the merchant before running the sample code. Some of these variables include EnvType {SANDBOX/PRODUCTION} and the Merchant ID and Key associated with the merchant account.
- googlecart.asp
- Class Cart is the main class for Checkout API and must be instantiated to post a cart. It has methods to add items, shipping options, tax options and merchant-calculation details.
- googleshipping.asp
- These classes (FlatRateShipping, MerchantCalculatedShipping, CarrierCalculatedShipping, Pickup) are used for shipping methods that will be added to the cart. They require the shipping name and price to be specified.
- googletax.asp
- These classes are used to define tax rules for the tax tables. These may be rules for default tax rules or alternate tax tables.
- googlenotification.asp
- Each of these classes represents a notification message sent by the Checkout server. These classes are used in the Callback.asp file for parsing and creating object representation of the notifications.
- googlemerchantcalculation.asp
- MerchantCalculationCallback and MerchantCalculationResults classes are used for handling merchant calculations API. Callbakc.asp receives <merchant-calculation-callback> and returns <merchant-calculation-results> back to Google Checkout.
- googleorder.asp
- This file contains the methods necessary to create and send an order processing command. Examples of how to call each method is included in the Callback.asp file inside the ProcessOrderStateChangeNotification function.
- xmlbuilder.asp
- The XmlBuilder class generates XML and consists of "push" and "pop" methods to add open and close tags respectively. It also contains other XML functions used internally by the library classes to generate and parse through XML.
3. googlemessage.log - This log file records all the XML sent and received. This can be useful information for debugging purposes. The name of this logfile can be modified in the googleglobal.asp file. The file permission should be properly set so that it's writable by the application yet kept secure since these messages contain user sensitive data.
If you're looking for the documentation of the earlier versions (below v2.0) of the Classic ASP sample code, visit http://code.google.com/apis/checkout/samples/Google_Checkout_Sample_Code_ASP.html
Sign in to add a comment

why cant google make it simple like paypal.
Too bloody right.
This website is spaghetti coding at its worst!
Too bloody right.
This website is spaghetti coding at its worst!