# Stripe

Stripe takes cards from all over the world, with the money going to your Stripe
account. It is the choice for selling to players outside Brazil.

You need a Stripe account activated for payments (with the company details and
the bank account filled in on the Stripe Dashboard).

![The Stripe card in the dashboard with the webhook step by step](shots/payments-stripe.webp)

## 1. Copy the API keys

1. On the [Stripe Dashboard](https://dashboard.stripe.com/apikeys), open
   **Developers > API keys**.
2. Switch to live mode (test mode off).
3. Copy the **publishable key**, which starts with `pk_live_`, and paste it into
   the **Public Key** field of the dashboard.
4. Reveal and copy the **secret key**, which starts with `sk_live_`, and paste it
   into **Secret Key**. Stripe shows the secret key only once: keep it somewhere
   safe.

## 2. Create the webhook

1. On the Stripe Dashboard, open **Developers > Webhooks** and click add endpoint.
2. Paste as the destination the URL the dashboard shows. It looks like this:

   ```text Webhook URL
   https://webhooks.hystore.com.br/api/v1/webhooks/stripe/<your store id>
   ```

3. Select these events:

   ```text Webhook events
   checkout.session.completed
   checkout.session.async_payment_succeeded
   checkout.session.async_payment_failed
   checkout.session.expired
   charge.refunded
   charge.dispute.closed
   ```

4. Save the endpoint and copy the **signing secret**, which starts with `whsec_`.
5. Paste it into **Webhook secret**, in the dashboard.

> [!WARNING]
> The webhook secret is required. Without it, the store cannot check that the
> notice really came from Stripe, and a paid order is never confirmed.

## 3. Turn it on and save

Turn on the Stripe card's switch and save. The player pays on a secure Stripe page
and comes back to the store with the order approved.

> [!NOTE]
> Stripe's checkout does not say whether the sale was by card or another method, so
> Finance uses the card fee for every Stripe sale. See
> [Gateway fees](/en/payments/fees/).

## Refunds and disputes

With the `charge.refunded` and `charge.dispute.closed` events, a refund and a lost
dispute on Stripe mark the order as **Refunded** on their own: deliveries that had
not gone out are cancelled. See [Orders](/en/products/orders/).
