x402 Pay icon

x402 Pay

Make an HTTP request to an x402-protected endpoint — automatically handles 402 payment flow

x402 Pay

AI-generated

Summary

Perform an HTTP GET or POST request to an x402-protected endpoint URL, automatically handling the required 402 payment flow by submitting the necessary payment details and retrying the request as configured.

Inputs

  • URL (required) — The x402-protected endpoint URL to call.
  • Method (required) — HTTP method for the request, either GET or POST.
  • Request Body (JSON) — JSON body to send with the POST request (ignored for GET).
  • Additional Headers — Additional HTTP headers to include in the request.
  • Max Retries — Maximum number of times to retry the payment flow if the payment process fails.

Output shape

a list of items where each item contains the JSON response from the endpoint call, including status code, response body, headers, and payment details if applicable

If the initial request returns a 402 status with payment requirements, the node performs the payment flow by signing a payment payload and retrying the request with payment headers. It throws an error if payment verification fails or if requests ultimately fail after configured retries.

Examples

Example 1: Making a GET request to an x402-protected API endpoint

Set URL to the endpoint, Method to GET, optionally add headers, and define Max Retries.

Example 2: Making a POST request with a JSON body and handling x402 payment

Provide URL, select POST method, specify the JSON request body, add any headers if needed, and configure Max Retries.

Links

Discussion