0

I am facing below error while doing payment by Authorize.net Sandbox Account

"The authenticity of the gateway response could not be verified."

I tried to resolve this by creating new Transaction Key and Signature Key but nothing happened.

While Checkout Order is not placed and gives above error but in Authorize.net they show Unsettled Transaction, check below: ne

Payment log gives success message

    [2019-07-08 10:03:59] main.DEBUG: array (
  'request' => 
  array (
    'payload_type' => 'createTransactionRequest',
    'merchantAuthentication' => 
    array (
      'name' => '8s92nHBP64',
      'transactionKey' => '438Fea4rnT835S33',
    ),
    'transactionRequest' => 
    array (
      'transactionType' => 'authOnlyTransaction',
      'amount' => '500.50',
      'payment' => 
      array (
        'opaqueData' => 
        array (
          'dataDescriptor' => 'COMMON.ACCEPT.INAPP.PAYMENT',
          'dataValue' => 'eyJjb2RlIjoiNTBfMl8wNjAwMDUyRTg2NjI4RTM1REJERTlBRkVGRTA2MjY4MTg3RkQ1RkRFMUE0NzRCODBCMTk3N0MwOTIyM0E1NTExN0NFNTdDRTY2NDgyNUQ4RjAyQ0VFQjJBM0MwMEUwMTdFMTkyRTZFIiwidG9rZW4iOiI5NTYyNTgwMjM1NjM1OTM3NDAzNTAxIiwidiI6IjEuMSJ9',
        ),
      ),
      'solution' => 
      array (
        'id' => 'AAA102993',
      ),
      'order' => 
      array (
        'invoiceNumber' => '000000017',
      ),
      'poNumber' => NULL,
      'customer' => 
      array (
        'id' => NULL,
        'email' => '[email protected]',
      ),
      'billTo' => 
      array (
        'firstName' => 'bewdfjb',
        'lastName' => 'bb',
        'company' => 'nbn',
        'address' => '86 Jones Common, Greenview, FK8 1LD',
        'city' => 'Indianapolis',
        'state' => 'Greenview',
        'zip' => 'FK8 1LD',
        'country' => 'GB',
      ),
      'shipTo' => 
      array (
        'firstName' => 'bewdfjb',
        'lastName' => 'bb',
        'company' => 'nbn',
        'address' => '86 Jones Common, Greenview, FK8 1LD',
        'city' => 'Indianapolis',
        'state' => 'Greenview',
        'zip' => 'FK8 1LD',
        'country' => 'GB',
      ),
      'customerIP' => '27.109.19.234',
      'userFields' => 
      array (
        'userField' => 
        array (
          0 => 
          array (
            'name' => 'transactionType',
            'value' => 'authOnlyTransaction',
          ),
        ),
      ),
    ),
  ),
  'response' => '{"transactionResponse":{"responseCode":"1","authCode":"R8Y1BD","avsResultCode":"Y","cvvResultCode":"P","cavvResultCode":"2","transId":"40034332102","refTransID":"","transHash":"","testRequest":"0","accountNumber":"XXXX4444","accountType":"MasterCard","messages":[{"code":"1","description":"This transaction has been approved."}],"userFields":[{"name":"transactionType","value":"authOnlyTransaction"}],"transHashSha2":"80F1E27E02A4F3AD91851A4828EDE9CDF6728A5493556AE3228A8D57245D85693D987738705E273E883A2C2A80ED73230CE4B7C399006BC3929239AD845DC65B","SupplementalDataQualificationIndicator":0},"messages":{"resultCode":"Ok","message":[{"code":"I00001","text":"Successful."}]}}',
) [] []

Please help me!

13
  • Did you apply Authorize.Net Direct Post from MD5 to SHA-512 patches? Commented Jul 8, 2019 at 10:18
  • I am using Magento2.3.2 in which magento already applied this patch, @MSA
    – temper
    Commented Jul 8, 2019 at 10:18
  • have you tried with proper first name and last name in checkout that might be the possible issue
    – nikunj
    Commented Jul 8, 2019 at 10:19
  • @nikunj yes I tried but nothing changed,
    – temper
    Commented Jul 8, 2019 at 10:29
  • 1
    sometimes you cant checkout with sandbox account and it will work with a real account
    – nikunj
    Commented Jul 8, 2019 at 10:57

2 Answers 2

1

As I figured it out, everything configured correctly and Payment Gateway is also working, The only thing is it didn't worked in sandbox mode and when I switched to production mode, it worked.

0

This is caused by a Magento/Authorize using the wrong key to encode/decode the hash, so regenerating a new key and but make sure to check "Disable Old Transaction Key Immediately" and "Disable Old Signature Key Immediately" while generating the new keys in Authorize.net admin

    if (!$valid && $amount > 0) {
        $hash = $this->{$generateFunction}(
            $storedHash,
            $this->config->getLoginId($storeId),
            '0.00',
            $transactionResponse['transId'] ?? ''
        );
        $valid = Security::compareStrings($hash, $transactionResponse[$hashField]);
    }

    ....

    return $this->createResult(
        false,
        [
            __('The authenticity of the gateway response could not be verified.')
        ],
        [self::ERROR_TRANSACTION_HASH]
    );

Take a look at https://stackoverflow.com/questions/56490220/magento-2-3-1-authorize-net-payment-method-the-authenticity-of-the-gateway-res

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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