# Stripe

> Stripe billing and payments via the official SDK.

Lets an agent read and create resources in Stripe.

## What it can do

| Method | What it does |
| --- | --- |
| `stripe_list_customers` | List Stripe customers; filter by email, paginate via starting_after. |
| `stripe_get_customer` | Get a customer by id. |
| `stripe_create_customer` | Create a customer. |
| `stripe_list_payment_intents` | List PaymentIntents. |
| `stripe_get_payment_intent` | Get a PaymentIntent by id. |
| `stripe_list_charges` | List charges. |
| `stripe_get_charge` | Get a charge by id. |
| `stripe_get_balance` | Get the account balance. |
| `stripe_create_payment_intent` | Create a PaymentIntent - amount in minor units, currency in lowercase ISO. |
| `stripe_create_refund` | Create a refund - needs charge_id or payment_intent_id; amount optional for partial refund. |

## How to get credentials

Use a **Restricted key** with only the permissions the agent needs - do
not paste your full secret key.

1. Open [dashboard.stripe.com/apikeys](https://dashboard.stripe.com/apikeys).
2. **Create restricted key**, name it (e.g. *FlyMyAI Agent*).
3. Grant permissions: typically *Write* on Customers, Payment Intents,
   Refunds; *Read* on Balance and Charges.
4. Copy the `rk_…` (or `sk_…` if you chose a full secret key).

Use the **test** key (`rk_test_…` / `sk_test_…`) first - all the same
actions work on the Stripe test mode.

## Fields to fill in FlyMyAI

| FlyMyAI field | Where it comes from |
| --- | --- |
| `STRIPE_SECRET_KEY` | Dashboard → API keys → Restricted key |
| `STRIPE_ACCOUNT` *(optional)* | Connected account id (`acct_…`) |

## Troubleshooting

- **`permission_error`** - the restricted key is missing the scope.
  Edit the key and add the permission.
- **Objects missing** - you're in the wrong mode. Test keys only see
  test data; live keys only see live data.

## Links

- [Stripe API keys](https://dashboard.stripe.com/apikeys)
- [API reference](https://stripe.com/docs/api)
