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

NMI Collect.js Not Loading on WooCommerce Checkout

Collect.js usually fails to load for one of four reasons: a blocked request, the wrong key type, a JavaScript conflict or an optimizer. Here is how to find which.

If NMI Collect.js is not loading on your WooCommerce checkout, the cause is almost always one of four things: the script request is blocked (a Content Security Policy, a firewall or an ad blocker), the key is the wrong type, a JavaScript error from another plugin stops the page script before it runs, or an optimization plugin has rewritten or delayed the script. A two-minute look at the browser console and Network tab tells you which one.

Step 1: See what the browser actually did

Open the checkout in a private window, then open developer tools (F12).

  1. Go to the Network tab, reload, and filter for Collect.js. The NMI script is served from secure.nmi.com/token/Collect.js.
  2. No request at all: the page never asked for it. Skip to the plugin and JavaScript causes below.
  3. Request shows blocked, red, or status 0: something stopped it. Check the Console tab for the exact message.
  4. Request returns 200 but the fields are empty: the script loaded and failed at setup. Look in the Console for a red error right after it.

Cause 1: Content Security Policy blocks NMI

NMI documents the minimum CSP sources Collect.js needs. If your host, a security plugin or a CDN adds a strict policy header, the console shows a line starting with “Refused to load the script” or “Refused to frame”.

  • script-src needs https://secure.nmi.com. Add https://applepay.cdn-apple.com and https://pay.google.com if you use wallets.
  • style-src needs https://secure.nmi.com.
  • connect-src and frame-src need https://secure.nmi.com (plus https://pay.google.com for Google Pay).

Fix it where the header is set: server config, CDN rules or a headers plugin. Changing it inside WordPress will not help if the CDN adds its own header.

Cause 2: the wrong key, or no key

Collect.js needs a public tokenization key, created in the NMI Merchant Portal under Settings, Security Keys. NMI states that a private API key does not work with Collect.js, and a tokenization key does not work with the normal Payment API. Pasting one in the other’s field is a common mistake after a migration. Our guide to creating a public tokenization key covers the exact steps, and the hooks and filters reference shows where script handling can be adjusted if you need to change how the checkout scripts are enqueued.

Cause 3: optimization plugins

NMI’s documentation does not mention minify or delay plugins, so treat this as general troubleshooting advice rather than an NMI rule. In practice, combining, deferring or delaying JavaScript can change load order or stop an external script from running until the first user interaction. Test by turning off JavaScript minify, combine and delay for the checkout page only, then clear all caches. If the fields come back, add exclusions. The details for the common plugins are in NMI payment fields and caching or minify plugins.

Cause 4: another script breaks the page

One uncaught error in a theme or plugin script can stop later scripts on the same page. In the Console, look for the first red error that mentions a plugin or theme file, not the last. Then run a conflict test:

  1. Switch to a default theme such as Twenty Twenty-Five on a staging copy.
  2. Deactivate everything except WooCommerce and the NMI plugin.
  3. Reload checkout. If the fields appear, reactivate plugins in halves until it breaks again.

Page builders and checkout customizers are frequent culprits. If the NMI method itself is missing from the payment list, that is a different problem: see NMI payment method not showing at checkout.

Cause 5: cached or stale checkout markup

Checkout, cart and My Account pages should never be page-cached. A cached checkout can serve old script tags or an expired nonce. Confirm your cache plugin and CDN exclude these pages, purge everything, and retest as a logged-out visitor.

Cause 6: network and browser blockers

Ad blockers, privacy extensions and corporate firewalls sometimes block third-party script hosts. If only some customers report the problem, ask whether it happens in a private window with extensions off. Your server logs will not show this, because the request happens in the customer’s browser.

Quick checklist

  • Console and Network tab checked for secure.nmi.com.
  • CSP header allows the NMI sources above.
  • Field holds a public tokenization key, not the private API key.
  • Minify, combine and delay off for checkout, caches purged.
  • Conflict test done on staging.
  • Checkout excluded from page cache.

If you added fixes for the block checkout, recheck against the HPOS and block checkout checklist. More symptom guides are in the troubleshooting center.

Last reviewed November 2026.

NMI for WooCommerce

Hooks and filters for checkout scripts

See the documented hooks and filters you can use to adjust how the plugin behaves.

View hooks and filtersSee pricing

Free on WordPress.org. Pro adds wallets and ACH.