Blog header background
    Technical Support

    Get Stripe API Keys: Test & Live (2026)

    Hatty AI
    February 25, 2026
    5 min read
    🔑

    Featured Article

    Technical Support

    Get Stripe API Keys: Test & Live (2026)

    Find your Stripe publishable & secret API keys in 2 minutes. Step-by-step for test and live modes — with security best practices.

    Hatty AI
    February 25, 2026
    5 min read

    Why You Need Stripe API Keys

    Stripe API keys are essential for connecting your website or application to Stripe's payment processing infrastructure. Whether you're building an e-commerce store, a SaaS subscription platform, or a simple donation page, you'll need both Test and Live keys to develop and deploy your integration.

    Test keys let you simulate transactions without moving real money, while Live keys process actual payments. This guide walks you through retrieving both sets of keys from your Stripe Dashboard.

    💡 Quick Tip

    Always start development with Test keys. Switch to Live keys only when you're ready to accept real payments.

    Step 1: Log in to Stripe

    1. Go to dashboard.stripe.com
    2. Sign in with your Stripe account credentials.
    3. If you don't have an account yet, click "Sign up" to create one — it's free.

    Step 2: Navigate to API Keys

    Once you're in the Stripe Dashboard:

    1. Look at the left sidebar and click "Developers".
    2. Then click "API keys" from the submenu.

    You'll now see a page listing your API keys. This is where you'll find both your Publishable key and Secret key.

    📍 Navigation path: Dashboard → Developers → API keys

    Step 3: Retrieve Your Test Keys

    Test keys allow you to simulate payments without processing real transactions. Here's how to get them:

    1. At the top right of the dashboard, toggle "Test mode" to ON.
    2. You will now see your test keys displayed:
      • Publishable key — starts with pk_test_
      • Secret key — starts with sk_test_
    3. Click "Reveal test key" to view the full Secret key.

    ✅ What to copy

    • Test Publishable Key (pk_test_...)
    • Test Secret Key (sk_test_...)

    Step 4: Retrieve Your Live Keys

    Once you're ready for production, you'll need your Live keys to process real payments:

    1. Turn Test mode OFF using the toggle at the top right.
    2. You will now see your Live keys:
      • Publishable key — starts with pk_live_
      • Secret key — starts with sk_live_
    3. Click "Reveal live key" to view the full Secret key.

    ✅ What to copy

    • Live Publishable Key (pk_live_...)
    • Live Secret Key (sk_live_...)

    ⚠️ Important Security Notes

    • Never share your Secret Key publicly. Do not email it in plain text, post it on social media, or include it in client-side code.
    • Your Publishable Key is safe to use in frontend code — it can only create tokens, not charge cards.
    • Your Secret Key belongs on your server only. It has full access to your Stripe account.

    Best Practices for API Key Security

    • Store Secret Keys in environment variables, never in source code.
    • Use Restricted API Keys in production environments to limit permissions.
    • Rotate your keys periodically and revoke any that may have been compromised.
    • Use Stripe's webhook signing secrets to verify incoming events.

    Using Restricted API Keys (Recommended for Production)

    For production environments, Stripe recommends creating Restricted API Keys instead of using your main Secret Key. Restricted keys let you control exactly which API resources the key can access.

    1. Go to Developers → API keys in your Stripe Dashboard.
    2. Click "Create restricted key".
    3. Name your key (e.g., "Website Payments" or "Subscription Manager").
    4. Select the specific permissions the key needs (Read, Write, or None for each resource).
    5. Click "Create key" and copy it immediately — you won't be able to see it again.

    Quick Reference: Key Prefixes

    Key Type Prefix Safe for Frontend?
    Test Publishablepk_test_✅ Yes
    Test Secretsk_test_❌ No
    Live Publishablepk_live_✅ Yes
    Live Secretsk_live_❌ No
    Restrictedrk_live_ / rk_test_❌ No

    Need Help?

    If you'd like assistance retrieving your keys, setting up restricted keys, or configuring Stripe webhooks, the Hatty AI team is here to help.

    Need hands-on assistance with Stripe integration?

    Contact Hatty AI

    We can also grant temporary access setup, walk you through webhook configuration, or build a complete Stripe integration for your platform.

    Frequently Asked Questions

    🍪 We Value Your Privacy

    We use cookies and similar technologies to enhance your experience, analyze site traffic, and understand where our visitors are coming from. You can customize your preferences at any time.