> For the complete documentation index, see [llms.txt](https://docs.hostelmate.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hostelmate.co/finance-management/payment-processing/stripe.md).

# Stripe

Accept card payments on your hostel's direct booking page. Add your Stripe secret key, set up the webhook and events, and fix common connection problems.

Stripe lets guests pay by card when they book on your Hostel Mate booking page. The money goes straight into your own Stripe account, and the booking is confirmed as soon as the payment goes through.

Setting it up takes about ten minutes. You'll need a Stripe account (it's free to create one at [stripe.com](https://stripe.com)) and access to the Finance portal.

In Hostel Mate, everything below happens in **Booking Engine → Checkout & payments**, under **Stripe connection**.

{% hint style="info" %}
We recommend setting everything up in test mode first. Use your test key (it starts with `sk_test_`) and Stripe's test card numbers, so you can make a full booking without moving real money. Once you're happy, repeat the steps with your live key (`sk_live_`).
{% endhint %}

## Step 1: Add your Stripe secret key

The secret key is what allows Hostel Mate to create payments in your Stripe account.

1. Log in to the [Stripe Dashboard](https://dashboard.stripe.com/) and go to **Developers → API keys**.
2. Copy the **Secret key**. Make sure it's the secret key (`sk_...`) and not the publishable key (`pk_...`).
3. In Hostel Mate, paste it into the **Secret key** field under step 1.
4. Click **Save** in the bar at the bottom of the screen.

We check the key with Stripe as soon as you save. If it works, the status bar at the top says **Stripe is connected** and shows the name, email and currency of your Stripe account, along with a **Test mode** or **Live** badge. If there's a problem, the bar tells you what's wrong.

## Step 2: Set up the webhook

When a guest pays, Stripe needs a way to let us know so we can confirm the booking. That's what the webhook does. Without it, guests can pay but their bookings won't be confirmed.

1. In Hostel Mate, click **Copy** next to the **Endpoint URL** under step 2. For reference, the URL is:

   ```
   https://api.hostelmate.co/api/v1/online/stripe/process-request
   ```
2. In Stripe, go to **Developers → Webhooks** and click **Add destination**.
3. Select these three events:
   * `checkout.session.completed`
   * `checkout.session.async_payment_succeeded`
   * `checkout.session.async_payment_failed`
4. Choose **Webhook endpoint** as the destination type, paste the URL and save.
5. Back in Hostel Mate, click **Check connection**.

Each event now shows either a green tick or **Missing**. Once all three are ticked, the webhook is ready.

{% hint style="warning" %}
The webhook has to be in the same mode as your key. If you're using a test key, create the webhook while Stripe is in test mode. When you switch to your live key, create a second webhook in live mode.
{% endhint %}

## Step 3: Switch on card payments

Connecting Stripe doesn't start taking card payments on its own. In the **How guests can pay** table at the top of **Checkout & payments**, switch on **Card (Stripe)** and save. Guests will see the card option on your booking page straight away.

## Optional: checkout settings

These are in the **Checkout options** card, below the webhook.

**Guest pays the Stripe fee.** Stripe charges a processing fee on every payment, usually around 2.9% + 30¢ depending on your country. With this switched on, the fee is added to the guest's total so you receive the full price of the booking.

**Name on card statement.** This is what guests see on their bank or card statement, for example `HOSTEL LISBOA`. A clear name here helps avoid chargebacks from guests who don't recognise the payment. It must be 5 to 22 characters long, include at least one letter, and can't contain `< > \ ' " *`. Leave it empty to use the name set in your Stripe account.

**Logo on the payment page.** Your logo appears on the Stripe payment page, which makes it look like part of your own website. Use a PNG, JPEG or GIF up to 2 MB; a square image looks best. Choose the file, then click **Upload**.

## Troubleshooting Stripe payments

**The status bar says the key is invalid.** Copy the secret key from Stripe again and paste it without any spaces before or after. Check it starts with `sk_` and not `pk_`.

**One or more events show as Missing.** Open your webhook in Stripe, add the missing event, then click **Check connection** in Hostel Mate.

**A guest paid, but the booking wasn't confirmed.** This almost always comes down to the webhook. Check the endpoint URL matches the one above exactly, and that your webhook and your key are both in test mode or both in live mode.

**Guests don't see a card option on the booking page.** Make sure **Card (Stripe)** is switched on in **How guests can pay**, and that you saved the change.
