> 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`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://whitepaper.aitech.io/agentforge/blocks/x402_payment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
