# Stripe

Getting paid smoothly is one of the most important things for your business! This guide will walk you through setting up a **Stripe webhook** (which lets Stripe seamlessly talk to Hostel Mate) and then finding and adding your **Secret key** in the Finance Portal. It’s a very straightforward process, so let's get right into it!

***

### Step 1: Set Up the Webhook in Stripe

Let's begin by configuring the webhook so Hostel Mate immediately knows when a payment occurs.

1. Go ahead and log in to your [**Stripe Dashboard**](https://dashboard.stripe.com/).
2. Navigate over to **Developers → Webhooks**.
3. Click on **Add destination** and make sure you select the exact following **Events**:
   * `checkout.session.completed`
   * `checkout.session.async_payment_succeeded`
   * `checkout.session.async_payment_failed`
4. Choose **Webhook endpoint** as your **Destination Type**.
5. Set up the **Configure destination** to save your new webhook. In the **Endpoint URL** field, just drop in this exact URL:

```
https://api.hostelmate.co/api/v1/online/stripe/process-request

```

***

### Step 2: Generate Your Stripe Secret Key

Fantastic, the webhook is ready! Now we need the secret key to grant access.

1. Stay logged in to your [**Stripe Dashboard**](https://dashboard.stripe.com/).
2. Look for the 'Secret key' and copy it so we can drop it right into Hostel Mate.

> **Testing tip:** We absolutely recommend using **Test mode** while you're learning the system. Once everything looks perfect and you're ready for real guests, just flip both your Stripe Dashboard and the Finance Portal over to **Live mode**.

***

> By the way, Hostel Mate naturally checks for valid webhook events the moment you connect Stripe. Creating the webhook first (like we did above) ensures everything connects flawlessly on the first try!

***

### Step 3: Add Your Stripe Secret Key

We're almost done! Let's pop that key into your account.

1. Hop over to your **Finance Portal → Payment Processing → Stripe**.
2. In the **API Key** field, simply paste the **Secret key** you just grabbed from Stripe:
   * Drop the `sk_test_...` one in if you are just testing.
   * Drop the `sk_live_...` one when you are taking real bookings.
3. Hit **Save** to lock everything in.
4. Optional but highly recommended: Hop into Stripe, turn on Live mode, and run a tiny test payment to see the magic happen in real time!

> **Quick reminder:** Use **Test mode** while testing. When you're ready to go live, make sure to switch both the Stripe Dashboard and the Hostel Mate Finance Portal to **Live mode**.

***

Once you've saved those two fields, Hostel Mate will automatically check that:

* Your Secret key is completely valid.
* The webhook is actively listening for your payment events.

As soon as that verification is done, you're all set to securely accept Stripe payments for your bookings!

### Troubleshooting

Running into a small hiccup? No worries, here's what to check:

* **Webhook not firing:** Double-check that you picked those exact three required events and pasted the Endpoint URL perfectly without any extra spaces.
* **Signature errors:** Try re-copying your webhook signing secret from Stripe and update it inside Hostel Mate.
* **Test vs Live mix-up:** Make sure Stripe and Hostel Mate are both set to Test, or both set to Live. Mixing them up is totally normal but causes errors!


---

# 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.hostelmate.co/finance-management/payment-processing/stripe.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.
