Your Stripe call fails with:
StripeAuthenticationError: Invalid API Key provided: sk_live_****xxxx
Enter fullscreen mode
Exit fullscreen mode
Payments stop, checkout shows a generic error, or it works on your machine and breaks after deploy. The message is blunt, and the most dangerous reaction to it is to paste your secret key somewhere public to "test it". Here is what to check.
What it means
Stripe received a key it does not recognize. It is wrong, truncated, from another account, revoked, or of the wrong type for this call. Stripe shows only the last four characters, so compare those with your dashboard.
The 6 usual causes
Env var missing in production. The key is in .env locally, but the host has no value, so the SDK gets undefined .
Extra characters. A trailing newline, space or quotes pasted into the env var field.
Key was rolled or deleted. The old one in your deploy no longer works.
Wrong account or mode.…