Checkout / Google Checkout Error

edwardtn

Joined: 2008-09-27
Posts: 21
Posted: Wed, 2008-10-01 00:17

Have checkout, and the paypal module working. I have the SSL setup for the return back from Google, but it does not seem to get that far. This error is displayed upon pressing the Google Checkout button. Any help is greatly appreciated!


The action you attempted is not permitted.

Back to the Gallery
Error Detail -
Error (ERROR_BAD_PARAMETER) : C:\Sites\Single3\photosbyjojo\webroot\gallery\modules/checkout/ConfirmPhotos.inc

* in C:\Sites\Single3\photosbyjojo\webroot\gallery\modules\core\classes\GalleryView.class at line 182 (GalleryCoreApi::error)
* in C:\Sites\Single3\photosbyjojo\webroot\gallery\main.php at line 324 (GalleryView::loadView)
* in C:\Sites\Single3\photosbyjojo\webroot\gallery\main.php at line 103
* in C:\Sites\Single3\photosbyjojo\webroot\gallery\main.php at line 88

System Information
Gallery version 2.3-RC1
PHP version 5.2.5 cgi-fcgi
Webserver Microsoft-IIS/6.0
Database mysqli 5.0.51b-community-nt-log
Toolkits Thumbnail, Gd
Operating system Windows NT SINGLE3 5.2 build 3790
Browser Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2008-10-01 01:28

You're using an old version of checkout. Please update your installation to checkout 0.4.0.

 
edwardtn

Joined: 2008-09-27
Posts: 21
Posted: Wed, 2008-10-01 17:40

The version displayed on my plugins page is 0.4.0. I had thought that something may be awry with this. The /modules/checkout/ folder does not contain ConfirmPhotos.inc. (only Confirm.inc). Is there a way to get the checkout module and install the include files and templates manually?

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2008-10-01 17:50

LOL! it's actually a typo in checkoutgoogle, my bad, sorry.

I'll get the revised code into the repository later today, I hope.

Thanks for pointing out the problem.

 
edwardtn

Joined: 2008-09-27
Posts: 21
Posted: Wed, 2008-10-01 20:06

Appreciate it. I do not know enough PHP to fix it myself.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2008-10-01 20:30

A fix is uploaded - it should be downloadable from the 'get more plugins' page in three hours. Look for code revision 1643.

You're not out of the woods yet though - you only get the effect of that bug if the google website returns an error, so I shall wait with interest to find out what happens next!

 
edwardtn

Joined: 2008-09-27
Posts: 21
Posted: Thu, 2008-10-02 23:44

It appears you were correct. I now get this message displayed on the Gallery checkout page:

Apologies. There was a problem preventing you from transferring to the Google Checkout service. Please try again, or choose another method of payment.

Must be a problem either with Google or with the transmitted data. I configured the Google settings exactly like the link you posted.

Do you have any idea where I can start looking for the problem?

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Fri, 2008-10-03 08:27

Edward,

if you have checkout administrative notifications enabled you should get an email saying "GoogleCheckout: there was a problem preparing an order when a user tried to use Google Checkout." and going on to list the response from the Google website, which will help identify the error.

 
edwardtn

Joined: 2008-09-27
Posts: 21
Posted: Fri, 2008-10-03 19:54

Awesome, I will check this tonight, thanks for all the great help.

 
edwardtn

Joined: 2008-09-27
Posts: 21
Posted: Fri, 2008-10-03 23:47

Alec,

This is what I receive back from google...

You must use HTTP Basic Authentication for API calls (username=Seller ID, password=Merchant Key)

Not sure what this means, I would think this would be transmitted with the initial transmission.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Sat, 2008-10-04 11:36

Hmmm... interesting, as the basic authentication is indeed automatically coded into the transmission from checkout to Google.

Have you entered your checkout merchantId and Key correctly in the checkoutgoogle config page?

 
edwardtn

Joined: 2008-09-27
Posts: 21
Posted: Sat, 2008-10-04 13:24

Yes, I have double-checked that already. I was thinking along the same lines so My next step will be to contact google support and see why authentication could be failing.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Sat, 2008-10-04 13:37

