> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dezerx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Stripe

> Follow this guide to connect Stripe with Spartan

## Prerequisites

* Stripe Account
* Access to Stripe Dashboard
* Your application ready for integration

## Get API Keys

<Steps>
  <Step title="Open the Stripe Dashboard">
    Go to [https://dashboard.stripe.com](https://dashboard.stripe.com) and log in to your Stripe account.
  </Step>

  <Step title="Copy the API keys">
    In the left sidebar, go to **Developers → API keys**, then copy your **Publishable key** and **Secret key**.

    <img src="https://mintcdn.com/dezerx/y8vFoAhtdIIxWI9B/public/gateways/stripe/step-1.png?fit=max&auto=format&n=y8vFoAhtdIIxWI9B&q=85&s=d863ba193c6d23e869a3c7029a7f183a" alt="Stripe API Keys" width="1866" height="911" data-path="public/gateways/stripe/step-1.png" />
  </Step>
</Steps>

## Access Webhook Workbench

<Steps>
  <Step title="Open the webhook settings">
    In the left sidebar, go to **Developers → Webhooks**.
  </Step>

  <Step title="Add a destination">
    Click **Add destination** to open the webhook workbench.

    <img src="https://mintcdn.com/dezerx/y8vFoAhtdIIxWI9B/public/gateways/stripe/step-2.png?fit=max&auto=format&n=y8vFoAhtdIIxWI9B&q=85&s=46a68d8dba6446afbfb9f04a950a7aab" alt="Stripe Webhook Workbench" width="1866" height="911" data-path="public/gateways/stripe/step-2.png" />
  </Step>
</Steps>

## Select Events

<Steps>
  <Step title="Select all events">
    Select **All events** to monitor all Stripe events, then click **Continue**.

    <img src="https://mintcdn.com/dezerx/y8vFoAhtdIIxWI9B/public/gateways/stripe/step-3.png?fit=max&auto=format&n=y8vFoAhtdIIxWI9B&q=85&s=eeaf60cfc071b6a513302e6797a61c74" alt="Select Events" width="1866" height="911" data-path="public/gateways/stripe/step-3.png" />
  </Step>
</Steps>

## Configure Webhook Endpoint

<Steps>
  <Step title="Select Webhook endpoint">
    Select **Webhook endpoint**, then click **Continue**.

    <img src="https://mintcdn.com/dezerx/y8vFoAhtdIIxWI9B/public/gateways/stripe/step-4.png?fit=max&auto=format&n=y8vFoAhtdIIxWI9B&q=85&s=acdbb732539502ecbf5e6976c0e521cc" alt="Webhook Endpoint Configuration" width="1866" height="911" data-path="public/gateways/stripe/step-4.png" />
  </Step>
</Steps>

## Configure Destination

<Steps>
  <Step title="Enter a destination name">
    Enter a descriptive name for your webhook, such as `My Store Webhook`.
  </Step>

  <Step title="Set the endpoint URL">
    The endpoint URL must end with `/api/public/gateways/stripe/webhook/callback`.

    For example:

    ```text theme={null}
    https://yourdomain.com/api/public/gateways/stripe/webhook/callback
    ```
  </Step>

  <Step title="Create the webhook">
    Review the configuration and click **Continue** to create the webhook.

    <img src="https://mintcdn.com/dezerx/y8vFoAhtdIIxWI9B/public/gateways/stripe/step-5.png?fit=max&auto=format&n=y8vFoAhtdIIxWI9B&q=85&s=2a9c8ea78359c72f0cb72d7246aedb8f" alt="Destination Configuration" width="1866" height="911" data-path="public/gateways/stripe/step-5.png" />
  </Step>
</Steps>

## Webhook Created Successfully

<Steps>
  <Step title="Review the webhook details">
    After creating the webhook, review its details and copy the webhook endpoint URL.
  </Step>
</Steps>

## Add Stripe to Spartan

<Steps>
  <Step title="Open the Stripe gateway">
    Log in to Spartan as an administrator, then go to **Modules → Gateways → Stripe**.
  </Step>

  <Step title="Configure Stripe">
    Enter your Stripe credentials and webhook details, then click **Save Settings**.

    <img src="https://mintcdn.com/dezerx/y8vFoAhtdIIxWI9B/public/gateways/stripe/step-6.png?fit=max&auto=format&n=y8vFoAhtdIIxWI9B&q=85&s=71b394fb5e29f97acb8e071c44cef19d" alt="Spartan Stripe configuration" width="1866" height="911" data-path="public/gateways/stripe/step-6.png" />
  </Step>
</Steps>

## Troubleshooting

### Common Issues

1. **Invalid Credentials**
   * Verify Publishable Key and Secret Key are correct
   * Ensure you're using the right environment (test/live)

2. **Webhook Not Receiving Events**
   * Check webhook URL is accessible
   * Verify webhook endpoint URL ends with `/api/public/gateways/stripe/webhook/callback`
   * Verify webhook is enabled and configured correctly
   * Check your server logs for errors

3. **Payment Failures**
   * Verify your Stripe account is in good standing
   * Check if the payment amount is within limits
   * Ensure all required fields are provided

### Support Resources

* [Stripe Documentation](https://stripe.com/docs)
* [Stripe API Reference](https://stripe.com/docs/api)
* [Stripe Webhook Documentation](https://stripe.com/docs/webhooks)
