# PaymentRequirements

> Payment requirements specified by an x402 server.

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

```ts
export interface PaymentRequirements {
  scheme: string;
  network: string;
  asset: string;
  amount: string;
  payTo: string;
  maxTimeoutSeconds: number;
  extra?: {
    feePayer?: string;
    decimals?: number;
    genesisHash?: string;
    genesisId?: string;
    [key: string]: unknown;
  };
}
```

Payment requirements specified by an x402 server.

Defines the scheme, CAIP-2 network, asset ID (0 for ALGO), amount in base units,
recipient address, timeout, and optional extra metadata such as fee payer and token decimals.

## Properties

- `scheme` (`string`, required):
Payment scheme identifier. x402-avm-js builds payments for `"exact"`.

- `network` (`string`, required):
CAIP-2 network id, for example `algorand:wGHE2Pwdvd7S12BL5FaOP20EGYesN73k` for MainNet.

- `asset` (`string`, required):
Asset id as a string: `"0"` for native ALGO, otherwise the ASA id (for example `"31566704"` for USDC on MainNet).

- `amount` (`string`, required):
Amount in the asset's base units (microALGO for ALGO), as a string.

- `payTo` (`string`, required):
Algorand address (58 characters) that receives the payment.

- `maxTimeoutSeconds` (`number`, required):
Maximum time, in seconds, the server allows for the payment.

- `extra` (`object`):
Optional scheme metadata sent by the server.

- `feePayer` (`string`):
Address of the server account that pays the group's fees. When present, `buildExactAvmGroup` builds the two-transaction group.

- `decimals` (`number`):
Decimals of the asset.

- `genesisHash` (`string`):
Base64 genesis hash of the network.

- `genesisId` (`string`):
Genesis id of the network, for example `mainnet-v1.0`.

- `[key: string]` (`unknown`):
Any other field the server sends.

## Example

```ts
const req: PaymentRequirements = {
  scheme: 'exact',
  network: 'algorand:wGHE2Pwdvd7S12BL5FaOP20EGYesN73k',
  asset: '0',
  amount: '5000',
  payTo: 'DN74O524ODU54DND7U42G3...LN7L7Y',
  maxTimeoutSeconds: 300,
  extra: { feePayer: 'FEEPAYER...' }
};
```

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

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