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
- 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
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!
this is a joke! why make things hard for people?
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???
I am also finding that PayPal? integration and IPN setup is a lot easier than figuring out Google checkout.
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.
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.
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.
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.
PayPal? is a piece of cake! You're making it too time consuming for doing a simple stuff. Wessam Raafat
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!!!!!
yes! this sucks! xml, shitml, blablaml... what the??
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
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!
check asp-vbcode.com for paypal ipn solution, it works
@nPet.... your batteries at power101.com are junk
Please at least make a wizard for primary user who really want to integrate their payment system by google.
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.
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.