I would suggest adding a print_r statement in the following file: modules/checkoutgoogle/classes/CheckoutGoogleResponseHelper.inc at line 187 so it reads as follows:

$googleHeaders = array( 'Authorization' => 'Basic '.$authorizationKey, 'Content-Length' => strlen($data) );
/* add this line line here...*/
echo'<pre>';print_r($googleHeaders);echo'</pre>';
list ($returnStatus, $headers, $body) = GalleryCoreApi::requestWebPage($url, 'POST', $googleHeaders, $data); 	

If you post what you see here, obfuscate the authentication data as it reveals your merchantId and Key.

 
edwardtn

Joined: 2008-09-27
Posts: 21
Posted: Sat, 2008-10-04 18:54

This was the result of adding the print_r statement above:

Array
(
[Authorization] => Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=
[Content-Length] => 1522
)

It appears to not contain my merchant id and key...strange, this information is readily visible on the Google Checkout Configuration screen.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Sat, 2008-10-04 19:02
Quote:
It appears to not contain my merchant id and key

It does, just base64 encoded. I've changed your post to minimise the security risk of you posting the data.

So it's curious as to why google isn't recognising the authorisation data in the header. I'll have to think about it, and get back to you, probably in a couple of days time.

 
winkypicker
winkypicker's picture

Joined: 2003-01-21
Posts: 117
Posted: Sun, 2008-10-05 09:16

Hi,

I'm having the exact same problem with my installation.

Any help or update on this situation would be greatly appreciated.

Thanks.

Gallery version = 2.3-rc-2 core 1.2.37
API = Core 7.54, Module 3.9, Theme 2.6, Embed 1.5
PHP version = 5.2.4 apache2handler
Webserver = Apache/2.0.61 (Unix) mod_ssl/2.0.61 OpenSSL/0.9.8b FrontPage/5.0.2.2635 mod_bwlimited/1.4 mod_auth_passthrough/2.1 PHP/5.2.4
Database = mysqlt 4.1.22-standard, lock.system=flock
Toolkits = NetPBM, Gd, jpegtran, Ffmpeg, ImageMagick, Dcraw, SquareThumb
Operating system = Linux ns1.myhosting.com 2.6.18-92.1.13.el5 #1 SMP Thu Sep 4 03:51:01 EDT 2008 i686
Browser = Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3

 
edwardtn

Joined: 2008-09-27
Posts: 21
Posted: Sun, 2008-10-05 19:52

I have an email into Google support to make sure everything is correct on that end. My google settings are exactly like they are supposed to be. I am glad someone else has the same problem (though not wishing problems on anyone!). Good to see someone with Apach has the same problem, so I know it's not an IIS problem.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Sun, 2008-10-05 22:15

I'll look into it further. Bear in mind that checkoutgoogle is only being used by about 4 people on the planet, at the moment, with you at numbers 3 and 4. (I got no response when I asked for volunteers to help test it, so I uploaded the code as-is, for people to try out.) It uses various parts of the Gallery installation that other checkout modules don't, particularly regarding encryption, authentication, ssl access etc, so I'm not surprised it's not a straightforward install at this stage. Please be patient while we learn where the problems are on different installations.

 
edwardtn

Joined: 2008-09-27
Posts: 21
Posted: Mon, 2008-10-06 02:38

I have no problem working through the problems. I'm new to Gallery, but have a separate installation for testing. My production installation is working great with checkout and checkoutpaypal, just looking to ggogle to give customer's another option. Whatever you want to test just let me know, I'm in. Thanks for all your help so far.

 
edwardtn

Joined: 2008-09-27
Posts: 21
Posted: Wed, 2008-10-15 15:17

Alec, have you had any time to look at this issue?

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2008-10-15 16:16

no not yet, sorry. Been too busy actually taking photographs!

 
edwardtn

Joined: 2008-09-27
Posts: 21
Posted: Wed, 2008-10-15 20:11

No problem, I am actually doing well with paypal orders right now as well...but would like to revisit Google Checkout in the future. The whole checkout module has been awesome, no more wasting gas for proofing and ordering!!!

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2008-10-15 21:27

