# Plans

What a person pays for lives at Buun Identity, product by product. A product asks for it each time it matters, with the access token it already holds.

![How a plan set in the staff console reaches a product](https://developers.buungroup.com/diagrams/a-plan-from-the-console-to-the-product.svg "themed")

## Reading a plan

```http
GET /oauth/plans
Authorization: Bearer <access token>
```

```json
{ "sub": "usr_...", "plans": [{ "product": "plotwork", "plan": "pro", "endsAt": null }] }
```

| Field | Meaning |
|---|---|
| `product` | A product id from `@buun-group/core`: `plotwork`, `flung`, `gunspec`, `destroy`, `cryptflare` |
| `plan` | The plan's name, lower case, such as `pro` |
| `endsAt` | When it ends, in milliseconds since the epoch, or null for no end |

The address is also in the issuer's metadata as `buun_plans_endpoint`.

## Who is told what

| Calling client | Told |
|---|---|
| A Buun Group product's own client | That product's plan, and no other |
| Another company's client | None |

Only a plan that is active and has not ended is listed. It is read at the moment of asking, so a plan staff cancel is gone at the next request. Never keep a plan in a token or a long cache.

## Setting a plan

Until billing is built, staff set a plan by hand in the staff console: People, the person, Plans. The gateway's [token exchange](https://developers.buungroup.com/mcp/token-exchange) checks the same plan before it lets an agent reach a product.

Source: https://developers.buungroup.com/sign-in/plans
