# When a grant changes

Show the adjust link your agent gets when an order is over a limit, retry once the person changes the grant, cap how far they can raise it with hard_max, and read the change on the webhook.

When your agent's order is outside a [network grant](https://provenanceauth.com/docs/mandate/concepts/network-grants.md) and a different limit would let it through, the response carries an **adjust link**. The person opens it, sees the limit that stopped the order and a suggested value, and can raise or lower the limit, approve this one order, or both in one passkey step. Then your agent retries.

**Before you begin:** your agent holds a network grant for the person and buys with [`POST /v1/mandate/network_orders`](https://provenanceauth.com/docs/api/network.md#post-v1-mandate-network-orders).

## What your agent gets

An order over the per-order cap or the budget, at a store that isn't listed, or in a category that isn't allowed asks the person, and the response adds `adjust` and `retry`:

```json
{
  "object": "network_authorization",
  "result": "approval_required",
  "reason": "over_max_amount",
  "approval": { "id": "noa_01M5X9A2B7Q9V3N8K4T6W1Y0R6", "status": "pending" },
  "adjust": { "url": "https://app.provenanceauth.com/me/adjust?token=3r8Vx2pL0mW8sYd4cFjLhXn6gAe1pR5zT7uB3oN1yJ0", "expires_at": "2026-11-24T18:15:00.000Z" },
  "retry": "after_adjust"
}
```

- `adjust.url` (string): The link to show the person. It works once, with no sign-in to read it. Show it as is; don't shorten or rewrite it.
- `adjust.expires_at` (string): An ask's link lasts as long as the ask (15 minutes), a refusal's 30 minutes.
- `retry` (string): `after_adjust` means retry the same order once the person acts.

A refusal the person controls carries the link too: a store on the grant's own blocked list, a paused grant, or an order above your `hard_max` (`over_ceiling`). There is no link for the person's own rules (Ask me above, hours), a session's limits, a blocked agent or a revoked grant.

The same cart asked again returns the same link, and the person isn't asked twice.

## Retry after the person acts

| What the person did | How your agent continues |
| --- | --- |
| Approved the order (with or without a raise) | Retry with `approval_id`. The token is minted once for that cart. |
| Changed the limit without approving | Retry the order as a fresh request. It passes the new limit or asks again. |
| Nothing yet | The ask stays pending until it expires; a retry with `approval_id` still works if they approve later. |

Three ways to know when to retry:

1. The `mandate.network_grant.updated` webhook with the new `version`.
2. [`GET /v1/mandate/network_grants/{id}`](https://provenanceauth.com/docs/api/network.md#get-v1-mandate-network-grants-id), whose `version` goes up on every change.
3. A note on your agent's next call: "Your limit for this grant changed", delivered once.

The TypeScript SDK waits for you:

```ts
const grant = await provenance.mandate.network.waitForGrantChange(grantId, version);
if (grant) {
  // The person changed it: retry the order.
}
```

It polls with backoff from 1 to 15 seconds and returns `null` after 15 minutes.

## Cap raises with hard_max

A person may raise a limit above what you asked for, with their passkey. To set a line they can't pass, send `hard_max` on the grant request. It can't be below `proposed`; leave it out for no ceiling.

```json
{
  "agent_id": "agt_01M6VQDE86B7XMS0EDMWPT9K0S",
  "proposed": { "max_amount": 50, "budget_amount": 200, "budget_window": "week", "currency": "USD", "expires_at": "2027-06-30T00:00:00Z" },
  "hard_max": { "max_amount": 100, "budget_amount": 400 }
}
```

An order above `hard_max` is refused `over_ceiling`. Its link lets the person ask your agent to request more: your agent gets a note, and a new grant request with a higher `hard_max` is the way up. Stores and categories you blocked stay blocked whatever the person does.

## Stores the person adds or removes

The person's home lists the stores each agent may buy at and its last purchase. From a grant they can remove a store, which saves at once, or add one back. Adding a store is a raise: it needs their passkey and only a store your request asked for. Either change reaches you as `mandate.network_grant.updated` with the grant's new `allowed_stores`.

## How long a raise lasts

The person picks one when they raise a limit:

| Choice | `duration` | Ends |
| --- | --- | --- |
| Just this time | `one_order` | At the next authorized order that needs it, or after 24 hours. On an ask, it's the one-order approval with no limit change. |
| Until the window ends | `window` | At the start of the next weekly or monthly budget window. |
| From now on | `ongoing` | Never. |

When a temporary raise ends, the grant goes back to its earlier limits and you get `mandate.network_grant.updated` with `trigger: revert`. If the person changed the grant again before then, their later change stands.

## The webhook

Every change to the grant's limits or status sends `mandate.network_grant.updated`:

- `version` (integer): The grant's version after the change.
- `direction` (string): `tighten` or `loosen`.
- `trigger` (string): What led to it: an ask, a refusal, a notice, the person's own change, or a revert.
- `trigger_ref` (string): The ask or raise it came from.
- `duration` (string): For a temporary raise, with `temporary_until`.
- `above_ask` (boolean): True when a limit now passes what you asked for.
- `via` (string): `person` or `system` (an automatic revert). Never the person's device.

## The card an order pays with

Send `payment_method` on `POST /v1/mandate/network_orders` when you know the card. Never send a card number; it's refused with `parameter_invalid`. The card joins the person's card list, so they can see which agent paid with it.

- `brand` (string, required): `visa`, `mastercard`, `amex`, `discover`, `jcb`, `unionpay`, `diners` or `other`.
- `last4` (string, required): The card's last four digits.
- `wallet` (string): The wallet it pays through, such as `apple_pay`.
- `network_token` (boolean): True when the card is a network agent token.

A person can tie a grant to one card. An order that names a different card asks the person with the reason `payment_card_mismatch`; show `approve_url` as for any ask. An order without `payment_method` isn't checked against the card.

## Integration checklist

- Show `adjust.url` to the person whenever it's present.
- Retry after an adjust: with `approval_id` for an approved order, fresh otherwise.
- Handle `mandate.network_grant.updated`, or call `waitForGrantChange`.
- Send `hard_max` if you need a line people can't raise past.
- Expect `over_ceiling` and offer a new grant request.

## Errors you might see

| Code | What to do |
| --- | --- |
| `over_ceiling` (refusal reason) | The order is above your `hard_max`. Offer the person a new grant request with a higher one. |
| `order_denied` | The person denied the order from the link. Don't retry it. |
| `order_approval_expired` | The ask expired before the person answered. Ask again with a fresh request. |
| `parameter_invalid` | A `hard_max` below `proposed`, or one for a limit `proposed` leaves out. |

## See also

- [Near-limit notices](https://provenanceauth.com/docs/mandate/guides/near-limit-notices.md)
- [Receive notes from people](https://provenanceauth.com/docs/mandate/guides/receive-notes-from-people.md)