Can you try the test button on the checkoutgoogle config page, and report results please? Does the test pass or fail??

 
winkypicker
winkypicker's picture

Joined: 2003-01-21
Posts: 117
Posted: Wed, 2008-10-15 21:51

When I try the test button I get

Quote:
The test failed. You cannot receive Google Checkout notifications at this url.

It doesn't help that my host has not yet updated the certificate and it has expired, but even prior to this it was giving the same error message.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2008-10-15 22:00
Quote:
but even prior to this it was giving the same error message.

Um, did you not consider this worth mentioning in your initial post....?
To be honest, there's not any point continuing until your site has a valid certificate.

Edwardtn: please report your test-button results.

 
edwardtn

Joined: 2008-09-27
Posts: 21
Posted: Wed, 2008-10-15 22:07

Hmmm, my test is failing now as well. But it was working (the test button at least), prior to the last build you released I believe. I do not think the callback url is anywhere my problem yet...I am not getting near that far. The initial post to Google is failing Basic HTTP Auth.

 
winkypicker
winkypicker's picture

Joined: 2003-01-21
Posts: 117
Posted: Wed, 2008-10-15 22:13

Perhaps I should have mentioned this, however, the PayPal plugin has a similar field which can be left empty. In my mind it is not 100% clear that this is a required field in order to make the plugin work.

 
edwardtn

Joined: 2008-09-27
Posts: 21
Posted: Wed, 2008-10-15 23:06

It is required for Level 2 Integration...which is receiving Order Payment, Shipping, and Completion notices from Google. Theoretically, with just Level 1 Integration you could verify the order completion in the Google Interface and update your order status in Gallery Site Admin. But I very much would like to have Level 2 Integration working.

 
winkypicker
winkypicker's picture

Joined: 2003-01-21
Posts: 117
Posted: Wed, 2008-10-15 23:14

Which is kind of what I thought, but I am not getting either flavour of this.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2008-10-15 23:18

@edwardtn & winkypicker: the test button also tests the http authentication data. If you put your regular gallery url up to and including the main.php part in the box (not HTTPS, just HTTP) then you should be able to get a positive test result, if your website is correctly encoding and decoding your merchant id and key as the authorisation data. Please try this and report the results.

Incidentally, if you don't have http:// access you can "lose" orders in the system - Google can't contact your site to confirm the order, and if the customer doesn't return to your website after payment then the transaction will never ever show up in the orders table for you to be able to update its status. I strongly recommend you *don't* use checkoutgoogle unless and until you can arrange HTTPS access. I'll update the module documentation to make that clear, tomorrow.

 
edwardtn

Joined: 2008-09-27
Posts: 21
Posted: Wed, 2008-10-15 23:59

Okay, I just received this error:

OKPHP Notice: Undefined index: google-order-number in C:\Sites\Single3\photosbyjojo\webroot\gallery\modules\checkoutgoogle\Response.inc on line 60

 
winkypicker
winkypicker's picture

Joined: 2003-01-21
Posts: 117
Posted: Thu, 2008-10-16 08:53

Alec,

I tried what you said and I got

Quote:
The test was succesful. You can receive Google Checkout notifications at this url.
Copy and paste the following line into the Google Checkout Settings -> Integration -> API Callback URL field:

http://www.mysite.co.uk/view-gallery?g2_view=checkoutgoogle.Response

(The URL I input disappears after I hit the test button)
As stated above I then copy and paste the URL into Google Checkout Settings but get

Quote:
An HTTPS URL is required.

Which was expected. Then I thought well this is only needed for Level 2 integration as previously discussed and I try and make a purchase. I click the Google Checkout button and I get:

Quote:
Apologies. There was a problem preventing you from transferring to the Google Checkout service. Please try again, or choose another method of payment.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Thu, 2008-10-16 09:33

@edwardtn:

Quote:
Okay, I just received this error:

OKPHP Notice: Undefined index: google-order-number in C:\Sites\Single3\photosbyjojo\webroot\gallery\modules\checkoutgoogle\Response.inc on line 60

