# Stripe billing

The agent reads a verified customer's billing from your Stripe account: subscriptions, recent invoices, and recent payments. Your team sees the same beside each ticket. With write access, your team can also refund payments and change subscriptions from a ticket, and the agent can propose them. Everything goes through a restricted key you create; there's nothing to build.

## Connecting

1. In Stripe, open **Developers → API keys** and create a **restricted key**.
2. Give it **Read** access to Customers, Subscriptions, Invoices, Charges, Payment Methods, and Products, and **None** for everything else.
3. For refunds and subscription changes, also give it **Write** access to Refunds and to Subscriptions. Leave them at Read to keep answerable read-only.
4. Under **Integrations → Customer accounts → Billing**, choose **Connect Stripe** and paste the key.

answerable refuses full secret keys (`sk_…`) and checks the key's permissions when you save it. The key is stored encrypted and never shown again. A test-mode key (`rk_test_…`) reads Stripe's test data, labelled as such.

## Which customer

- **With [your product connected](https://staging.preview.answerable.co/docs/integrations/your-product.md):** when its lookup knows the person, answerable reads only the Stripe customer in its `stripe_customer_id`. Leave that out for anyone who may not see that customer's billing in your product, such as a team member who isn't an owner or admin, and answerable reads nothing from Stripe for them. An email match doesn't get around it.
- **Otherwise,** when your product isn't connected or its lookup doesn't know the address, answerable reads up to three Stripe customers with the customer's email address.

## What the agent sees

- Subscriptions: plan, price, status, and when it renews, cancels, or its trial ends.
- Recent invoices: number, status, amounts, and dates, with the invoice page Stripe hosts for the customer.
- Recent payments: amount, status, refunds, and why a payment failed.
- Cards only as the brand and last four digits.

Nothing from Stripe is stored in answerable.

## Actions

With write access, these can be taken for the ticket's customer once they're turned on under **Integrations → Actions**, where each starts Off: Team only for your team to take from a ticket's **Take an action…**, or Needs approval or On its own for the agent to propose it too:

| Action | Needs | Kind |
| --- | --- | --- |
| Refund a payment, in full or in part | Refunds: Write | Moves money |
| Cancel at the end of the period | Subscriptions: Write | Change |
| Cancel now, without a refund | Subscriptions: Write | Irreversible change |
| Undo a cancellation | Subscriptions: Write | Change |
| Pause payments | Subscriptions: Write | Change |
| Resume payments | Subscriptions: Write | Change |
| Extend a trial, by up to 30 days at a time | Subscriptions: Write | Change |

Each one offers the customer's own payments or subscriptions, found the same way as their billing, and is checked again against Stripe just before it runs: a refund never takes more than what's left of the payment. Each request carries an idempotency key, so one that's sent again isn't done twice, and the ticket's history links to the payment or subscription in Stripe. An action the key can't do says which access it needs; give the key that access in Stripe and connect it again.

Actions are never offered to the agent for a sender who isn't verified, and it takes one on its own only when it's set to On its own, refunds only up to the limit you set, and never while the workspace is in test mode, when its replies aren't emailed either. Turn off what doesn't fit your product, such as the subscription actions when you don't sell subscriptions, and it never shows on a ticket.
