1

i have a problem with 2checkout gateway. I get "Invalid key" error. What is causing that? I entered correctly the Account number and secret word in settings. Test mode is "false" in Store settings. Demo setting is "On" in 2co settings page.

No matter witch setting i try:

enter image description here

i get Invalid key error.

I have EE 2.7.1, Store 2.0.6, PHP 5.3.27

Thanks

1
  • Can you email support@exp-resso.com about this? We will most likely need to access your server to diagnose this issue. – Adrian Macneil Dec 7 '13 at 0:26
2

This issue is most likely being caused by either your secret word not matching or expresso store is not setup to validate the hash on demo sales. When placing 2Checkout demo sales, the MD5 hash returned by 2Checkout is intentionally broken by computing the hash with a 1 in place of the order_number so if you are checking against the hash your return script needs to handle this change.

Example:

<?php

if ($_REQUEST['demo'] == 'Y') 
{
    $order_number = 1;
}
else
{
    $order_number = $_REQUEST['order_number'];
}

$compare_string = $_REQUEST['secret_word'] . $_REQUEST['sid'] . $order_number . $_REQUEST['total'];
$compare_hash1 = strtoupper(md5($compare_string));
$compare_hash2 = $_REQUEST['key'];

if ($compare_hash1 != $compare_hash2)
{
    echo "Hash Mismatch";
}
else
{
    echo "Hash Matched";
}
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.