On Saturday 25 August 2007 18:18, David H Dennis wrote:
> I have a business that I'm working with that buys its
products through
> a distributor. The distributor has an XML API for
sending orders.
>
> Usually this means Level 2 integration. But I don't
have a secure
> server and would rather not set one up. In addition, I
really don't
> want to handle credit card numbers, which I believe you
need to do for
> Level 2 integration to happen.
For level 2 you will need SSL certificate and Basic HTTP
Authentication, but
you will *not* need to handle the CC numbers, google does
that for you.
The callback script (protected by the above) does not need
to be on the same
server or domain that sent the cart.
>
> What I would like, however, is the ability to
automatically suck down
> the order by logging in to the Google system as though
I was a browser
> and then parsing the resulting order page, grabbing
each individual
> order and adding it to my system. All of this is well
within my
> capabilities as a programmer, with the exception of the
login.
Using level 2 you will receive XML containing all the info
you need, plus
whatever information you have added to the cart as
merchant-private-data and
merchant-private-item-data. You can also interact with the
google server for
doing things like calculating shipping on the basis of the
address supplied
to google by the buyer.
>
> I try to log in to Google Checkout's sandbox and the
sandbox login
> returns a redirect to google.com no matter what I do.
My code (in
> Ruby) has been added to the end of this message.
>
> Is there any established way to do this sort of thing?
I would like
> to do it for adsense reports as well so I could
automate their parsing
> and translation into my own format.
>
> Many thanks for any help!
I'm not a ruby user, but I can get the gist of the code
below and it won't
work I'm sure :-(
>
> D
>
> -- Code --
>
> def login
> # get_session_id works successfully to get the
session ID from
> Google.
> session_id = get_session_id
>
> print "Session: #n"
>
> email = "david amazing.com"
> password = '*******'
>
> data = "gsessionid=#&"
> data +=
"service=sierrasandbox&nui=1<mp1=default&
h1=sv&"
> data += "Email=#&Passwd=#"
> data += "&rmShown=1"
>
> site = Net::HTTP.new("sandbox.google.com",
443)
> site.use_ssl = true
>
> resp, data = site.get("/checkout", nil)
> cookie = resp.response['set-cookie']
>
> print "Cookie #{ cookie.inspect }n"
>
> headers = {
> 'Cookie' => cookie,
> 'Referer' => "https:/
/www.google.com/accounts/ServiceLogin?
>
service=sierrasandbox&continue=https%3A%2F%2Fsandbox.goo
gle.com
>
%2Fcheckout%2F%3Fupgrade%3Dtrue&hl=sv&nui=1<mp
l=default",
> 'Content-Type' =>
'application/x-www-form-urlencoded'
> }
>
> resp, data = site.post("ServiceLoginAuth",
data, headers)
>
> puts "Code #{ resp.code }nMessage #{
resp.message } location
> #{ resp['location'] }ncookie #{ resp['cookie']
}n"
> print data
> end
>
>
>
--
--------------------------------------------------
Bob Hutchinson
Arwystli Networks
Linux specialists
Server administration
Programming
Web Hosting
Mail Hosting
web: http://midwales.com
email: hutch arwystli.net
skype: bobhutch
--------------------------------------------------
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "API Integration Basics" group.
To post to this group, send email to
google-checkout-api-integration googlegroups.com
To unsubscribe from this group, send email to
google-checkout-api-integration-unsubscribe googlegroups.com
For more options, visit this group at http://groups.google.com/group/google-checko
ut-api-integration?hl=en
-~----------~----~----~----~------~----~------~--~---
|