Founder deal: 75% off the lifetime licence. Unlimited sites, one payment, every update.See the founder plan
Home / Blog / Declines and diagnostics

NMI "Authentication Failed" and Invalid Security Key Errors

Fix an NMI authentication failed or invalid security key error by checking key type, environment, permissions and whitespace, in that order.

An NMI authentication failed or invalid security key error means the gateway did not accept the key your site sent. The usual causes are, in order: the wrong key type (a public tokenization key pasted where the private API key belongs, or the reverse), a sandbox key on a live account, a key that was deleted or limited to the wrong permission, or a stray space from copying. Fix it by creating a fresh key with API permission and pasting it into the right field.

One caution on wording. NMI documents numeric response codes plus free-form text, so the exact message you see can differ by gateway, reseller and API. Treat the text as a clue, not a fixed string. A gateway rejection normally arrives as response=3 or a 3xx response_code, with your key problem described in responsetext and a REFID. See how to read those fields.

The two keys, and where each belongs

  • Security key (private API key): used by the server to talk to the Payment API. Created in the Merchant Portal under Settings, Security Keys, Add a New Key, with a name, an associated user and a permission type. Choose API permission.
  • Public key (tokenization key): used only by Collect.js in the browser. Same Settings area, but choose public key with Tokenization permission. API keys do not work with Collect.js, and the tokenization key does not work for API calls.

In the plugin, these go in separate fields. The gateway credentials documentation shows which is which. Putting the same key in both is the most common mistake.

Fix it in six steps

  1. Confirm the environment. Sandbox keys and live keys are different. If the plugin is in sandbox mode, use sandbox keys. A live key on a sandbox banner, or the opposite, fails. See testing and sandbox.
  2. Make a new key. In the portal, add a key named for the site, associated with an admin or API-capable user, with API permission. Keys inherit the permissions of the user they belong to, so a restricted user produces a key that authenticates but cannot sale.
  3. Copy without whitespace. Paste into a plain text editor first, check for a leading or trailing space or a line break, then paste into the field.
  4. Save and run one small test. Use a sandbox order or a test-mode transaction, not a live card.
  5. Check the user is active. If the user the key belongs to was disabled or deleted, the key stops working.
  6. Remove the old key. Once the new one works, delete the old one in the portal so only one valid key exists for the site.

When the key is right but it still fails

  • Legacy username and password. Older setups used a username and password instead of a key. NMI recommends a security key, and some third parties say username and password logins are being phased out. Confirm the date with NMI or your reseller rather than relying on a number you read elsewhere.
  • Authorize.Net compatible mode. The emulator takes the same security key, but enters it differently: the login value is the literal text api_key and the transaction key is the security key. A wrong login value produces errors that look like credential problems. See the compatible mode error guide.
  • Permissions. A key without the permission for the action (sale, refund, vault) returns a rejection that mentions the user not being allowed. That is a permission issue, not a bad key.
  • Reseller account. If you log in through a branded portal, the keys screen may be laid out differently. Ask your provider where security keys live.

Keep keys safe

The private key can move money, so it must stay on the server. Never paste it into front-end code, a support ticket screenshot or a public forum. If you think it leaked, delete it in the portal first, then create a new one. Read how the plugin handles data, and if you find a weakness in the plugin itself, use the security reporting page.

If the error is not about credentials after all, the response may be a card decline instead. Check where to look when NMI declines a valid card. More diagnostic guides sit in the troubleshooting center.

Last reviewed November 2026.

NMI for WooCommerce

Set up credentials correctly

See which key goes in which field, and how to test it safely.

Read credentials docsSee pricing

Free on WordPress.org.