# Connect Stripe to Limitr Cloud

> Charge your customers through your own Stripe account: connect Stripe in test and live, link and sync your Stripe customers, and how invoices, usage charges, and top-ups are charged.

# Stripe

Limitr Cloud keeps your customers' ledgers and makes their invoices from your policy. Stripe is how they're paid:
connect your own Stripe account, and Cloud charges each customer's default payment method.

- **Invoices** are charged when they close at the end of each period.
- **Usage** is charged as it happens when your policy says so (Ex. seats billed as they're added).
- **Top-ups** are charged when a customer buys one.

Who's charged is the [account](./customers#accounts): an org with users is charged one invoice for all of them,
and a customer on its own is charged its own. An account record can name another payer or send a Stripe invoice
with net terms instead.

## Connecting

Open **Integrations** and choose **Connect** next to **Test** or **Live**:

- **Test** connects a Stripe test (sandbox) account, for your test customers.
- **Live** connects your Stripe account, for live customers. It starts on [Pay as you go](./plans-and-billing).

Stripe asks you to sign in and approve the connection, then brings you back. Only the workspace's owner can connect
or disconnect Stripe. If the connection doesn't have full access, the page says so: reconnect it, or Cloud can't
charge with it.

## Linking customers

Customers are linked to Stripe customers by their Stripe customer ID. **Sync customers** links the customers already
in Stripe and adds the ones Limitr doesn't have yet:

1. A Stripe customer whose metadata has `limitr_customer_id` links to that Limitr customer, as does one whose ID
   matches a customer's ID or other IDs.
2. A linked customer gets the Stripe ID, email, and card brand and last four in its metadata.
3. A Stripe customer with no match is added on your default plan.

The sync reports how many were linked, added, already up to date, and failed. It needs the **Manage billing**
permission. Customers your app creates after that are added to Stripe when they're first charged.

## Payments

A customer's page shows their invoices and payments. **Billing settings** on that page can turn on manual billing
(you collect the money yourself) or approval before charges, for one customer. A payment waiting for approval has
**Approve**, a failed one has **Retry**, and a charge that succeeded (or a paid Stripe invoice) has **Refund** (all
of it or part, back the way it was paid; see [credits and refunds](./customers#credits-and-refunds)). A refund made in Stripe is recorded
too. To hear about payments as they happen, make a
[notification](./notifications) for "A payment fails" or "A payment waits for approval".

## Disconnecting

**Disconnect** stops Cloud charging that mode's customers through the account. Usage is still metered and invoices
still close, but charges fail until you connect again. Customers keep their Stripe IDs.
