> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stateset.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Complete an x402 payment

> Learn how to complete an x402 payment from 402 to receipt.

# Complete an x402 payment

This tutorial walks you through a full x402 payment from HTTP 402 to receipt verification.

## Prerequisites

* Access to a paywalled endpoint that returns HTTP 402
* A signer capable of Ed25519 signatures
* Sequencer endpoint URL

## Step 1: Request a protected resource

Call the resource endpoint and capture the `X-Payment-Required` header.

## Step 2: Build and sign an intent

Create an `X402PaymentIntent` with payer/payee, amount, network, and validity window. Sign with the `X402_PAYMENT_V1` domain separator.

## Step 3: Retry with X-Payment

Retry the request with the signed intent in the `X-Payment` header.

## Step 4: Sequence the intent

Submit the intent to the sequencer for batching and settlement.

## Step 5: Fetch receipt and verify

Request the receipt and verify inclusion proof against the on-chain batch commitment.

## Next steps

* [Sequencer x402 Payments](/stateset-sequencer-x402)
* [Set L2 Verification](/stateset-set-l2-verification)
