# parsePaymentRequired

> Validate untrusted input (for example a decoded PAYMENT-REQUIRED header) and return it as a {@link PaymentRequired}.

```ts
import { parsePaymentRequired } from 'x402-avm-js';
```

```ts
export function parsePaymentRequired(value: unknown): PaymentRequired;
```

Validate untrusted input (for example a decoded PAYMENT-REQUIRED header) and return it as a
{@link PaymentRequired}. Every `accepts` entry must have string `scheme`, `network`, `asset`,
`amount` (a non-negative integer), `payTo`, and a numeric `maxTimeoutSeconds`.

## Parameters

- `value` (`unknown`, required):
Parsed JSON of unknown shape.

## Returns

- `returns` (`PaymentRequired`):

## Throws

- `InvalidPaymentRequiredError`: If the shape is wrong.

Source: [src/index.ts](https://github.com/x402-avm/x402-avm-js/blob/main/src/index.ts#L411)

Source: https://x402-avm.github.io/reference/js/parse-payment-required
