Blue Theme Orange Theme Green Theme Red Theme
 
Discover the top 5 tips for understanding .NET Interop
Home | Forums | Videos | Advertise | Certifications | Downloads | Blogs | Interviews | Jobs | Beginners | Training
 | Consulting  
Submit an Article Submit a Blog 
 Jump to
Skip Navigation Links
TechnologyExpand Technology
WebsiteExpand Website
Nevron Chart
Search :       Advanced Search »
Home » ASP.NET Controls » Google Checkout Custom Control

Google Checkout Custom Control

A custom control that easily integrates your website with Google Checkout.

Page Views : 29598
Downloads : 675
Rating :
 Rate it
Level : Beginner
   Print Read/Post comments Post a comment  Similar Articles  
   Email to a friend  Bookmark  Author's other articles  
Download Files:
Google.zip
 
 
Team Foundation Server Hosting
Become a Sponsor
Nevron Chart
Become a Sponsor
 Tag Cloud
 Latest Jobs
More ... 
 Latest Interview Questions
More ... 

Google recently introduce Google Checkout.  "Google Checkout is a checkout process that you integrate with your website, enabling your customers to buy from you quickly and securely, using a single username and password. Once they do, you can use Google Checkout to charge their credit cards, process their orders, and receive payment in your bank account."

 

They currently have no ASP.NET examples posted on their site so I have created an ASP.NET 2.0 Custom Web Control that will allow you to easily integrated with their service by simply dropping a control on the page a specifying a few parameters.  So here it is...

 

Step 1: Modify the Web.Config file

Add the following entry to the web.config file.  This will allow you to use the control on any page with out having to add the control directive to each page.  Also, don't for get to add the dll to the bin directory of your website.

 

<system.web>

    <pages maintainScrollPositionOnPostBack="true">

          <controls>

            <add tagPrefix="Google" namespace="Google.Web.UI.WebControls"

 assembly="Google.Web"/>

          </controls>

    </pages>

 

Step 2: Add the control to the page.

This is pretty simple, but just make sure you add it outside to the form tags on the page.  Specify your MerchantId and MerchantKey that you received for Google and tell the control if it should use the sandbox (test) or the production service.  You will need to register for both through Google.

 

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

    <title>Untitled Page</title>

</head>

<body>

    <form id="form1" runat="server">

    <div>

       Place info here...

    </div>

    </form>

    <Google:CheckoutButton MerchantId="101156456465"    
           
MerchantKey="234lk4j53452lkj34" UseSandBox="true"
           
runat="server" ID="btnGoogleCheckout"/>

</body>

</html>

 

Step 3: Set the Shopping Cart XML Property

 

In the code behind for the page set the ShoppingCartXml property.  For testing purpose I simply Desearlized there sample xml in to a ShoppingCart object.  Here is a great article on how to do that.

http://www.netomatix.com/Products/Ecomm/GoogleCheckOut.aspx

 

protected void Page_Load(object sender, EventArgs e)

{

    btnGoogleCheckout.CartXml = GetCartXML();

}

 

private string GetCartXML()

{

    string xmlFile = "checkout-shopping-cart-SIMPLE.xml";

 

    XmlDocument xml = new XmlDocument();

    xml.Load(Server.MapPath(xmlFile));

 

    return xml.InnerXml;

}

 

You are all set.  Just click the button and you will see the shopping cart appear on the Google site.  Let me know if you have any questions or problems with the control.

 

For more information visit the following link to the developers guide.

 

http://code.google.com/apis/checkout/developer/index.html 

Comment Request!
Thank you for reading this post. Please post your feedback, question, or comments about this post Here.
Login to add your contents and source code to this article
 [Top] Rate this article
 
 About the author
 
Justin Finch
Looking for C# Consulting?
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional consulting company, our consultants are well-known experts in .NET and many of them are MVPs, authors, and trainers. We specialize in Microsoft .NET development and utilize Agile Development and Extreme Programming practices to provide fast pace quick turnaround results. Our software development model is a mix of Agile Development, traditional SDLC, and Waterfall models.
Click here to learn more about C# Consulting.
 
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
Discover the Top 5 .NET Memory Management Fundamentals
To write the best .NET code, you need to know exactly how the .NET framework really manages memory. Ricky Leeks presents the Top 5 fundamental facts of .NET memory management. Learn more.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites – Click Here!
 
 Post a Feedback, Comment, or Question about this article
Subject:
Comment:
DevExpress Free UI Controls
Become a Sponsor
 Comments
Great Article by Mike On May 3, 2007
Thanks Justin, We need more articles on the site like this one. Good Work!
Reply | Email | Modify 
order page is not opening by Rahul On June 21, 2007
hi, i was using this code but on click on google check out button its opening google.com (default page of google)...?
Reply | Email | Modify 
order page is not opening by Rahul On June 21, 2007
hi, i was using this code but on click on google check out button its opening google.com (default page of google)...?
Reply | Email | Modify 
Re: order page is not opening by Fahad On February 8, 2008

Url have changed for google checkout. After changing those , control works great.

Thanks,
Fahad

Reply | Email | Modify 
Re: Re: order page is not opening by taha On April 8, 2009
please provide the new link and where to replace this url
Reply | Email | Modify 
Re: Re: Re: order page is not opening by Fahad On April 9, 2009
Reply | Email | Modify 
How to handle response by WAQAR On May 20, 2009
First of all thanx for this effort. i m wondering if can explain how to handle the response, that would be sent by google check out

Thanx
Reply | Email | Modify 
How to handle response by WAQAR On May 20, 2009
First of all thanx for this effort. i m wondering if can explain how to handle the response, that would be sent by google check out

Thanx
Reply | Email | Modify 

 © 2012  contents copyright of their authors. Rest everything copyright Mindcracker. All rights reserved.