# Stripe

> What teammates read in Stripe, how to make a restricted key, and what Customers, Analytics and Disputes take from it.

Connect Stripe so that Analytics ties payments to the visits behind them, and Customers shows who pays you. The Churn
watcher also reads your customers, subscriptions, invoices and failed payments. Troopy changes nothing in Stripe, with one
exception: the evidence of a dispute, after your yes or under your grant.

## Before you begin

- Owners and admins connect, replace and disconnect a service.
- You need a Stripe account with access to its API keys.

## What Troopy reads, and for what

| Product or teammate | What it reads                                                                                                              |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| Customers           | Each subscription with its customer, and the payments. A read each hour. See [Understand your customers](/docs/customers). |
| Analytics           | New payments every 5 minutes, MRR, subscribers, trials, churn and LTV. See [Set up website analytics](/docs/analytics).    |
| The Churn watcher   | Customers, subscriptions, invoices and failed payments, with its Stripe tools.                                             |
| Disputes            | The disputes, and the records behind each one. See [Answer payment disputes](/docs/disputes).                              |

## Make a restricted key

Troopy takes a restricted key only, with the least access that it needs.

1. Open **Settings** > **Apps**, and select the tile of Stripe. Its card opens.
2. Select **Create the key in Stripe**. Stripe opens its form with the key named Troopy.
3. Check the permissions. Customers, Subscriptions, Invoices and Charges are set to Read. Checkout Sessions and Payment
   Intents are set to Read too.
4. Create the key in Stripe, and copy it. It starts with `rk_live_`.
5. Paste it into the card, and select **Connect Stripe**. Troopy checks the key with Stripe.

To try Troopy with test data, select **Or with test data**. That key starts with `rk_test_`.

Checkout Sessions and Payment Intents are optional. Without them, the key still connects, and Analytics says what it
misses.

### A key for Disputes

To let Troopy send the evidence of disputes, the key also needs Write on Disputes and on Files. With Disputes on, the
links of the card open the form with these set to Write. See [Answer payment disputes](/docs/disputes).

## Replace or disconnect

- **Replace key** puts a new key in the place of the old one. A new key can be of another account, so Customers reads it
  as new.
- **Disconnect** removes the key. Customers takes the subscriptions of Stripe off its customers. What happened stays in
  the events of each customer.

## Problems

| What you see                          | Why                                                          | What to do                                               |
| ------------------------------------- | ------------------------------------------------------------ | -------------------------------------------------------- |
| The card refuses the key              | It is not a restricted key, or a permission is missing.      | Make the key again from **Create the key in Stripe**.    |
| Analytics misses some revenue         | The key has no Read on Checkout Sessions or Payment Intents. | Make a new key with the two, and select **Replace key**. |
| Disputes cannot send evidence         | The key cannot write Disputes and Files.                     | Make a key with Write on the two, and replace the key.   |
| The Churn watcher has no Stripe tools | The business takes payments at another provider.             | Nothing to do: it reads Customers in their place.        |

## Related

- [Understand your customers](/docs/customers)
- [Answer payment disputes](/docs/disputes)
- [Set up website analytics](/docs/analytics)
- [Hire and manage teammates](/docs/teammates)
