Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Payment gateway in test mode on a live site: how to fix it

OPS-209High impactPartlyBy FunnelGuardPublished Updated
On this page

What this issue is

Every payment gateway gives you two sets of credentials: test (also called sandbox) and live. Test keys talk to a simulator. They accept fake cards such as Stripe's 4242 4242 4242 4242 and never charge anyone.

This issue happens when the test keys stay in place after launch, or when they come back after a migration, a plugin update or a staging-to-live copy. The site looks normal. The checkout works. But the money never arrives.

It is different from a gateway outage (OPS-208) and from live keys sitting on a staging site (OPS-210). Here the live site has the wrong keys.

Why it costs you leads or sales

Real customers who enter real cards are usually declined, because a test environment rejects real card numbers. They see an error, think the shop is broken and leave. Some gateways also show a visible banner such as 'Test mode' that makes buyers distrust the page.

If a customer does use a test card or the gateway accepts the order, you get an order in your dashboard with no payment behind it. You may ship goods, grant course access or confirm a booking for free. Conversion tracking can also fire a purchase event for a sale that never paid, which pollutes your ad platform data.

Where a test-mode checkout breaks
  1. Product pageVisitor adds item to cart
  2. Checkout formDetails entered
  3. Payment with test keysReal card declined or no money moved
  4. Order confirmedNo real payment received
  5. Purchase trackingRevenue reported without cash

The customer reaches the payment step, but the gateway is a simulator, so the sale is lost.

Paid orders per week before and after the keys were wrongExample numbers
Paid orders per week before and after the keys were wrong (example)Week before switch: 40 orders; Week with test keys: 3 orders; Week after fix: 39 orders0153140339Week before switchWeek with test keysWeek after fixorders

Example: a store that normally takes 40 paid orders a week sees almost none while test keys are live.

How to check if your site has it

Start with what a customer sees, then check the settings.

Quick checks
  • Open your checkout in a private window and look for words like 'Test mode', 'Sandbox' or 'Test card' on the payment form.
  • In your payment settings, check whether the mode is set to Test, Sandbox or Development.
  • Look at the publishable key: Stripe test keys start with pk_test_ and sk_test_, live keys with pk_live_ and sk_live_.
  • In the gateway dashboard, switch the view between Test and Live and see which one shows your recent orders.
  • Compare your shop's order list with your gateway's live payments list. Orders with no matching payment are a warning sign.
  • Search your page source for pk_test_ (right-click, View page source, Ctrl+F).
Run in the browser console on your checkout pagejavascript
const html = document.documentElement.outerHTML;
console.log('Stripe test key found:', /pk_test_[A-Za-z0-9]+/.test(html));
console.log('Stripe live key found:', /pk_live_[A-Za-z0-9]+/.test(html));

How to fix it

Switch to live keys
  1. Confirm your gateway account is activated for live payments

    Stripe, PayPal and Square only issue live keys after you finish business verification. Complete any pending steps in the gateway dashboard first.

  2. Copy the live credentials

    In the gateway dashboard, switch off Test mode and open the API keys page (Stripe: Developers, API keys). Copy the live publishable and secret keys, or the live client ID and secret for PayPal.

  3. Paste them into your platform

    Use the tab below that matches your site. Replace test keys in every place they appear, including webhook secrets.

  4. Recreate the live webhook

    Webhooks are separate for test and live. Add your live endpoint in the gateway dashboard and paste the new signing secret into your platform.

  5. Clear caches

    Purge your site cache, CDN cache and any page-builder cache so the old publishable key is not served from a cached page.

Where to change the keys
  1. WooCommerce Stripe

    Go to WooCommerce, Settings, Payments, Stripe, then Settings. Untick Test mode and enter the live publishable key, secret key and webhook secret. Menu names vary by plugin version.

  2. WooCommerce PayPal

    In the PayPal Payments settings, untick Sandbox and reconnect your live PayPal account.

  3. Check wp-config.php and plugins

    Some setups define keys in code or in a separate payments plugin. Search for pk_test_ and sk_test_ there too.

