# Stripe

> Let signed-in customers self-serve billing in chat — view subscriptions and invoices, cancel or reactivate, and update billing details. Every Stripe action is bound to the customer's verified identity.

The Stripe connector turns billing questions into self-service. A signed-in customer can ask "what plan am I on?", "show my invoices", "cancel my subscription", or "update my billing email" — and the agent answers and acts using live Stripe data, scoped to that one customer.

> **IDENTITY VERIFICATION IS REQUIRED:** Stripe actions are **only** available to a verified, signed-in customer. The agent never accepts a customer id from the conversation — it resolves the Stripe customer from the signed [identity](/docs/developers/identity-verification) you pass with `identify()`. A visitor with no verified Stripe account simply can't reach billing data.

## How it works

1. **Connect Stripe** — On the agent's **Integrations** tab, connect Stripe with a restricted **secret key**. It's encrypted at rest and scoped to this agent.
2. **Verify the customer** — On your site, identify the logged-in user with `window.bookbag("identify", …)` and include their Stripe customer id in the signed claims. This links the chat visitor to their Stripe account — tamper-proof.
3. **Add the Stripe actions** — On the agent's Actions tab, add the Stripe capabilities you want (subscriptions, invoices, manage, change billing) and describe when the agent should use each.

> **LINKING THE STRIPE CUSTOMER:** The verified Stripe account lives on the [contact](/docs/contacts/overview) as `stripe_accounts` — a list of `{ label, stripe_id, stripe_email }`. It's treated as sensitive: it's never echoed to the model, only used server-side to scope Stripe calls.

## Available actions

| Action | What it does |
| --- | --- |
| Get subscription | Returns the customer's subscription(s): plan, status, price, renewal date, and whether it's set to cancel. |
| Get invoices | Lists recent invoices with amount, status, and a link to the hosted invoice / PDF. |
| Manage subscription | Cancels at period end or reactivates a pending cancel. State-mutating — asks the customer to confirm first. |
| Change billing | Updates the customer's billing email, name, phone, or address. |

> **OWNERSHIP IS ENFORCED:** Before changing a subscription, Bookbag re-checks that it belongs to the verified customer. One customer can never read or modify another's billing — even if a subscription id leaks into the conversation.

## Testing

Like Chatbase, Stripe actions don't run in the Playground or action preview — they need a real, identity-verified session. Embed the widget on your site, sign in a test customer with a Stripe id in the identity claims, and try the actions there. Use a Stripe test-mode key while you develop.

## What's next

- [Identity verification](/docs/developers/identity-verification) — The signed identify() call that powers Stripe actions.
- [Contacts](/docs/contacts/overview) — Where the verified Stripe account is stored.
- [Actions overview](/docs/actions/overview) — How the agent decides when to call an action.
