Checkout is stuck when Authorize.net payment method is used

This article provides an explanation and fix for the Adobe Commerce 2.3.X issue where the checkout gets stuck if Authorize.net is used, with the ‘Cannot read property ‘length’ of null’ error message in the browser console log.

Affected products and versions

  • Adobe Commerce 2.3.X
NOTE
The core Adobe Commerce Authorize.Net payment integration has been deprecated since 2.3.4 and was completely removed in 2.4.0. Use an extension that suits your needs from the Adobe Commerce Marketplace instead.

Issue

Steps to reproduce

  1. Configure the Authorize.net payment method in the Commerce Admin.
  2. Go to the storefront.
  3. Add a product to the cart and proceed to checkout.
  4. Choose Authorize.net as a payment method.
  5. Click Place Order.

Expected result

The Authorize.net iframe is loaded.

Actual result

Ajax spinner is displayed, and the page never loads. The following JS error is displayed in the browser console log: ‘Uncaught TypeError: Cannot read property ‘length’ of null at b (jstest.authorize.net/v1/AcceptCore.js:1)’

Cause

One of the most common reasons for this issue is the Public Client Key not being specified in the Authorize.Net configuration in the Commerce Admin.

Solution

Under Stores > Settings > Configuration > Sales > Payment Methods, in the Authorize.net section, check if the value is specified in the Public Client Key field. If it is empty, enter the key value from your Authorize.Net merchant account.

For the changes to be applied, clean the cache by running

bin/magento cache:clean
recommendation-more-help
8bd06ef0-b3d5-4137-b74e-d7b00485808a