Thanks - that's flagged up a minor issue, which I've fixed, but nothing that's affecting your site. Essentially the test was OK, so your web server appears to be correctly formulating and interpreting the http authorization data. So I'm still not clear why Google isn't accepting it.

@winkypicker:
(The url you use to test stays in the box if you save the page.) If you see that message about a problem transferring you to Google you should also get an email reporting the results from the Google site.

 
winkypicker
winkypicker's picture

Joined: 2003-01-21
Posts: 117
Posted: Thu, 2008-10-16 09:46

Alec,

Yes, I get the problem transferring you to Google message along with an email which says:

Quote:
GoogleCheckout: there was a problem preparing an order when a user tried to use Google Checkout.

Plus a link which gives this result:

Quote:
<?xml version="1.0" encoding="UTF-8" ?>
- <error xmlns="http://checkout.google.com/schema/2" serial-number="d66f2562-5abb-478e-a3ad-05fe163dccba">
<error-message>You must use HTTP Basic Authentication for API calls (username=Seller ID, password=Merchant Key)</error-message>
</error>

 
winkypicker
winkypicker's picture

Joined: 2003-01-21
Posts: 117
Posted: Thu, 2008-10-16 09:47

Oh, and the test URL does stay so long as you hit Save before you hit Test. You're right!

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Thu, 2008-10-16 10:01

@winkypicker: can you please insert a line into your modules/core/classes/helpers/Webhelper_simple.class file at 248 so that it reads like this:

	foreach ($requestHeaders as $key => $value) {
	    $headerLines[] = $key . ': ' . $value;
	}