Search a codebase for test keysbash
grep -rn --exclude-dir=node_modules --exclude-dir=.git -E "pk_test_|sk_test_|sandbox\.paypal\.com" .

How to confirm it's fixed

Verify with a real payment
  1. Reload checkout in a private window

    Confirm the test banner is gone and the page source no longer contains pk_test_.

  2. Place a small real order

    Use your own card on the cheapest product or a temporary low-price item.

  3. Check the gateway's live dashboard

    The payment should appear under Live, not Test.

  4. Check the order and webhook

    Make sure the order is marked paid, the confirmation email arrives and the webhook shows as delivered.

  5. Refund the payment

    Refund the test order from the gateway dashboard or your store admin.

  6. Check tracking

    Confirm one purchase event reaches GA4 and your ad platforms with the right value.

How to prevent it happening again

Prevention habits
  • Add 'switch payment keys to live' to your launch checklist, with a named owner.
  • Keep test and live keys in environment settings per environment instead of editing them by hand.
  • After every migration, staging push, theme change or payment plugin update, re-check the payment mode.
  • Review the gateway's Live and Test dashboards weekly for orders that do not match.
  • Limit who can change payment settings, and log who did.
  • Run an automated checkout check on a schedule so a mode change is noticed in hours, not weeks.
How it usually unfolds
  1. Day 0

    Site is cloned from staging and test keys come along.

  2. Day 1

    Real cards are declined; orders drop (Example).

  3. Day 4

    Someone notices revenue is flat and support emails arrive.

  4. Day 5

    Live keys are added and a real payment is confirmed.

How FunnelGuard handles this

FunnelGuard detects this issue only partly. It runs your checkout journey on a schedule and checks the page for a visible test-mode banner, using a text_absent check: the step fails if words that signal test mode, such as 'Test mode', appear on the page where they should not. If one does, you get a single alert with a screenshot and a likely cause, after a re-check from a second region.

What it does not do: it does not read your gateway dashboard, inspect your API keys, or confirm that a payment reached your live account. If your gateway is in test mode but shows no banner on the page, the text check will not catch it. FunnelGuard also never enters real card details and stops before payment unless your store's test mode is set up, so it cannot prove a real charge works.

The Free plan covers 1 site and 2 journeys with daily checks and no card. Paid plans start at $39/month with a 3-day free trial. A free read-only website audit is also available.

Questions people ask

Why is my Stripe checkout still in test mode on my live site?

Usually the test keys were never replaced, or they returned after a migration, a staging copy or a plugin update. Check your payment settings for a Test mode toggle and look for pk_test_ in your checkout page source.

How do I switch Stripe from test mode to live mode?

Activate your Stripe account, turn off Test mode in the dashboard, copy the live publishable and secret keys from Developers, API keys, and paste them into your store's payment settings. Then add the live webhook and clear your caches.

How can I tell if my payment gateway is in test mode?

Look for a Test or Sandbox banner on checkout, keys starting with pk_test_ or sk_test_, or orders that appear only in the gateway's Test view. A quick check is to view page source and search for pk_test_.

What happens if customers pay while the gateway is in test mode?

Real cards are usually declined, and any order that does go through collects no money. You may create orders you cannot collect on, and your tracking may report revenue that never arrived.

Why do I have orders but no money in Stripe or PayPal?

The orders may have been paid in test or sandbox mode, so the payments live in the Test view of the gateway. Switch the dashboard to Test mode to see them, then fix your keys so future orders use live mode.

Do I need a new webhook when I go live?

Yes. Test and live webhooks are separate in most gateways, each with its own signing secret. Create the live endpoint and update the secret in your platform, or orders may not be marked as paid.

Can FunnelGuard detect test mode on my live site?

Only partly. It checks for a visible test-mode banner on your checkout with a text_absent check. It does not check your keys or gateway account, so also verify them by hand and place a small real order.

How do I test a live checkout safely?

Buy the cheapest item with your own card, confirm the payment shows under Live in the gateway and that the order and email arrive, then refund it. Do not use customers' cards.

Does FunnelGuard catch this?

Partly

FunnelGuard checks part of this.

How: Test-mode banner via text_absent.

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.