|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Google Checkout Coldfusion MX 6 1
Author: Mary Jo Sminkey
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:47080#248820
>Google checkout it supposed to be really awesome and yet here we
>are getting suggestions to use COM object calls just to encrypt an xml
>shopping cart (which frankly has ZERO top-secret data unless it bothers you
>that some hacker might now you are purchasing a t-shirt that says "hooters"
>on it).
LOL, I certainly agree with you there. It does seem overly complicated.
>Frankly, I am not yet seeing the benefits of Google checkout over other
>implementations. Right now, the only thing going for it (in my VERY LIMITED
>experience) is the name GOOGLE.
Well, there are a few other benefits, particularly for merchants that pay for
Google AdWords. They get discounts on the cost of the service according to how
much they pay for AdWords. I can see the benefit for the customer as well,
similar to the use of PayPal. I know from experience that a lot of smaller stores
do not properly protect credit card data, and there's really no way to tell that
as a customer. Making payments through a service like Google is certainly
beneficial in that customers can feel more confident that their data is being
properly protected. Not that it is ever 100% safe, but there's certainly a higher
level of trust there. Does Google provide such benefits over PayPal? Well, the
main benefit is being able to label sites as supporting Google Checkout right on
the Google search.
--------------------
Mary Jo Sminkey
http://www.cfwebstore.com
CFWebstore, ColdFusion
E-commerce
Author: Ben Nadel
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:47080#248793
I think we should take a minute to step back and see how overly complicated
this is. Google checkout it supposed to be really awesome and yet here we
are getting suggestions to use COM object calls just to encrypt an xml
shopping cart (which frankly has ZERO top-secret data unless it bothers you
that some hacker might now you are purchasing a t-shirt that says "hooters"
on it).
Frankly, I am not yet seeing the benefits of Google checkout over other
implementations. Right now, the only thing going for it (in my VERY LIMITED
experience) is the name GOOGLE.
My 2 cents.
......................
Ben Nadel
www.bennadel.com
> If you still need it, try one of these three suggestions.
Thanks for all the information, I'll give it a good look over and see if any
of these could work out for me. I'm sure others will find it useful too that
don't have CF7 yet. The main problem I have though is trying to come up with
something that will work for all my customers, not just some (at least,
those that want to use Google). And unfortunately there are still plenty of
hosts out there that disable CFOBJECT and CreateObject(). And of course, I
do need to support Unix folks too. ;-)
--------------------
Mary Jo Sminkey
http://www.cfwebstore.com
CFWebstore, ColdFusion E-commerce
Author: Mary Jo Sminkey
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:47080#248773
> If you still need it, try one of these three suggestions.
Thanks for all the information, I'll give it a good look over and see if any of
these could work out for me. I'm sure others will find it useful too that don't
have CF7 yet. The main problem I have though is trying to come up with something
that will work for all my customers, not just some (at least, those that want to
use Google). And unfortunately there are still plenty of hosts out there that
disable CFOBJECT and CreateObject(). And of course, I do need to support Unix
folks too. ;-)
--------------------
Mary Jo Sminkey
http://www.cfwebstore.com
CFWebstore, ColdFusion E-commerce
Author: Scott Pinkston
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:47080#248770
If you still need it, try one of these three suggestions.
The com object call is from Ryan Hickman.
I believe hex2bin function is from Roland Collins. If it is someone else, I
apologize.
Option 1 - GoogleCheckoutCFC
I updated the cfc so it *should* work with 6 now.
http://scott.pinkston.googlepages.com/home
Option 2 - COM Object:
Install the GCryptInstaller.MSI from the ASP sample code - http://code.google.com/apis/checkout/samplecode.html
<!--- Initiate the encryption object (make sure GCryptInstaller.MSI steps have
been followed first) --->
<cfobject type = "com"
action = "create"
class = "GCrypt.g_crypt.2"
name = "cryptobj">
<!--- HMACSHA1(input cart XML data as String, secret key as String)
- outputs base64 encoded binary string --->
<cfset b64signature =
cryptobj.generateSignature(GoogleCartXML,GoogleMerchantKey)>
Option 3:
You will need cf_hmac from:
http://devex.macromedia.com/developer/gallery/info.cfm?ID=B60D8F14-FC9F-11D6-840F00508B94F85A&method=Full
Add this function to your code:
<cffunction name="Hex2Bin" returntype="any" hint="Converts a Hex string to
binary">
<cfargument name="inputString" type="string" required="true"
hint="The hexadecimal string to be written.">
<cfset var outStream = CreateObject("java",
"java.io.ByteArrayOutputStream").init()>
<cfset var inputLength = Len(arguments.inputString)>
<cfset var outputString = "">
<cfset var i = 0>
<cfset var ch = "">
<cfif inputLength mod 2 neq 0>
<cfset arguments.inputString = "0" & inputString>
</cfif>
<cfloop from="1" to="#inputLength#" index="i" step="2">
<cfset ch = Mid(inputString, i, 2)>
<cfset outStream.write(javacast("int", InputBaseN(ch, 16)))>
</cfloop>
<cfset outStream.flush()>
<cfset outStream.close()>
<cfreturn outStream.toByteArray()>
</cffunction>
Call like this:
<!--- add your merchant key and your cart data --->
<cf_hmac key="--YOURMERCHANTKEY--" data="--YOURCARTXML--"
hash_function="sha1">
<cfset b64signature = tobase64(hex2bin(digest))
<form action="https://sandbox.google.com/cws/v2/Merchant/--YOURMERCHANTID--/checkout"
method="post">
<input type="hidden" name="cart" value="#toBase64(--YOURCARTXML--)#">
<input type="hidden" name="signature" value="#b64signature#">
<input type="image" name="Google Checkout" alt="Fast checkout through
Google" src="http://checkout.google.com/buttons/checkout.gif?merchant_id=--YOURMERCHANTID--&w=180&h=46&style=white&variant=text&loc=en_US"
height="46" width="180">
</form>
hope it
helps
Author: Scott Pinkston
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:47080#248769
If you still need it, try one of these three suggestions.
The com object call is from Ryan Hickman.
I believe hex2bin function is from Roland Collins. If it is someone else, I
apologize.
Option 1 - GoogleCheckoutCFC
I updated the cfc so it *should* work with 6 now.
http://scott.pinkston.googlepages.com/home
Option 2 - COM Object:
Install the GCryptInstaller.MSI from the ASP sample code - http://code.google.com/apis/checkout/samplecode.html
<!--- Initiate the encryption object (make sure GCryptInstaller.MSI steps have
been followed first) --->
<cfobject type = "com"
action = "create"
class = "GCrypt.g_crypt.2"
name = "cryptobj">
<!--- HMACSHA1(input cart XML data as String, secret key as String)
- outputs base64 encoded binary string --->
<cfset b64signature =
cryptobj.generateSignature(GoogleCartXML,GoogleMerchantKey)>
Option 3:
You will need cf_hmac from:
http://devex.macromedia.com/developer/gallery/info.cfm?ID=B60D8F14-FC9F-11D6-840F00508B94F85A&method=Full
Add this function to your code:
<cffunction name="Hex2Bin" returntype="any" hint="Converts a Hex string to
binary">
<cfargument name="inputString" type="string" required="true"
hint="The hexadecimal string to be written.">
<cfset var outStream = CreateObject("java",
"java.io.ByteArrayOutputStream").init()>
<cfset var inputLength = Len(arguments.inputString)>
<cfset var outputString = "">
<cfset var i = 0>
<cfset var ch = "">
<cfif inputLength mod 2 neq 0>
<cfset arguments.inputString = "0" & inputString>
</cfif>
<cfloop from="1" to="#inputLength#" index="i" step="2">
<cfset ch = Mid(inputString, i, 2)>
<cfset outStream.write(javacast("int", InputBaseN(ch, 16)))>
</cfloop>
<cfset outStream.flush()>
<cfset outStream.close()>
<cfreturn outStream.toByteArray()>
</cffunction>
Call like this:
<!--- add your merchant key and your cart data --->
<cf_hmac key="--YOURMERCHANTKEY--" data="--YOURCARTXML--"
hash_function="sha1">
<cfset b64signature = tobase64(hex2bin(digest))
<form action="https://sandbox.google.com/cws/v2/Merchant/--YOURMERCHANTID--/checkout"
method="post">
<input type="hidden" name="cart" value="#toBase64(--YOURCARTXML--)#">
<input type="hidden" name="signature" value="#b64signature#">
<input type="image" name="Google Checkout" alt="Fast checkout through
Google" src="http://checkout.google.com/buttons/checkout.gif?merchant_id=--YOURMERCHANTID--&w=180&h=46&style=white&variant=text&loc=en_US"
height="46" width="180">
</form>
hope it
helps
Author: Ben Nadel
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:47080#248731
They were talking about it at the NY ColdFusion Users Group with Michael
Dinowitz. I am not sure if he mentioned it or if it was maybe Tobe
Goldfinger over at JDT Technologies. She does a ton of ecommerce stuff...
Try contacting them see if they know. Contact Form:
http://jdttech.com/contact.html
I also could be way off base as well :)
......................
Ben Nadel
www.bennadel.com
>I think now, though, they have a non-encrypted option which would be cool.
That would be great...where did you see that information though?
--------------------
Mary Jo Sminkey
http://www.cfwebstore.com
CFWebstore, ColdFusion E-commerce
Author: Mary Jo Sminkey
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:47080#248730
>I think now, though, they have a non-encrypted option which would be cool.
That would be great...where did you see that information though?
--------------------
Mary Jo Sminkey
http://www.cfwebstore.com
CFWebstore, ColdFusion E-commerce
Author: Ben Nadel
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:47080#248716
I remember I had tried it a while back and got stumped on the Hashing of the
cart XML. You can't do a straight up HASH call in CF since the only hash
they provide doesn't take a Key (that I could find). You have to do the
Hashing algorithm on your own. I found ASP and PHP versions, but could not
understand how it was done.
I think now, though, they have a non-encrypted option which would be cool.
......................
Ben Nadel
Web Developer
Nylon Technology
350 7th Avenue
Floor 10
New York, NY 10001
212.691.1134 x 14
212.691.3477 fax
www.nylontechnology.com
"Some people call me the space cowboy. Some people call me the gangster of
love."
>The readme says it needs 7 but for prior versions to replace calls to
>binaryDecode() - I have not personally integrated this for 7 or 6.1, I
>am just aware of it...so I can't be much help beyond that.
Google Checkout has requirements for encoding that definitely work best with
CF7. You'd need to find a 3rd party replacement of some kind to get it to
work on 6.1. And I thought PayPal was a pain to integrate! Google is
definitely one of the more complicated checkout processes I've ever seen,
but the posted code does a lot of the harder stuff for you.
I'd certainly love to hear if anyone can get it to work with CF 6.1. I'd
consider including it in my next CFW version, but I don't like requiring
such a recent CF release. It always gets confusing for customers when some
features require a different version than the base code does. Of course,
customers are easily confused. ;-)
--------------------
Mary Jo Sminkey
http://www.cfwebstore.com
CFWebstore, ColdFusion E-commerce
Author: Mary Jo Sminkey
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:47080#248691
>The readme says it needs 7 but for prior versions to replace calls to
>binaryDecode() - I have not personally integrated this for 7 or 6.1, I am
>just aware of it...so I can't be much help beyond that.
Google Checkout has requirements for encoding that definitely work best with CF7.
You'd need to find a 3rd party replacement of some kind to get it to work on 6.1.
And I thought PayPal was a pain to integrate! Google is definitely one of the
more complicated checkout processes I've ever seen, but the posted code does a
lot of the harder stuff for you.
I'd certainly love to hear if anyone can get it to work with CF 6.1. I'd consider
including it in my next CFW version, but I don't like requiring such a recent CF
release. It always gets confusing for customers when some features require a
different version than the base code does. Of course, customers are easily
confused. ;-)
--------------------
Mary Jo Sminkey
http://www.cfwebstore.com
CFWebstore, ColdFusion
E-commerce
Author: Brian Rinaldi
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:47080#248625
Have you seen this project yet? http://code.google.com/p/checkoutcfc/
The readme says it needs 7 but for prior versions to replace calls to
binaryDecode() - I have not personally integrated this for 7 or 6.1, I am
just aware of it...so I can't be much help beyond that.
--
Brian Rinaldi
blog - http://www.remotesynthesis.com/blog
CF Open Source List - http://www.remotesynthesis.com/cfopensourcelist
Boston CFUG - http://www.bostoncfug.org
Author: Chris Musial
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:47080#248614
Has anyone successfully integrated google checkout with Coldfusion 6.1?
|
May 24, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||