Reply
Highlighted
Contributor
Posts: 12
Registered: ‎07-12-2010
Accepted Solution

Accept.js - E00007/E_WC_21 "User authentication failed due to invalid authentication values."

I have developed an online payment page using PHP and jQuery that allows both CIM payment submissions as well manual credit card entry.
I have no problems submitting the CIM payments to the sandbox but when I use the exact same merchantAuthenticationType values
to Accept.dispatchData() I get an E00007/E_WC_21 "User authentication failed due to invalid authentication values." error.

I have been going through the previous posts about this but none of them answered why one method works while the other doesn't when both use the same authentication values.

 

CIM process

client javascript

function submitCIMPayment(data) {
        var submission = {
            _token: Billing.token,
            amount: data['amount'], cardCode: data['card-cvv'],
            gateway_id: data['gateway_id'], gateway_ppid: data['gateway_ppid']
        };
        $.post("/billing/payment", submission)
            .done(function (data) {
                ...
            })
            .fail(function(data){
                ...
            });
    }

server php

 

    public function chargeProfile($authAccount, $amount, $cardCode, $user)
    {
        $profileToCharge = new AnetAPI\CustomerProfilePaymentType();
        $profileToCharge->setCustomerProfileId($authAccount->gateway_id);
        $paymentProfile = new AnetAPI\PaymentProfileType();
        $paymentProfile->setPaymentProfileId($authAccount->gateway_ppid);
        $paymentProfile->setCardCode($cardCode);
        $profileToCharge->setPaymentProfile($paymentProfile);
        $transactionRequestType = new AnetAPI\TransactionRequestType();
        $transactionRequestType->setTransactionType("authCaptureTransaction");
        $transactionRequestType->setAmount($amount);
        $transactionRequestType->setProfile($profileToCharge);
        $request = new AnetAPI\CreateTransactionRequest();
        $merchant = new AnetAPI\MerchantAuthenticationType()
        $merchant->setName($config['login']);
        $merchant->setTransactionKey($config['key']);
        $request->setMerchantAuthentication($merchant)
        $request->setTransactionRequest($transactionRequestType);
        $controller = new AnetController\CreateTransactionController($request);
        $response = $controller->executeWithApiResponse('https://apitest.authorize.net');
        ...
    }

 

There have been no errors with the CIM process.

Accept.JS process

client javascript

        <script src="https://jstest.authorize.net/v1/Accept.js" type="text/javascript" charset="utf-8"></script>

        function sendCardDataToAnet(data) {
            var secureData = {}, authData = {}, cardData = {};

            cardData.cardNumber = data['card-number'];
            cardData.month = data['expiration'][1];
            cardData.year = data['expiration'][0];
            cardData.cardCode = data['card-cvv'];

            authData.clientKey = Billing.clientKey;
            authData.apiLoginID = Billing.apiLoginID;

            secureData.cardData = cardData;
            secureData.authData = authData;

            /* Dispatch Data to Accept.js */
            Accept.dispatchData(secureData, 'anetResponseHandler');
        }

        function anetResponseHandler(response) {
            if (response.messages.resultCode === "Error") {
                var i = 0;
                while (i < response.messages.message.length) {
                    console.log(
                        response.messages.message[i].code + ": " +
                        response.messages.message[i].text
                    );
                    i = i + 1;
                }
            } else {
                submitSecurePayment(response.opaqueData);
            }
        }

The console output is: E_WC_21: User authentication failed due to invalid authentication values.


Accepted Solutions
Solution
Accepted by topic author wdbaker54
‎06-14-2018 01:09 PM
Authorize.Net Expert
Posts: 44
Registered: ‎07-27-2016

Re: Accept.js - E00007/E_WC_21 "User authentication failed due to invalid authentication values

Hi @wdbaker54

 

The error is with your clientKey in Accept.js, as per the dump you have shared for the authData the authentication values which you are using are incorrect.

 

Please generate a CleintKey by logging into the Merchant Interface and navigating to Account --> Security Settings --> Manage Public Client Key, and use this as clientKey in authData.

 

 

Hope this Helps !

View solution in original post

Solution
Accepted by topic author wdbaker54
‎06-14-2018 01:08 PM
Contributor
Posts: 12
Registered: ‎07-12-2010

Re: Accept.js - E00007/E_WC_21 "User authentication failed due to invalid authentication values

So what you are saying is that they don't use the same values:

  • CIM process uses the API Login ID and Transaction Key pulled from the API Credentials & Keys page for the merchantAuthenticationType: name and transactionKey
  • Accept.js process uses API Login ID pulled from the API Credentials & Keys page and Client Key pulled from the Public Client Key page for: apiLoginID and clientKey

My mistake was that I thought that both processes used the same values - only the API Login ID is used for both. I am now beyond that problem but still haven't been successful in completing an accept.js transaction but it is now with the remainder of my code and not my understanding of the API.

 

Thanks for pointing me in the right direction - I read and re-read the APIs and still missed the difference.

View solution in original post


All Replies
Contributor
Posts: 12
Registered: ‎07-12-2010

Re: Accept.js - E00007/E_WC_21 "User authentication failed due to invalid authentication values

In case someone needs more information, Here is the JSON data for the Accept.dispatchData() secureData parameter:

{
    "authData": {
      "apiLoginID": "72RxxxvP",
      "clientKey": "295U3Xxxx7DLQ3dg"
    },
    "cardData": {
      "cardCode": "151",
      "cardNumber": "4111111111111111",
      "month": "07",
      "year": "2024"
    }
}

(I don't want to be paranoid but the apiLoginID and clientKey were tweaked even though this is a sandbox account)

and a JSON dump of the merchantAuthenticationType values:

{
    "name": "72RxxxvP",
    "transactionKey": "295U3Xxxx7DLQ3dg"
}
Solution
Accepted by topic author wdbaker54
‎06-14-2018 01:09 PM
Authorize.Net Expert
Posts: 44
Registered: ‎07-27-2016

Re: Accept.js - E00007/E_WC_21 "User authentication failed due to invalid authentication values

Hi @wdbaker54

 

The error is with your clientKey in Accept.js, as per the dump you have shared for the authData the authentication values which you are using are incorrect.

 

Please generate a CleintKey by logging into the Merchant Interface and navigating to Account --> Security Settings --> Manage Public Client Key, and use this as clientKey in authData.

 

 

Hope this Helps !

Solution
Accepted by topic author wdbaker54
‎06-14-2018 01:08 PM
Contributor
Posts: 12
Registered: ‎07-12-2010

Re: Accept.js - E00007/E_WC_21 "User authentication failed due to invalid authentication values

So what you are saying is that they don't use the same values:

  • CIM process uses the API Login ID and Transaction Key pulled from the API Credentials & Keys page for the merchantAuthenticationType: name and transactionKey
  • Accept.js process uses API Login ID pulled from the API Credentials & Keys page and Client Key pulled from the Public Client Key page for: apiLoginID and clientKey

My mistake was that I thought that both processes used the same values - only the API Login ID is used for both. I am now beyond that problem but still haven't been successful in completing an accept.js transaction but it is now with the remainder of my code and not my understanding of the API.

 

Thanks for pointing me in the right direction - I read and re-read the APIs and still missed the difference.

Posts: 213
Kudos: 35
Solutions: 22
Registered: ‎03-13-2017

Re: Accept.js - E00007/E_WC_21 "User authentication failed due to invalid authentication values