News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Solution: Required transaction key is empty error in ps_authorize

Started by ou81aswell, July 29, 2009, 01:40:55 AM

Previous topic - Next topic

ou81aswell

Problem

VM 1.1.3

Confirm Order (final step of checkout) fails with the following error: Error: Failure in Processing the Payment. Technical Note: The required transaction key is empty! The payment method settings must be reviewed. Error: Failure in Processing the Payment (ps_authorize)

Note: The problem described here may actually generate different error messages depending upon how the disabled ps_authorize payment method (see below) is configured.

Cause

If the jos_vm_payment_method table contains more than one row where the column named payment_class is set to "ps_authorize", then the transaction MAY fail because the SQL in ps_authorize.php MIGHT select the wrong payment_method internally.

I am new to Joomla and VM but have been able to get just about everything working.

While making a change to the script called "ps_authorize.php" to make it talk to a different server that is compatible with authorize.net, I kept getting the error above whenever I tried to confirm an order.

Looking at the code I was able to track down this behaviour to an sql statement in the ps_authorize.php script at around line 273.

The problem is in the function called process_payment() at around line 250.

Specificaly the SQL statement at line 273 (my version of VM is 1.1.3), the WHERE statement does not test to see if the payment_enabled column is set to "Y".

In my case, the Where statement that was being executed was:

Select blah blah ... WHERE payment_class='ps_authorize' AND shopper_group_id='5'

I had two records (rows) in the jos_vm_payment_method table where the column named payment_class was set to "ps_authorize".

As expected, the first one was disabled because I disabled it using the control panel. The second one was enabled and was the one I had configured.

The code above found the disabled ps_authorize payment method and not the one I had setup.

The where statement should have  " AND payment_enabled = 'Y' " added to it as in:

WHERE payment_class='ps_authorize' AND shopper_group_id='5' AND payment_enabled = 'Y'


Solution 1 (simplest)

Change the disabled (unwanted) payment method's payment_class to something other than ps_authorize using the control panel.

Solution 2 (code change)

This should probably be addressed in a future release.

Change the following line in ps_authorize.php (line 274 in my case) (note this is a single line and I'm not sure if it will wrap once posted) FROM

$database->query( "SELECT ".VM_DECRYPT_FUNCTION."(payment_passkey,'".ENCODE_KEY."') as passkey FROM #__{vm}_payment_method WHERE payment_class='".$this->classname."' AND shopper_group_id='".$auth['shopper_group_id']."'" );

TO (again the next statement should be one line)

$database->query( "SELECT ".VM_DECRYPT_FUNCTION."(payment_passkey,'".ENCODE_KEY."') as passkey FROM #__{vm}_payment_method WHERE payment_class='".$this->classname."' AND shopper_group_id='".$auth['shopper_group_id']."' AND payment_enabled = 'Y'" );

I hope this helps and sorry if this is old news.



kts

Thanks so much for having posted this. I tried that solution and it still didn't work for me. On the suggestion of another user (http://forum.virtuemart.net/index.php?topic=26090.0;wap2), I took out the code relating to shopper groups in the ps_authorize.php file - since I have only one shopper group (default) - and it worked!

So in summary, change this code (line 269) in your ps_authorize.php file FROM

$database->query( "SELECT ".VM_DECRYPT_FUNCTION."(payment_passkey,'".ENCODE_KEY."') as passkey FROM #__{vm}_payment_method WHERE payment_class='".$this->classname."' AND shopper_group_id='".$auth['shopper_group_id']."'" );

TO

$database->query( "SELECT ".VM_DECRYPT_FUNCTION."(payment_passkey,'".ENCODE_KEY."') as passkey FROM #__{vm}_payment_method WHERE payment_class='".$this->classname."'" );

Not sure if it made a difference but right before I changed this code, I had refreshed my Authorize.net transaction key.

Virtuemart 1.1.3
Joomla 1.5.14

haggis

Hi ou81aswell.

please help me out. I am a newbee too.

I've still a clean installation. I tried to configure the authorize.net module. When it comes to enter the transaction key, it fails. No key has ever been accepted, neither did I receive an error message or other notices. Therefore I can't save the configuration.

Is it the same problem? How do I fix it? Any advice?

Thanks in advance
Haggis


nl94568

I was having this same problem just a couple of minutes ago and all I needed to do was add in my Joomla user password first - it then took me to a screen to enter in the code, where i had to enter in my Joomla password one more time to activate the key.

I hope this helps you out if you happen to be having the same situation I was having.

haggis

Yep. Thanks all for your help. Mainly it was the problem discribt above BUT also my personal problem. In one of the documents it was mentioned, but it was a small note and toooooo long ago. I honestly forget about it.

Anyway. Thanks all.

Haggis

ajayb

Quote from: ou81aswell on July 29, 2009, 01:40:55 AM
Problem

VM 1.1.3
administrator\components\com_virtuemart\classes\payment\ps_authorize.php

$database->query( "SELECT ".VM_DECRYPT_FUNCTION."(payment_passkey,'".ENCODE_KEY."') as passkey FROM #__{vm}_payment_method WHERE payment_class='".$this->classname."' AND shopper_group_id='".$auth['shopper_group_id']."'" );

replace with

$database->query( "SELECT ".VM_DECRYPT_FUNCTION."(payment_passkey,'".ENCODE_KEY."') as passkey FROM #__{vm}_payment_method WHERE payment_class='".$this->classname."' AND shopper_group_id='".$auth['shopper_group_id']."' AND payment_enabled = 'Y'" );

in this case solved successfully problem - Error: Failure in Processing the Payment. Technical Note: The required transaction key is empty! The payment method settings must be reviewed. Error: Failure in Processing the Payment (ps_authorize)

But Next problem
I follow this solutions but next Sorry, but the Credit Card Number you've used is a testing number! in this case i set without test mod and with test mode .
I use Credit Card Number: 4111111111111111  on authorized method
help me thanks to advance.

   



stAn99

Problem: Passkey does not want to save when having a single apostrophie in the passkey.

Virtuemart: 1.1.7 (and most probably all earlier 1.1.x)

Solution:
edit \administrator\components\com_virtuemart\html\store.payment_method_keychange.php
line 63 for VM 1.1.7

change this:

$q = "UPDATE #__{vm}_payment_method ";
$q .= "SET payment_passkey = ".VM_ENCRYPT_FUNCTION."('$passkey','" . ENCODE_KEY . "')\n";
$q .= "WHERE payment_method_id='$payment_method_id';";
$db->query( $q );


to this (note $db->getEscaped(..):

$q = "UPDATE #__{vm}_payment_method ";
$q .= "SET payment_passkey = ".VM_ENCRYPT_FUNCTION."('".$db->getEscaped($passkey)."','" . ENCODE_KEY . "')\n";
$q .= "WHERE payment_method_id='$payment_method_id';";
$db->query( $q );
----
RuposTel.com
www.rupostel.com
Your customized checkout solution for Virtuemart