> ## Documentation Index
> Fetch the complete documentation index at: https://wiredesk.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Stripe billing

> Let the agent answer a customer's billing questions from Stripe: their plan, their invoices, cancelling, and the card on file. Only ever about their own account.

A **Stripe billing** action lets the agent answer "what plan am I on?", "send me my last invoice", "cancel my subscription" and "my card expired" from your Stripe account, on a call, in chat or by email. It needs [Stripe connected](https://wiredesk.ai/docs/integrations/stripe.md) to the agent first.

## What it can do

Tick what the agent may do. Everything is ticked when you add the action.

| Tick | What the agent does |
| - | - |
| **Look up their plan and when it renews** | Says the plan, its status and price, and when it renews, ends or leaves its trial. |
| **List recent invoices, with links** | The last five invoices: amount, date, and whether each is paid. In chat and email it shares each invoice's Stripe link; on a call it reads the amounts and dates. |
| **Cancel at the end of the paid period** | Sets the subscription to end when the period they've paid for runs out. Nothing is refunded and nothing stops today. The agent explains that and waits for a clear yes first. |
| **Send a link to update the card on file** | A short-lived link into your Stripe customer portal, opened on "update payment method". On a call, the agent emails it to them instead. |

## Who it answers for

The agent only ever answers about **the customer's own account**, found by their email address in Stripe. That address has to be proved, one of three ways:

* **A verified visitor whose email you signed.** In chat, a [verified visitor](https://wiredesk.ai/docs/widget/verified-visitors.md) is proved by their email only when your server signs the email too, with `email_hash`. Signing the user id alone does not prove the email, because the page could put any address beside it, so those visitors are asked for a code like anyone else.
* **The email they wrote from.** On email, the agent's reply only goes back to that mailbox, so it is proved for reading. **Cancelling by email** still needs a fresh code, because anyone can put someone else's address on an email and reply into their thread: one sent in the last 10 minutes, and used up by the cancellation. An older code on the thread does not count.
* **A code.** Anyone else, including every caller, is asked for the email on their account. The agent emails a 6-digit code there, and they read it out or type it back. Codes last 10 minutes; a conversation can ask for three, and five wrong tries spend a code. Once read back, a code proves the address for 30 minutes, and only to whoever read it back in that conversation. A code wins over a signed email or the address they wrote from, so a customer whose billing address is a different one can prove that one and ask about it.

The agent says a code is on its way whether or not the address has an account, and only sends one when it has. So asking can't reveal who your customers are.

If one email has several Stripe customers, the agent sees the subscriptions and invoices of up to three of them.

## Set it up

**1. Connect Stripe**

See [Stripe](https://wiredesk.ai/docs/integrations/stripe.md) for the restricted key and its permissions.

**2. Add the action**

**Agents → your agent → Actions → Add action → Stripe billing**. Tick what the agent may do.

**3. Choose where the card link returns (optional)**

**Back to your site after updating the card** is where Stripe sends them afterwards. Leave it empty to use your customer portal's own return link.

**4. Pick channels and save**

Each agent has one Stripe billing action. Edit it to change what's ticked.

## When something goes wrong

If Stripe refuses the key, for example because it lacks a permission, or can't be reached, the agent offers to take a message, and the Stripe card on **Actions › Connections** shows **Last request failed** with Stripe's reason. It clears the next time a request goes through. When Stripe turns down one request but the key is fine, for example a plan that no longer exists, the agent tells the customer and the card is left alone.

Every lookup appears in the action log with its tool name: `stripe_get_subscription`, `stripe_list_invoices`, `stripe_cancel_subscription`, `stripe_payment_method_link`, `send_verification_code` and `check_verification_code`.

## Related

* [Stripe](https://wiredesk.ai/docs/integrations/stripe.md)
* [Verified visitors](https://wiredesk.ai/docs/widget/verified-visitors.md)
* [Actions overview](https://wiredesk.ai/docs/actions/overview.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.