cancel
Showing results for 
Search instead for 
Did you mean: 

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.

wdbaker54
Contributor
2 ACCEPTED SOLUTIONS

Accepted Solutions

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

kikmak42
Authorize.Net Expert Authorize.Net Expert
Authorize.Net Expert

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

4 REPLIES 4

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"
}
wdbaker54
Contributor

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 !

kikmak42
Authorize.Net Expert Authorize.Net Expert
Authorize.Net Expert

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.

Hi @wdbaker54

 

Hope the below link helps 

 

https://developer.authorize.net/api/reference/features/acceptjs.html#Generating_and_Using_the_Public...

 

 





Send feedback at developer_feedback@authorize.net