Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Stripe card form not showing: how to find and fix it

CNV-201High impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

Stripe Elements (and the newer Payment Element) shows card fields inside an iframe served by Stripe. Your page loads https://js.stripe.com/v3/, creates a Stripe object with your publishable key, then mounts the element into an empty div on your page.

If any link in that chain breaks, the div stays empty or shows a spinner forever. The page looks mostly normal, so the problem is easy to miss.

How the card form loads
  1. Checkout page loadsYour page and scripts arrive
  2. Stripe.js loadsjs.stripe.com/v3 is requested
  3. Element mountsCard iframe appears in the div
  4. Customer paysPayment is submitted
  5. Order and purchase trackingOrder created, tags fire

The break usually happens at the script, key or mount step. Everything after it is lost.

Why it costs you leads or sales

Without card fields, shoppers who are ready to buy cannot finish. Most will not report it. They leave, and you see only a drop in completed orders. Ad platforms also see fewer purchases, which can hurt campaign learning.

Orders per day before and after the card form breaksExample numbers
Orders per day before and after the card form breaks (example)Before the break: 24 orders; Day 1 after: 3 orders; Day 2 after: 2 orders; After the fix: 23 orders0918243223Before the breakDay 1 afterDay 2 afterAfter the fixorders

Example: illustrative numbers for a shop with steady traffic. Real figures depend on your store.

How to check if your site has it

Check the card form yourself
  1. Open the checkout in a private window

    Add a product to the cart and go to the payment step. Use a clean browser with no extensions, then repeat on a phone.

  2. Look for the card fields

    You should see card number, expiry and CVC fields (or the Payment Element tabs). An empty gap or endless spinner means a failure.

  3. Open the browser console

    Press F12 and open Console. Look for errors mentioning Stripe, Invalid API Key, Refused to load the script or Content Security Policy.

  4. Check the Network tab

    Filter by stripe. Confirm js.stripe.com/v3/ returns status 200 and that an iframe from js.stripe.com is in the page (Elements tab).

  5. Test with extensions and consent off

    Ad blockers, privacy tools and some cookie banners can block Stripe. Try with them disabled to see if the form appears.

Common console messages and what they usually mean
What you seeLikely causeWhere to look
Refused to load the script js.stripe.comContent Security Policy blocks StripeCSP header or meta tag
Invalid API Key providedWrong, missing or revoked publishable keyPlugin settings or code
Please provide a valid DOM elementMount div missing or wrong selectorCheckout template
Stripe is not definedScript did not load or loads after your codeScript order, optimisation plugins
Uncaught TypeError from another scriptAnother script crashed before Stripe mountedThe script named in the error

How to fix it

Fix the cause you found in the console. The most common ones are below. If the fix depends on your platform, use the tabs.

Fix the usual causes
  1. Allow Stripe in your Content Security Policy

    If you send a CSP header, allow https://js.stripe.com in script-src and frame-src, and https://api.stripe.com in connect-src.

  2. Use the correct publishable key

    The key starts with pk_live_ on a live site. Never put the secret key (sk_) in front-end code. Make sure the key and the Stripe account match.

  3. Load Stripe.js from Stripe directly

    Load https://js.stripe.com/v3/ from Stripe, not a copied or self-hosted file. Stripe does not support self-hosting.

  4. Exclude Stripe from script optimisation

    Minify, combine, defer and delay-JS features can break Stripe. Exclude js.stripe.com and your checkout scripts, or exclude the checkout page.

  5. Make sure the mount element exists

    The div you pass to mount() must exist in the DOM before you call it.

  6. Fix conflicting scripts

    Disable recently added plugins or tags one by one and reload checkout to find the one that throws errors.

Platform-specific steps
  1. Check the Stripe plugin keys

    In WooCommerce go to Settings > Payments > Stripe and reconnect the account or re-enter the publishable key for the right mode.

  2. Exclude checkout from caching and JS optimisation

    In your caching or optimisation plugin, exclude the cart and checkout pages and turn off delay or combine JS for js.stripe.com.

  3. Test for a plugin or theme conflict

    Switch to a default theme and disable other plugins on a staging copy, then re-enable one at a time.

