On this page
What this issue is
A staging site is a private copy of your website used to try changes before they go live. When you clone a live site, the copy often brings along its settings, including the live API keys for Stripe, PayPal, Square or another gateway. A live key tells the gateway to move real money. A test key (also called sandbox) only simulates it.
Why it costs you leads or sales
Real charges on a site that is not your shop create refunds, chargebacks and angry customers. Staging orders also rarely reach your fulfilment flow, so a person pays and gets nothing. Gateways can treat a spike of refunds or disputes as a risk signal, which can lead to holds or reviews on your account.
- Clone live to stagingSettings and keys are copied too
- Tester places orderUses a real card or a customer finds the URL
- Gateway uses live keyReal money is taken
- Refunds and disputesNo product shipped, reports polluted
The break happens at the copy step, before anyone tests anything.
How to check if your site has it
Check the keys, not the checkout. Placing a test order to find out is exactly how the problem happens. Live keys start with pk_live_ and sk_live_ on Stripe. Test keys start with pk_test_ and sk_test_.
- Open the payment plugin or app settings on staging and look for a test mode or sandbox switch
- Look at the publishable key in the page source of the staging checkout: search for pk_live_ or pk_test_
- In your gateway dashboard, open Payments and filter by the last days: look for charges with unfamiliar amounts or your staging domain in metadata
- Check webhook endpoints in the gateway: is a staging URL registered against live mode?
- Ask your team whether anyone has tested a checkout on staging recently
- Check that staging is hidden from search engines and public visitors
grep -rIn --exclude-dir=node_modules --exclude-dir=.git -E "(pk|sk|rk)_live_" .How to fix it
Stop the damage
Put staging behind a password or take it offline until the keys are changed.
Refund real charges
In the gateway dashboard, find charges made from staging and refund them.
Swap in test keys
Replace live keys on staging with test or sandbox keys from the gateway's developer section.
Rotate keys if they leaked
If staging was public or the keys were shared widely, roll the live secret key in the gateway dashboard and update your live site.
Fix webhooks
Make sure staging uses a test-mode webhook endpoint and the live endpoint points only at the live site.
Block the staging URL from the public
Add password protection or an IP allowlist so real customers cannot reach it.
WooCommerce Stripe
Go to WooCommerce > Settings > Payments > Stripe, turn on Test mode and enter the test keys.
PayPal
In WooCommerce > Settings > Payments > PayPal, enable sandbox and use sandbox credentials.
Lock the keys in code
Where your plugin supports it, define keys in wp-config.php on staging only so a database copy cannot overwrite them.
Use a development store
Do not test on your live store. Use a development store or a duplicate store.
Test mode
In Settings > Payments, use the Bogus Gateway or your provider's test mode where available. Never enter real cards on a live store to test.
Environment variables
Read keys from environment variables, with test keys in the staging environment and live keys only in production.
Remove keys from the repository
Delete keys committed to code and rotate any that were exposed.
Ecommerce payments
Webflow staging subdomains share the site's ecommerce settings, so check Stripe or PayPal connection and use test mode in Stripe where Webflow allows it. Do not place real test orders.
Use a separate test site
Duplicate the site and disconnect the live payment provider on the copy, or test with the provider's test mode if the connection offers it.
Before
- Live keys copied from production
- Live webhook can be hit from staging
- Staging URL open to anyone
- Test orders charge real cards
After
- Test keys only on staging
- Separate test-mode webhook
- Staging behind a password
- Test orders use gateway test cards
How to confirm it's fixed
Check the key prefix
View the staging checkout source and confirm the publishable key starts with pk_test_.
Place a test order
Use the gateway's documented test card number, for example Stripe's 4242 4242 4242 4242.
Check the right dashboard
The payment should appear in the gateway's Test data view, not in live Payments.
Check the side effects
Confirm no real email, CRM record or ad conversion was created from the order.
How to prevent it happening again
- Store keys in environment variables or a secrets manager, one set per environment
- After every clone from live to staging, run a post-clone script that swaps in test keys
- Password protect staging and set it to noindex
- Register separate webhook endpoints for staging and live
- Add a secrets scanner to your repository so live keys cannot be committed
- Show a visible STAGING banner on the staging site
- Review who has access to the live gateway dashboard
How FunnelGuard handles this
This issue is outside what FunnelGuard checks. FunnelGuard runs your real customer journeys on your live site on a schedule and checks steps, tracking and lead delivery. It does not inspect the configuration of a private staging copy or read your payment keys.
The kind of tool that fits is a secrets and configuration scanner (for example one that scans your repository and environment for live keys), together with the alerts and review features in your payment gateway dashboard, such as notifications for unexpected live charges. FunnelGuard is useful alongside them to keep watching your live checkout journey, and it stops before payment unless a store's test mode is set up.
Questions people ask
Why is my staging site charging real credit cards?
Your staging site is almost certainly using live payment keys copied from the production site. Any order placed with a real card then goes through the live gateway. Switch staging to test or sandbox keys and refund the real charges.
How do I know if my site is using live or test Stripe keys?
Check the key prefix. Live keys start with pk_live_ and sk_live_, and test keys start with pk_test_ and sk_test_. You can see the publishable key in the checkout page source, and both in the Stripe dashboard under Developers.
How do I stop staging from using live payment keys after I clone my site?
Keep keys in environment variables or a config file that is not copied with the database, and use a post-clone step that sets test keys. Hosts and plugins that offer a staging mode often have a setting to disable live payments on the copy.
Can I refund payments made by mistake on a staging site?
Yes. If the charge went through a live key, it appears in your gateway's live payments list, and you can refund it from there. Contact the customer to explain, since they may have already seen the charge.
Should I rotate my API keys if staging used live keys?
Rotate them if staging was public, shared with outsiders, or the keys were stored in a repository or chat. Roll the secret key in the gateway dashboard and update the live site with the new value.
Is it safe to test checkout on my live store with a real card?
It is better to avoid it. Use test mode and the gateway's test cards, or a development store. If you must run a real transaction, use a small amount and refund it straight away.
Does FunnelGuard detect live keys on staging?
No. This issue needs a different kind of tool, such as a secrets scanner or your payment gateway's alerts. FunnelGuard monitors live customer journeys, tracking and lead delivery.
Related issues
- OPS-209Payment gateway keys in test mode on live siteFix guide
- OPS-208Payment gateway outage (Stripe, PayPal, Square)Fix guide
- OPS-226Tax/shipping rate API failing at checkoutFix guide
- OPS-211PayPal button not renderingFix guide
- OPS-212Apple Pay domain verification file missingFix guide
- OPS-231Analytics/GTM endpoint blocked or downFix guide