My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
Documentation  

Featured
Updated Feb 4, 2010 by jacob13moon@gmail.com

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

Comment by writecre...@hotmail.com, Jan 2, 2008

why cant google make it simple like paypal.

Comment by st...@parkit.co.uk, Jul 8, 2008

Too bloody right.

This website is spaghetti coding at its worst!

Comment by st...@parkit.co.uk, Jul 8, 2008

Too bloody right.

This website is spaghetti coding at its worst!

Comment by richard_...@hotmail.com, Jul 30, 2008

this is a joke! why make things hard for people?

Comment by talkings...@gmail.com, Oct 9, 2008

i was looking to switch from PayPal? to something else because PayPal? was not working and they were having errors with their API.. i see Google is not any better.. and it looks even more complicated. wow.. no thanks. they should create the pages for you for free with a 6 month commitment???

Comment by npet...@power101.com, Nov 22, 2008

I am also finding that PayPal? integration and IPN setup is a lot easier than figuring out Google checkout.

Comment by leecabi...@gmail.com, Nov 24, 2008

It is a lot more complicated than Paypal and I would prefer a simple form submission system like Paypal but it's by no means spaghetti code, it's actually really neat abstracted code, it's exactly how code should look.

Comment by jbigl...@madcatz.com, Dec 2, 2008

I agree. Much more difficult. The demo doesn't even work properly and it doesn't really demo anything. Maybe if they had a working demo with examples.

Comment by ois...@gmail.com, Jan 8, 2009

So it seems like we're all coming from PayPal? because of the troubles they're having.... terrible customer service, etc. I looked at the code and immediately realized that the Googlers don't understand what we're all wanting. I was pretty frustrated.

I spent an hour just trying to find the right information. I just want to do processing! No HTML crap, I just want simple sample code to do the API order processing.

So here's what we want. A simple form that posts to another page which then processes the payment. We want that sample code as well as the refund code and authorize code. Six pages of BASIC sample code with no included files and no unnecessary code. Add some documentation which explains EVERYTHING about the sample code, with additional paramaters, and what additional things you can do with it. Boom! We're ready to go. We're talking about millions of dollars of processing, but, I don't have time to read 15 web pages and strip apart all this code to test it, then integrate it into my sites.

Comment by officeba...@cncllc.com, Jan 12, 2009

This is a dang mess of a jumblef It should not be this dd hard to find the various html input_name <form> options. And the ASP code is a clusterf.

Comment by wesb...@gmail.com, Jan 25, 2009

PayPal? is a piece of cake! You're making it too time consuming for doing a simple stuff. Wessam Raafat

Comment by jam...@advancedwindsolutions.com, Feb 24, 2009

I have spent a full day trying to work with the above code crunching theory!!!!!Can't understand why they cant create a HTML code generator,applying your needs into it and you receive the code to paste!!!!!

Comment by chapinsa...@gmail.com, Jun 1, 2009

yes! this sucks! xml, shitml, blablaml... what the??

Comment by des...@hrimsolutions.com, Jun 11, 2009

hi guys i am new bie to your payment system, and i found this may be worse compare to i have done in past. can you guys suggest the Simple solution or sample Full Functional for this.what i want is: use XML API and notification API. i appreciate if you help me before my project ends....thanks

Comment by hokeyspo...@gmail.com, Sep 3, 2009

I agree with all of the frustrated "customers" above. PayPal? is having problems, screws up our orders, etc., so we are looking for an alternative. We were hoping that Google would have it. It doesn't. We processed our first order and there was no charge for shipping, so we have to eat that. Before we offer free shipping, we'll go back to PayPal? or find an easier vendor to work with. I've spent too much time on this already. You have too many "engineers" developing your programs and not enough business folks directing the program. very disappointing!

Comment by i...@arianauniversal.com, Sep 12, 2009

check asp-vbcode.com for paypal ipn solution, it works

Comment by bert...@gmail.com, Sep 16, 2009

@nPet.... your batteries at power101.com are junk

Comment by abu4has...@gmail.com, May 29, 2010

Please at least make a wizard for primary user who really want to integrate their payment system by google.

Comment by ratebeer...@gmail.com, Oct 28, 2010

I'm finding the same kind of dissatisfaction here. I have a site that uses PayPal? and we were able to write, test and deploy a callback for that site in the same day. This Google Cart callback is very difficult to test and observe and whatever is happening remains a (broken) black box to our developers. We've spent over a month off and on trying to get this to work with no success.

I'm hoping Google will fix this.

Comment by account...@velpro.net, Jan 28, 2011

Google Checkout is really bad about not listening to the market. Do you see any responses to this thread? And this is on their own servers. It's no wonder Google Checkout is floundering so badly. To not have an HTML post back to the merchant's server is absolutely ridiculous. You'd think they'd see what PayPal? has been doing, and do the same. Instead, they get cute and write this ludicrously complicated API that only wastes everyone's time.

Maybe this new guy they got from PayPal?, Osama Bedier, will fix things. If Google created an API that was similar to what merchants have been using with PayPal? for years, then I think you'd start seeing a lot more merchants using Google Checkout in their shopping carts. As is, this is just total crap.


Sign in to add a comment
Powered by Google Project Hosting