> For the complete documentation index, see [llms.txt](https://whitepaper.aitech.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://whitepaper.aitech.io/agentforge/blocks/x402_payment.md).

# x402\_payment

The x402 Payment block calls endpoints protected by the x402 payment protocol. It can inspect endpoint pricing, authorize a payment session from a connected wallet, and execute a paid POST request during workflow runs.

{% hint style="warning" %}
x402 Payment can authorize paid requests. Review endpoint pricing and wallet configuration before using this block in production workflows.
{% endhint %}

### Overview

Use the x402 Payment block when a workflow needs to access paid HTTP resources that challenge clients with x402 payment requirements.

The block supports:

* **Payment precheck** - Inspect endpoint pricing and payment challenge metadata
* **Wallet authorization** - Connect a wallet and authorize a payment session
* **Paid execution** - Send the POST request with payment authorization
* **Deployment support** - Reuse an authorized payment session during deployed workflow runs

### Configuration Options

#### Payment Access

The payment access control handles wallet connection, endpoint precheck, and authorization state for the block.

#### Endpoint

The x402-protected endpoint URL to call.

#### Body

The JSON request body to send to the paid endpoint.

### How It Works

{% stepper %}
{% step %}
Enter the x402-protected endpoint and request body.
{% endstep %}

{% step %}
Connect a wallet for the block.
{% endstep %}

{% step %}
Test the endpoint pricing challenge.
{% endstep %}

{% step %}
Authorize the payment session.
{% endstep %}

{% step %}
Run the workflow to execute the paid POST request.
{% endstep %}
{% endstepper %}

### Inputs and Outputs

#### Input

| Parameter  | Type   | Description                               |
| ---------- | ------ | ----------------------------------------- |
| `endpoint` | string | x402-protected endpoint URL               |
| `body`     | json   | JSON request body to POST to the endpoint |

#### Output

| Parameter         | Type   | Description                                 |
| ----------------- | ------ | ------------------------------------------- |
| `data`            | any    | Response body returned by the paid endpoint |
| `status`          | number | Final HTTP status code                      |
| `headers`         | json   | Final response headers                      |
| `paymentRequired` | json   | Decoded payment challenge metadata          |
| `paymentResponse` | json   | Decoded settlement response metadata        |
| `cost`            | json   | Network, asset, amount, and pay-to details  |

### Notes

* Category: `blocks`
* Type: `x402_payment`
