On this page
What this issue is
Your store talks to a payment gateway (such as Stripe, PayPal, Braintree or Authorize.net) using API keys. These are long secret strings that prove the request comes from your account. If a key is expired, deleted, rolled (replaced by a new one) or restricted, the gateway rejects every request.
Why it costs you leads or sales
- Product pageLoads fine
- Checkout formCustomer enters card
- Gateway callInvalid or expired key
- Order confirmationNever reached
- Purchase trackingNever fires
The checkout page loads normally, but the gateway rejects the request.
Example: illustrative numbers for a small store whose keys were rolled on day 4.
How to check if your site has it
- Check your order count: did it drop to near zero at a specific time?
- Log in to the gateway dashboard and look for failed requests or an "Invalid API Key provided" error (Stripe: Developers > Logs).
- Check whether the keys were rolled, deleted or had an expiry date set (Stripe: Developers > API keys).
- Confirm your site uses live keys, not test keys, and keys from the right account.
- Look at your store's payment settings or logs for authentication errors.
- Check the gateway for account notices: verification needed, restricted or paused account.
- Try one real purchase with a card you own, or a test order if test mode is set up.
| Cause | Sign | Where to look |
|---|---|---|
| Key rolled or deleted | Authentication error in logs | Gateway dashboard API keys page |
| Key expired (set expiry) | Failures begin on a date | Gateway API keys page |
| Test keys on live site | Real cards fail | Store payment settings |
| Restricted key lacks permissions | Permission error in logs | Key permissions in gateway |
| Account restricted | Dashboard banner or email | Gateway account status |
How to fix it
Open your gateway dashboard
Sign in to the correct account and switch to live mode.
Find the API keys
For Stripe this is Developers > API keys. Other gateways have a similar page. Check status and expiry.
Create or reveal current live keys
If a key was rolled or deleted, create a new one. Copy it carefully with no spaces and store it in a password manager.
Paste the keys into your store
Use the platform steps below. Update the publishable key and the secret key together.
Update the webhook secret if needed
If you recreated the webhook endpoint, copy the new signing secret into your store too.
Test a checkout
Place an order and check it appears in both the store and the gateway.
Open the gateway plugin settings
In WooCommerce go to WooCommerce > Settings > Payments and open your gateway (for example Stripe).
Paste the live keys
Make sure Test mode is off, enter the live publishable and secret keys, and save. Some plugins offer a reconnect button instead, which is easier.
Check Shopify Payments or third-party gateway
Go to Settings > Payments. Shopify Payments has no keys to paste; fix any account alerts shown there.
Third-party gateways
Open the provider's settings, choose Manage, and re-enter the credentials from the provider dashboard.
Reconnect the provider
Go to Settings > Accept Payments, open the provider and reconnect or re-authorise the account.
Reconnect Stripe or PayPal
Go to Commerce > Payments, disconnect, then connect the account again and approve access.
Reconnect Stripe
In Site settings > Ecommerce, reconnect your Stripe account. Check the payment status in the Ecommerce settings.
Reconnect the integration
Open Payments > Integrations, find the gateway and reconnect it, making sure it is in live mode.
Update environment variables
Replace the secret key in your server environment or secrets manager, never in front-end code, then restart or redeploy the app.
Clear cached config
Make sure the new key is actually loaded and old values are not cached.
How to confirm it's fixed
Run a payment
Use the gateway's test mode with a test card if your store supports it, or a small real purchase you refund afterwards.
Check the gateway logs
The request should show as successful, with no authentication errors.
Check the order and emails
The order should appear in your store, with a confirmation email sent.
Check tracking
The thank-you page should fire your purchase event in GA4 and ad platforms.
How to prevent it happening again
- Note any key expiry dates in a calendar with a reminder two weeks ahead.
- Before rolling a key, update your store straight away or use the gateway's grace period if it offers one.
- Keep keys in a shared password manager, not in one person's inbox.
- Turn on gateway alerts for failed API requests and account issues, sent to more than one person.
- Watch daily order counts and investigate sudden drops.
- Run a scheduled test checkout (see below).
How FunnelGuard handles this
Keys expired
- Every card is declined
- Gateway logs show authentication errors
- No orders or purchase events
Live keys replaced
- Payments go through
- Gateway logs show successes
- Orders, emails and tracking arrive
Questions people ask
Why are all my payments being declined?
If every card fails, the cause is often on your side: expired, rolled or wrong API keys, test keys on a live site, or a restricted gateway account. Check the gateway dashboard logs for authentication errors.
Do Stripe API keys expire?
Standard Stripe keys do not expire by default, but they stop working if you roll or delete them. Rolling a key can also be set to expire the old one at a chosen time. Check Developers > API keys in Stripe.
How do I fix an invalid API key error at checkout?
Copy the current live keys from your gateway dashboard and paste them into your store's payment settings, with no extra spaces. Save, then place a test order and check the gateway logs.
How can I tell a key problem from a bank decline?
A bank decline affects individual cards and shows a decline code. A key problem affects every customer and shows authentication or permission errors in the gateway logs.
Will my store tell me when the keys stop working?
Often not. The checkout page still loads and customers just see a failure message. Set up gateway alerts and watch your order count.
Can FunnelGuard detect expired payment keys?
Only partly. It can run a test purchase if test mode is configured, but it does not check your live keys or real card payments. Cover that with gateway alerts and manual checks.
Is it safe to put my secret key in my theme or page code?
No. Secret keys must stay on the server or in the platform's secure settings. If one was exposed, roll it in the gateway and update your store.
Related issues
- CNV-205Payment gateway in test mode on live siteFix guide
- CNV-207Payment declined with a valid test cardFix guide
- CNV-209Payment succeeds but order not createdFix guide
- CNV-210Order created but payment fails silentlyFix guide
- CNV-201Card form iframe (Stripe Elements) doesn't renderFix guide
- CNV-217Payment error message unhelpfulFix guide