To create an NMI public tokenization key, log in to the merchant portal, open Settings, then Security Keys, add a new key, choose the public key type and give it the Tokenization permission. Copy the key into the field your WooCommerce plugin uses for card fields. It only works with Collect.js, it is meant to be visible in page source, and it cannot make charges, so do not confuse it with your private security key.
What the key does
Hosted card fields load from NMI’s servers inside your checkout. When the customer submits, Collect.js turns the card details into a single-use payment token and sends that token to your server, which then sends it to the gateway. The card number never touches WordPress. The public tokenization key is what tells NMI which account the token belongs to. The concept is covered in our tokenisation explainer, and the browser side is in Collect.js, hosted fields and tokenization in WooCommerce.
Step by step
- Sign in to the NMI merchant portal as an administrative user.
- Go to Settings, then Security Keys.
- Choose Add a New Key.
- Name it for the site, for example the domain plus the word tokenization.
- Select the public key type and enable the Tokenization permission.
- Create it and copy the value.
- Paste it into the tokenization or public key field in the plugin settings, if your plugin has one. Check its current docs, because some integrations fetch or configure this differently.
- Save, then place a sandbox order and confirm the card fields load.
If you cannot see the Security Keys menu, you are probably not an administrator, or your reseller controls key creation. Ask them for a public key with tokenization permission for Collect.js.
Public key versus private key
- Public tokenization key: used only in the browser, works only with Collect.js, safe to show in page source by design.
- Private security key: used by the server for sales, refunds and voids. Never exposed to the browser.
The two are not interchangeable. An API key placed in the Collect.js slot fails, and a tokenization key cannot authorize a charge. Where to find the private one is in where to find your NMI security key.
Symptoms of the wrong key
- Card fields never appear: the key may be a private key, missing, or from the wrong environment.
- Fields appear but tokenization fails on submit: the key may lack the Tokenization permission.
- Works in staging, fails live: sandbox and live keys are separate, so confirm you pasted the live public key with live mode on.
- Content Security Policy errors in the browser console: your site may be blocking NMI’s script or frames. NMI documents that CSP must allow its domains.
For plugin, minify or caching issues, general troubleshooting applies: disable optimization on the checkout page and retest. Those are common causes but not documented by NMI, so treat them as ways to isolate the problem.
Rules for handling the key
- Create one tokenization key per site so you can revoke one without breaking another.
- Keep sandbox and live keys labelled so nobody pastes the wrong one.
- Rotate it if you ever change the domain or suspect misuse. Update the plugin, retest, then delete the old key.
- Do not bother hiding it in code. It is public by design, but the private key beside it must stay private.
Tokens, saved cards and the vault
A Collect.js token is single use and expires if unused, so it is not a saved card. It can be used once to charge or to add the card to the Customer Vault, which is how saved cards work. Saved cards and one-click reorder are a Pro feature of NMI for WooCommerce, and the setup is described on the saved cards and Customer Vault page.
Switching plugins or gateways
If you are moving from the Authorize.Net compatible mode, card fields and keys work differently, as described in Authorize.Net compatible mode errors. If you are changing plugins, add the key to your list in the migration day runbook. For a broader look at gateway choices, use the comparison hub.
Last reviewed November 2026.