Skip to main content

Using Google Checkout SDK with Glassfish

Posted by inder on May 21, 2007 at 11:28 PM PDT

Google Checkout Logo Google Checkout is a Google service that enables a faster, safer and more convenient way to shop online. Online merchants can implement Google checkout on their websites, and then they do not need to worry about managing credit-cards information and privacy of user accounts. Besides, Google provides free credit-card processing until the end of 2007 and will later provide credit for adwords expenses in free credit card processing. It is trivial to implement an HTML version of the Google checkout process. However, Google also provides a REST-based XML API that can be used to automate order processing. In this blog, I will discuss how to use the Java SDK for Google Checkout to easily implement the XML API integration with Google checkout in your Web applications. You can then deploy your application on GlassFish or Tomcat to handle REST events.

The Checkout SDK provides a library jar and an XML configuration file that you will need to embed in your Web application. You can then configure your action handlers that will receive notification of various order processing events from Google as a user places an order. Here are the steps that you will need to follow:

  1. Download and install Glassfish.
  2. Download checkout-sdk-0.5.zip or a later version from its download page.
  3. Unzip checkout-sdk-0.5.zip file. This will create a directory named checkout-sdk-0.5.
  4. The top-level index.html has instructions on using the SDK. You can also browse the Javadocs for the classes contained in the SDK at docs/javadocs/index.html
  5. Copy checkout-sdk/checkout-sdk.jar to your WEB-INF/lib
  6. Copy checkout-sdk/web/WEB-INF/checkout-config.xml to your WEB-INF/ directory
  7. Edit your WEB-INF/web.xml and cut-and-paste the contents from checkout-sdk/web/WEB-INF/checkout-fragment-for-web.xml
    1. If you need to add additional handlers to process checkout notifications, edit checkout-config.xml and change default value of the handlers to your classes.
    2. Use Checkout SDK Javadocs to extend notification handlers
  8. Copy over the contents of checkout-sdk/web/checkout to a suitable directory in your application. For example, web/checkout
  9. Your application is now ready to use Google Checkout APIs. Deploy it on glassfish to test the integration
  10. Login to your Google checkout merchant account, click on Settings tab, and then click on Integration on the left menu. register the URL for your notification service in the API callback URL textfield. For example, if glassfish was running your application at http://foo.bar.com:8080/myapp then, the registration URL will be http://foo.bar.com:8080/myapp/notification

That is it! Try it out today, and share your experiences as comments to this blog. We will be try our best to improve the checkout SDK to enable easy implementation by your Web applications. Thanks for reading.

Related Topics >>