# Installing Stripe in Your Application

## **Step 4 - Configure the Webhook Endpoint**

The Stripe webhook endpoint handles events, such as successful payments, enabling real-time processing of orders and updates.

1. **Set Up API Route**: Create an API route in your application (e.g., `/api/webhook`) to receive webhook events from Stripe.
2. **Webhook Handler Overview**:
   * The handler verifies incoming requests using the Stripe webhook secret, ensuring secure event processing.
   * The handler can process various event types, such as `checkout.session.completed`, to perform actions like logging transactions or adding customers as collaborators in GitHub repositories.

**Example Environment Variables**:

Add the following keys to your environment configuration:

```bash
STRIPE_SECRET_KEY=your_stripe_secret_key
STRIPE_WEBHOOK_SECRET=your_stripe_webhook_secret
```

### **Feature Flag Setup**

To use Stripe with SSK-Pro, ensure the following feature flag is enabled in your `.env` file:

```bash
FF_STRIPE="true"
```

With this flag set, export the webhook in your app’s `/api/webhook` endpoint, and SSK-Pro will handle the integration seamlessly.

### **Additional Notes**

* **Security**: Stripe’s webhook signature verification ensures only authentic requests are processed.
* **GitHub Integration**: Your webhook handler can automate tasks, such as adding users to repositories upon purchase, enhancing user experience.

For further information on configuring Stripe’s webhook, refer to their [official documentation](https://stripe.com/docs/webhooks).
