How to Test a Stripe API Key (Without Making a Real Charge)
Why Testing Stripe Keys Matters
Stripe keys control access to your entire payment infrastructure. A misconfigured or expired key can silently break checkout, subscriptions, and webhooks. But testing them is tricky — you don't want to accidentally create real charges or customers.
Stripe Key Types
| Key Prefix | Environment | Permissions |
|---|---|---|
sk_live_ | Live | Full account access — never expose |
sk_test_ | Test | Full test-mode access |
pk_live_ | Live | Publishable — safe for frontend |
pk_test_ | Test | Publishable test key |
whsec_ | Both | Webhook signing secret |
Method 1: Api Key Chain (Safe, One-Click)
- Go to apikeychain.app and paste your secret key
- The tool auto-detects it as Stripe
- Sends a read-only request to
/v1/customers?limit=1— no writes, no charges - You'll see: ✅ Valid, ❌ Invalid (401), or ⚠️ Rate limited
🔒 Safe by design: Api Key Chain only makes GET requests. It never creates, updates, or deletes anything — even accidentally.
Method 2: Manual curl (Read-Only)
curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: Bearer sk_test_..." \
https://api.stripe.com/v1/customers?limit=1
200= Key is valid401= Invalid or expired403= Key doesn't have permissions
Method 3: Stripe CLI
stripe listen --api-key sk_test_...
This verifies the key and starts listening for webhooks — useful for local development but overkill for a quick check.
What NOT to Do
- ❌ Don't create test charges to "check if it works" — it clutters your dashboard
- ❌ Don't test live keys in browser code — they'll be exposed
- ❌ Don't use
/v1/chargesendpoint — it requires a payment method token
After Testing
If your key is invalid:
- Go to Stripe Dashboard → API Keys
- Check if the key was rolled or revoked
- Generate a new key and update all environments
- Consider using restricted keys for production
💡 Pro tip: Save your Stripe keys in Api Key Chain Premium and enable health checks to get alerted before they expire or get revoked.
Related Posts
Get an Email When Your API Key Stops Working
API keys get revoked, expire or run out of credit without warning. Here is how to watch a key and get an email when it fails, and again when it works.
Check Your API Keys in CI With a GitHub Action
Fail the build when an API key in your secrets or .env file has stopped working. Use the open-source Api Key Chain CLI or GitHub Action.
How to Check If Your OpenAI API Key Is Still Valid
Learn how to quickly verify if your OpenAI API key is still active, what different error codes mean, and how to avoid common pitfalls.