Setting Up Your Stripe Account

Chapter 1: Setting Up Your Stripe Account

Step 1 - Create a Stripe Account

  1. Sign Up: Visit Stripe and sign up for an account if you don't already have one.

  2. Dashboard Access: After setting up your account, log in to access the Stripe Dashboard.

Step 2 - Obtain API Keys

  1. Navigate to API Keys: In the Stripe Dashboard, go to Developers > API keys.

  2. Copy Keys:

    • Publishable Key: Copy your Publishable Key.

    • Secret Key: Copy your Secret Key.

  3. Add to Environment Variables: In your project's .env file, add the following:

    STRIPE_SECRET_KEY=sk_test_your_secret_key
    STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret

Replace your_secret_key, your_webhook_secret, and your_github_token with your actual keys.

Step 3 - Set Up Webhook Secret

  1. Navigate to Webhooks: In the Stripe Dashboard, go to Developers > Webhooks.

  2. Add Endpoint:

    • Click on Add endpoint.

    • Enter your webhook endpoint URL (e.g., https://yourdomain.com/api/stripe/webhook).

  3. Select Events:

    • Choose checkout.session.completed and any other events you want to handle.

  4. Retrieve Webhook Secret:

    • After creating the endpoint, click to reveal the Signing Secret.

    • Add this to your .env file as STRIPE_WEBHOOK_SECRET.

Last updated