Monday, November 3, 2008

Google checkout Fast Track

I am currently working on an e-commerce website, as shopping cart is one of the most important part of such websites. There are different options available for receiving and processiong orders one them is service provided by google as "Google Checkout"

A quick Start

As most of the services there is a special development environment for the developers known as "Sandbox" u can rfere for a Proper introduction.

let me summarize things in steps:
  1. Create sandbox merchant Account(the seller) : http://sandbox.google.com/checkout/sell/.
  2. Create sandbox Buyer Account:http://sandbox.google.com/checkout
* for account credentials there are some restrictions same account can't be used , separate buyer and seller accounts are required, for details like sandbox credit card numbers etc visit.

Once The Accounts are set its time to move ahead:

  • log in to your Sandbox Merchant Account here .
  • get your sandbox merchant Id and key
SettingsTab-->Integration-->

Google merchant ID: xxxxxxxxxxxxxxxxxx
Google merchant key: xxxxxxxxxxxxxxxxxx
these are the basic requirement .

Basic Html Test:

  • To do this get the html code and save a new html file here .
replace:
https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/1234567890
by
https://sandbox.google.com/checkout/cws/v2/Merchant/[[Merchant-ID]]/checkoutform

and
http://checkout.google.com/buttons/checkout.gif?merchant_id=123456789
by
http://sandbox.google.com/checkout/buttons/checkout.gif?merchant_id=[[Merchant-ID]]

Then just click the button in the html file , it should take you to the Sanndbox checkout,

where you should login with your "Sandbox Buyer Account" . you have purchased a peanut butter.

If this test is successful now is the time to move onward.

Integrating The Google Checkout Using Xml Api on .Net Platform.

To do this quickly you need to find some library files i mean(DLLs) so you can make your life easier that what developers try to do, as i did i am thankful to the author of this libraray.

i want to thank All :
martin.omander, chanezon, joseph.feser, moman...@google.com

as this helped me alot this can be accessed at
http://code.google.com/p/google-checkout-dotnet-sample-code/

you can download GCheckout ,

it is very much useful to review the documentation before using this here

you will have to do some configuration and set the environment, then by referencing

the library create request and post you cart items via google checkout.

i hope this post may help you for quick start.





Sunday, July 13, 2008

HTTP Handlers in .Net

Introduction :
In simple words what i understand is that as the name suggests "they are meant to process the http Request by the client and generate the response. "

They are uesd by ASP.Net to handle requests for the .aspx pages.

Why and Where to use:

use of HTTP Handler(your custom) can be a alternative and better approach than .aspx page
depending on the scenario
for example :
application to application Interaction ( data posted by using XML Http from one form to other and receiving response)

Dim requestXML As New StringBuilder()
Dim oXMLHttp As New XMLHTTP

requestXML.Append("")
requestXML.Append("Rate")
requestXML.Append("Shop")

Dim Domain As String = HttpContext.Current.Request.ServerVariables("Server_Name") + ":" + HttpContext.Current.Request.ServerVariables("Server_Port")

oXMLHttp.open("POST", "http://" + Domain + "/httphandling/Default.aspx", False)
oXMLHttp.setRequestHeader("Content-Length", (requestXML.ToString.Length))
oXMLHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
oXMLHttp.send(requestXML.ToString)
Dim response As String = oXMLHttp.responseText

In the above code a xml string is sent to the "Default.aspx" where it is processed and Response is sent back.
So, what is the role of Default.aspx more specifically no visual content.

this is the case where there is Over head of Processing of the .Aspx page life cycle

So, Http Handler Can be used to overcome this Issue.


How to use:

There are Two Approaches Available to my knowledge.

The one require more effort the other bit easier.

First Approach :

Implementing The System.Web.IHttpHandler Details

I personally Found The Following Article Very Helpful Thanks to the author
Implementing HttpHandelers

Now Let us come The :

Second Approach:

Using The .ashx "web Handler" the template is available in Visual studio.Net
you donot require registring the file extension in web.Config

for details : visit

Now using This approach:

on The page sending Request:


Dim requestXML As New StringBuilder()
Dim oXMLHttp As New XMLHTTP
requestXML.Append("")
requestXML.Append("Rate")
requestXML.Append("Shop")

Dim Domain As String = HttpContext.Current.Request.ServerVariables("Server_Name") + ":" + HttpContext.Current.Request.ServerVariables("Server_Port")

oXMLHttp.open("POST", "http://" + Domain + "/httphandling/Handler.ashx", False)
oXMLHttp.setRequestHeader("Content-Length", (requestXML.ToString.Length))
oXMLHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
oXMLHttp.send(requestXML.ToString)
Dim response As String = oXMLHttp.responseText


On The Handler.ashx


<%@ WebHandler Language="C#" Class="Handler" %>

using System;
using System.Web;
using System.IO;


public class Handler : IHttpHandler {

public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/html";
StreamReader rd = new StreamReader(context.Request.InputStream);

string str=rd.ReadToEnd();
//processing of the request string
context.Response.Write("Yes, I received you request");

}

public bool IsReusable {
get {
return false;
}
}

}


I hope this might be helpful to the readers

Monday, June 23, 2008

XML Serialization

In simple words Serialization is the process of saving the state of a object of any Type into to a physical medium or stream.
using this process any object can be saved as :
-Binary file
-soap object
-xml file or xml stream

XML Serialization:

for the beginners who have less knowledge about the xml are advised to
visit one of the most beneficial resources xml tutorials

for details about the core concepts visit:Serialization Articles

to more elaborate the purpose of this post consider a scenario:

for example you want to create an application with facility of shipping rate calculation,
for this purpose you may use UPS online tools or USPS rate API.

for both of the ways you will have to create the Request in specified format
where information is to be represented in XML .

at this point xml serialization can help minimizing the effort required

for the practical Implementation this is a very good article
Xml serialization

Friday, June 13, 2008

Getting started with ebay developer Program

This is my first post , so please your positive comments will be encouraging for me.
ebay.com is the most known website for buying and selling, they also offer the integration
of other application for listing products to sell on the ebay .

They have also provided good resources for the developers,as startup i will recemond to visit this link:
Ebay Development starter kit
download the kit and make the sample application using the template.

please donot forget to read the Docs/eBaySellingStarterKitDocumentation
in the visual studio project.

then get your self registered at the Ebay developer program
once you get registered generate the keyset:
eBayAppID
eBayCertID
ebayAuthToken

these are required for starting developing test application
till this step there is no hurdle .

Getting The Auth Token
there are some prerequisites for that
if you donot follow you can ran into situation like this

please do register before at SandBox test user Registration
before you proceed because you need an ebay id to generate the auth token.
there you can put the it and get the auth token
and get your sample project work.

i also found a very good article which helps alot : Writing ebay Application


i hope this post will be helpful for the people want start doing their work with developing ebay application.