// new line here:
        echo'<pre>';print_r($headerlines);echo'</pre>';
	$success = $platform->fwrite($handle, sprintf("%s %s HTTP/1.0\r\n%s\r\n\r\n%s",
.
.
.

And report the result when you click on the pay-by-google link. Actually, better send the results to me by private message, as it should contain your merchant/key data (feel free to change a few digits if you like).

 
winkypicker
winkypicker's picture

Joined: 2003-01-21
Posts: 117
Posted: Sat, 2008-10-18 11:21

OK, I inserted the line of code, deleted the template cache and I get the same result as before. I imagine you are trying to get some debug info printed to screen with this line of code. Sorry but no cigar.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Sat, 2008-10-18 11:33

Ok, change it to this:

	foreach ($requestHeaders as $key => $value) {
	    $headerLines[] = $key . ': ' . $value;
	}
// new line here:
        echo'Here is the debugging information that Alec wants to see:<br><pre>';print_r($headerLines);echo'</pre></br>Debugging Info Ends.<br>';
	$success = $platform->fwrite($handle, sprintf("%s %s HTTP/1.0\r\n%s\r\n\r\n%s",
.
.
.

BTW you don't need to bother deleting the template cache.

Edit.. Aargh.. my mistake: headerLines should have a capital L in it.

 
winkypicker
winkypicker's picture

Joined: 2003-01-21
Posts: 117
Posted: Sun, 2008-10-19 08:57

Still no debug output.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Sun, 2008-10-19 09:28

Interesting...

OK, load up modules/checkoutgoogle/classes/CheckoutGoogleResponseHelper.class and add this at line 188:

    	$googleHeaders = array( 'Authorization' => 'Basic '.$authorizationKey, 'Content-Length' => strlen($data) );
        //add this line:
        echo 'About to execute requestWebPage with the following header data:<pre>'; print_r($googleHeaders); echo '</pre>';
	list ($returnStatus, $headers, $body) = GalleryCoreApi::requestWebPage($url, 'POST', $googleHeaders, $data); 
        .
        .
        

And try again!

 
winkypicker
winkypicker's picture

Joined: 2003-01-21
Posts: 117
Posted: Sun, 2008-10-19 15:45

OK, this is what I get

Quote:
About to execute requestWebPage with the following header data:
Array
(
[Authorization] => Basic Og==
[Content-Length] => 1439
)

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Sun, 2008-10-19 21:21

Exactly that? That is, you didn't redact any characters in the [Authorization] field? OK, that's definitely incorrect, so I suspect we're getting somewhere.

Please add this line at 167 to the same file echo "<pre>Merchant Id is: $gcMerchantId, MerchantKey is $gcMerchantKey, and authorizationKey is $authorizationKey</pre>"; so it reads

}
	$authorizationKey = base64_encode($gcMerchantId.':'.$gcMerchantKey);
        echo "<pre>Merchant Id is: $gcMerchantId, MerchantKey is $gcMerchantKey, and authorizationKey is $authorizationKey</pre>";
	switch ($type) {
        .
        .

and report back.

If you get sensible output, please change some of the characters of each field to either random digits, or x's, but please leave the field lengths the same.

 
winkypicker
winkypicker's picture

Joined: 2003-01-21
Posts: 117
Posted: Mon, 2008-10-20 08:22

OK. This time I get this:

Quote:
Merchant Id is: , MerchantKey is , and authorizationKey is Og==
About to execute requestWebPage with the following header data:
Array
(
[Authorization] => Basic Og==
[Content-Length] => 1439

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Mon, 2008-10-20 08:31

Are you in live or test mode? Can you just 100% confirm for me that in the Admin page you've filled in the Merchant Id and Merchant Key boxes that match the mode you're trying to work in (test or live)?

 
winkypicker
winkypicker's picture

Joined: 2003-01-21
Posts: 117
Posted: Mon, 2008-10-20 14:46

I'm in Live mode and the Merchant ID and Merchant Key are definitely filled in and these are the correct set for live transactions.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Mon, 2008-10-20 17:13

It's very peculiar - it looks like that piece of code isn't reading your Id and Key from the db, although why that might be I have no idea. Can you post as an attachment that entire modules/checkoutgoogle/classes/CheckoutGoogleResponseHelper.class file so I can have a look at it please?

Thanks

 
winkypicker
winkypicker's picture

Joined: 2003-01-21
Posts: 117
Posted: Mon, 2008-10-20 21:38

I PM'd you with the file.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Mon, 2008-10-20 22:14

can you put some random characters into the test-mode Merchant Id and Key fields, and save them - then retry, and see what the debugging lines we added to the class file produce on screen?

 
winkypicker
winkypicker's picture

Joined: 2003-01-21
Posts: 117
Posted: Tue, 2008-10-21 18:09

OK, this is what I get when I put random Merchant ID and Key fields in - I have retained the same field length as a real transaction

Quote:
Merchant Id is: 948520039291364, MerchantKey is tX0ZggOy-ChCSaNm0u8WtA, and authorizationKey is OTQ4NTIwMDM5MjkxMzY0OnRYMFpnZ095LUNoQ1NhTm0wdThXdEE=
About to execute requestWebPage with the following header data:
Array
(
[Authorization] => Basic OTQ4NTIwMDM5MjkxMzY0OnRYMFpnZ095LUNoQ1NhTm0wdThXdEE=
[Content-Length] => 1439

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Tue, 2008-10-21 19:10

Ok... now it looks like we're getting somewhere. Apparently your installation thinks it's in test mode, even when you've set it otherwise.

Do you have access to phpMyAdmin to have a look in your database? If so, can you run this query (with table names adjusted, should you need to):

SELECT  `g_parameterValue` 
FROM  `g2_PluginParameterMap` 
WHERE  `g_pluginId` LIKE  'checkoutgoogle'
AND  `g_parameterName` LIKE  'gcMode'

and let me know what the result is?

 
winkypicker
winkypicker's picture

Joined: 2003-01-21
Posts: 117
Posted: Tue, 2008-10-21 22:31

OK. This is the result of the query

Quote:
Host: localhost
Database: my_db
Generation Time: Oct 21, 2008 at 11:26 PM
Generated by: phpMyAdmin 2.11.9.1 / MySQL 4.1.22-standard
SQL query: SELECT `g_parameterValue` FROM `g2_PluginParameterMap` WHERE `g_pluginId` LIKE 'checkoutgoogle' AND `g_parameterName` LIKE 'gcMode' LIMIT 0, 30 ;
Rows: 1

g_parameterValue
test

I'm a complete novice with phpMyAdmin so I hope this is what you are looking for, but my reckoning is that what you said is confirmed and that my install thinks I am in test mode!?!