# 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).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.startupstarterkits.com/ssk-pro-features/payments/index/chapter-2.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
