# withIntentExtension

withIntentExtension in @provenanceauth/rails/x402, Rails. Add the extension to a `PaymentRequired` your x402 server already builds (returns a new object; other extensions are kept).

## Signature

```ts
withIntentExtension(paymentRequired: X402PaymentRequired, opts?: { required?: boolean; profile?: DiscoveryBlock }): X402PaymentRequired
```

## Parameters

- `paymentRequired` (X402PaymentRequired)
- `opts` ({ required?: boolean; profile?: DiscoveryBlock }, optional)

## Returns

`X402PaymentRequired`

Runs locally, with no request to the API.
