Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Payment widget not rendering: fix Stripe Elements and PayPal

PRF-110High impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

Stripe Elements and the PayPal button are not part of your page. Your page loads a script from Stripe (js.stripe.com) or PayPal (paypal.com/sdk/js), and that script draws the card fields or the button inside an empty container on your page, usually in an iframe.

The widget is not rendering when that chain breaks. The page still loads and looks normal, but where the payment form should be there is a blank space, a spinner that never stops, or nothing at all.

Where the payment step breaks
  1. Product pageLoads normally
  2. Cart and checkoutLoads normally
  3. Payment widgetScript blocked or container missing
  4. Order placedCannot happen
  5. Purchase trackingNever fires

The page loads fine, but the widget never draws, so the funnel ends at payment.

Why it costs you leads or sales

This sits at the last step before money changes hands. Shoppers who got through the product page, cart and address form cannot finish. Many will not report it. They just leave.

It also hides itself. Your traffic, add-to-cart and checkout-start numbers look healthy, and only the purchase count drops. Ad platforms then see no purchases and may optimise towards worse traffic.

Checkout starts versus ordersExample numbers
Checkout starts versus orders (example)Checkout starts: 100 count per day; Orders (widget works): 30 count per day; Orders (widget missing): 0 count per day03877100300Checkout startsOrders (widget works)Orders (widget missin…count per day

Example: 100 shoppers start checkout each day. With a working widget 30 order. With the widget missing, none can.

How to check if your site has it

Check the checkout page yourself
  1. Open checkout in a private window

    Add a product to the cart and go to the payment step. Use a private window with no extensions so cached files and ad blockers do not hide the problem.

  2. Look for the widget

    You should see card fields (Stripe) or a yellow or blue PayPal button. A blank gap, an endless spinner or missing payment methods means it is not rendering.

  3. Open the browser console

    Press F12 (or Cmd+Option+J on Mac), open Console and reload. Read the first red error. Look for messages such as 'Refused to load the script', 'Invalid API Key provided', 'Please call Stripe() with your publishable key' or 'Element not found'.

  4. Check the Network tab

    Filter by 'stripe' or 'paypal'. A blocked, red or missing request to js.stripe.com/v3 or paypal.com/sdk/js shows the script never loaded.

  5. Test on mobile and in another browser

    Some failures only show on Safari, on mobile, or when a consent banner is declined.

Common causes and the clue to look for
CauseClue in the console or Network tab
CSP blocks the script or iframe'Refused to load the script' or 'Refused to frame' mentioning js.stripe.com or paypal.com
Script blocked by consent tool or optimiserRequest to Stripe or PayPal never appears, or is delayed until after a click
Wrong or missing publishable key'Invalid API Key provided' or 'Please call Stripe() with your publishable key'
Test key on a live site (or the reverse)Widget loads but payment methods are missing or errors on submit
Container element missing'Element not found' or 'Target container is not a DOM element'
PayPal client-id or currency wrongPayPal SDK request returns 400, or button does not appear
JavaScript error earlier on the pageAnother red error appears before the payment code runs

How to fix it

Fix the cause the console shows. The steps below cover the common ones, then platform tabs show where to look in each tool.

Fix a non-rendering payment widget
  1. Allow Stripe and PayPal in your CSP

    If you send a Content-Security-Policy header or meta tag, add the payment domains (see the code below). Without them the browser silently refuses the script and iframe.

  2. Exclude payment scripts from optimisation

    Do not defer, delay, combine or minify Stripe.js or the PayPal SDK. Exclude them in your caching or speed plugin and in any consent tool.

  3. Check the keys

    Use the publishable key (starts with pk_live_ or pk_test_), never the secret key (sk_). Make sure live and test modes match the environment. For PayPal, check the client-id and that the currency matches your store.

  4. Make sure the container exists before mounting

    The element Stripe or PayPal draws into must be in the page when the code runs. Mount after the DOM is ready, and again after your checkout re-renders it.

  5. Fix earlier JavaScript errors

    One uncaught error can stop the payment code from running. Fix or remove the failing script first.

  6. Do not load the widget twice

    Two copies of Stripe.js, or two PayPal SDK tags with different options, cause conflicts. Keep one.

CSP directives to allow Stripe and PayPal (add to your existing policy)text
script-src  https://js.stripe.com https://www.paypal.com https://www.paypalobjects.com;
frame-src   https://js.stripe.com https://hooks.stripe.com https://www.paypal.com;
connect-src https://api.stripe.com https://www.paypal.com;
img-src     https://www.paypalobjects.com;
Minimal Stripe Elements mount (custom code)html
<div id="payment-element"></div>
<script src="https://js.stripe.com/v3/"></script>
<script>
  document.addEventListener('DOMContentLoaded', function () {
    var stripe = Stripe('pk_live_YOUR_PUBLISHABLE_KEY');
    var elements = stripe.elements({ clientSecret: 'CLIENT_SECRET_FROM_YOUR_SERVER' });
    elements.create('payment').mount('#payment-element');
  });
</script>
Where to look on each platform
  1. Exclude payment scripts from optimisation

    In your caching or speed plugin, exclude js.stripe.com and paypal.com/sdk from delay, defer and combine settings. Clear the cache afterwards.

  2. Check the gateway settings

    In WooCommerce, go to Settings > Payments, open Stripe or PayPal and confirm the keys and the test or live mode.

  3. Rule out plugin conflicts

    Switch to a default theme and disable other plugins one by one on a staging copy. Check security plugins that add a CSP header.

Checkout before and after the fix

Before

  • Blank space where the card form should be
  • Console shows 'Refused to load the script'
  • Checkout starts but no orders

After

  • Card fields and PayPal button appear within a moment
  • Console has no payment errors
  • Orders and purchase tracking return

How to confirm it's fixed

Confirmation checklist
  • Card fields or PayPal button appear on checkout in a private window
  • No red errors mentioning stripe or paypal in the console
  • The requests to js.stripe.com or the PayPal SDK return status 200
  • The widget works on mobile and in Safari as well as Chrome
  • It still renders after declining the cookie banner
  • A test payment (provider test mode) completes and the purchase event is recorded

How to prevent it happening again

Prevention habits
  • Test checkout after every theme, plugin, app or CSP change
  • Keep payment scripts out of delay, defer and combine settings
  • Store live and test keys separately and check them at each deploy
  • Review CSP changes with the payment domains in mind
  • Do not wrap the payment container in markup that your checkout re-renders
  • Monitor checkout on a schedule instead of waiting for a drop in sales
How an unnoticed break unfolds
  1. Day 0

    Example: a speed plugin update delays third-party scripts and the Stripe field stops drawing.

  2. Day 1

    Traffic and checkout starts look normal. Orders dip.

  3. Day 3

    Someone notices revenue is down and starts investigating.

  4. Day 3 (later)

    The script is excluded from delay and the widget returns.

How FunnelGuard handles this

FunnelGuard detects this today. A robot visitor runs your checkout journey on a schedule, from the EU or the US, and its payment methods check looks at whether the payment options actually appear at the payment step. If they do not, the step is marked as failed.

A failure is re-checked from a second region before one alert goes out by email, Slack, Teams, WhatsApp, webhook or PagerDuty, with a screenshot and a likely cause. The robot stops before payment unless your store's test mode is set up, never enters real card details and never bypasses CAPTCHAs or bot protection. The Free plan covers 1 site and 2 journeys with daily checks and no card, and paid plans include a 3-day free trial.

Questions people ask

Why is my Stripe payment form not showing at checkout?

The most common reasons are a CSP that blocks js.stripe.com, a speed or consent tool that delays or blocks the script, a wrong publishable key, or a missing container element. Open the browser console on the checkout page and read the first error. It normally names the cause.

Why is my PayPal button not showing?

Check that the PayPal SDK request returns status 200 in the Network tab. A wrong client-id, an unsupported currency, a CSP that blocks paypal.com, or a script excluded by a consent tool are the usual causes. Also make sure the button container exists when the code runs.

How do I fix a Content Security Policy blocking Stripe?

Add the Stripe domains to your policy: js.stripe.com in script-src and frame-src, hooks.stripe.com in frame-src, and api.stripe.com in connect-src. Check Stripe's current documentation for the full list for the payment methods you use, then reload and check that the console error is gone.

Can a caching or speed plugin stop Stripe Elements from loading?

Yes. Options that delay, defer, combine or minify JavaScript can change when Stripe.js runs or stop it altogether. Exclude js.stripe.com and the PayPal SDK from those settings, clear the cache and test again.

Can I test the payment widget without a real card?

Yes. Use Stripe's or PayPal's test mode with their documented test details, or just check that the widget appears and stop before paying. You do not need a real card to confirm that it renders.

Why does the payment widget only fail for some visitors?

Browser extensions, privacy settings, consent banners, Safari restrictions and mobile networks can all block or delay the script for some people. Test in a private window, on mobile, and after declining cookies to reproduce it.

How can I know quickly if my checkout widget breaks?

Run a scheduled synthetic check that walks through checkout and confirms the payment options appear. FunnelGuard does this and alerts you with a screenshot and a likely cause, rather than you learning about it from lost sales.

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.