Minimal Stripe Payment Element mounthtml
<div id="payment-element"></div>
<script src="https://js.stripe.com/v3/"></script>
<script>
  document.addEventListener('DOMContentLoaded', function () {
    if (typeof Stripe === 'undefined') {
      console.error('Stripe.js did not load');
      return;
    }
    var stripe = Stripe('pk_live_YOUR_PUBLISHABLE_KEY');
    // clientSecret comes from your server (PaymentIntent)
    var elements = stripe.elements({ clientSecret: window.CLIENT_SECRET });
    var paymentElement = elements.create('payment');
    paymentElement.mount('#payment-element');
  });
</script>
CSP directives that allow Stripetext
script-src https://js.stripe.com;
frame-src https://js.stripe.com https://hooks.stripe.com;
connect-src https://api.stripe.com;
Checkout card area

Broken

  • Empty box or endless spinner
  • Console shows a blocked script or invalid key
  • Shoppers leave without paying

Fixed

  • Card fields render inside the Stripe iframe
  • No Stripe errors in the console
  • Test payment completes and an order is created

How to confirm it's fixed

Confirmation checks
  • Card fields appear on desktop and mobile in a clean browser
  • js.stripe.com/v3/ returns 200 in the Network tab
  • No Stripe or CSP errors in the console
  • A test payment in Stripe test mode (card 4242 4242 4242 4242) succeeds
  • The order appears in your store and in the Stripe dashboard
  • Purchase tracking fires after the test order

How to prevent it happening again

Prevention habits
  • Test checkout after every plugin, theme, tag or security header change
  • Keep a staging site and test CSP changes there first
  • Exclude checkout pages from caching and script delay rules
  • Store the publishable key in one place and check it when you rotate keys
  • Review Stripe dashboard notices about API versions or account restrictions
  • Monitor the checkout on a schedule so a break is caught within hours

How FunnelGuard handles this

FunnelGuard detects this today. Its robot visitor runs your checkout journey on a schedule and includes a payment methods check. That check looks for the payment options and card form on the payment step, so a missing Stripe card iframe shows up as a failed step.

If a check fails, FunnelGuard re-checks from a second region before sending one alert by email, Slack, Teams, WhatsApp, webhook or PagerDuty. The alert includes a screenshot and a likely cause. Test traffic is marked, never enters real card details and stops before payment unless your store's test mode is set up.

You can start with the Free plan (1 site, 2 journeys, daily checks, no card), or try a paid plan free for 3 days. A free read-only website audit is also available.

Questions people ask

Why is my Stripe card form not showing at checkout?

Usually Stripe.js did not load or the Element could not mount. Common causes are a Content Security Policy blocking js.stripe.com, a wrong publishable key, a missing mount element, or a JavaScript error from another script. The browser console normally names the cause.

How do I fix a blank Stripe Elements iframe?

Open the console and Network tab on the checkout page. Fix what they show: allow js.stripe.com in your CSP, use the correct pk_ key, make sure the mount div exists, and exclude Stripe from minify or delay-JS settings. Then run a test payment.

Can an ad blocker or cookie banner hide the Stripe card form?

Yes. Some privacy extensions and consent tools can block scripts or iframes, including Stripe. Test in a clean browser with extensions off. If it works there, review how your consent or blocking rules treat Stripe, which is needed for payments.

Why does the Stripe card form work in test mode but not live?

The live site is often using a test publishable key, a mismatched account, or a live key that was not saved. Check the key starts with pk_live_ and belongs to the same Stripe account as your secret key and webhooks.

Does Content Security Policy block Stripe Elements?

It can. If your CSP does not allow https://js.stripe.com in script-src and frame-src, and https://api.stripe.com in connect-src, the browser refuses to load Stripe and the card fields stay empty.

Why does the Stripe card form not load after I installed a caching or speed plugin?

Minify, combine, defer and delay-JS features can change script order or stop Stripe.js running in time. Exclude js.stripe.com and your checkout pages from these features, then clear the cache and retest.

How can I know if my checkout card form breaks?

Check the checkout regularly yourself, or use monitoring. FunnelGuard runs your checkout journey on a schedule, checks the payment methods step and alerts you with a screenshot and likely cause if the card form is missing.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

How: payment_methods.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.