|
| 1 | +--- |
| 2 | +title: HPP Facilitator |
| 3 | +sidebar_label: Facilitator |
| 4 | +description: HPP's hosted x402 facilitator — verify and settle USDC.e payments on HPP Mainnet and Sepolia, with gasless upto settlement. |
| 5 | +--- |
| 6 | + |
| 7 | +import Tabs from '@theme/Tabs'; |
| 8 | +import TabItem from '@theme/TabItem'; |
| 9 | + |
| 10 | +# HPP Facilitator |
| 11 | + |
| 12 | +A **facilitator** is the service an x402 resource server delegates payment **verification** and |
| 13 | +**onchain settlement** to. HPP operates production facilitators for both its Mainnet and Sepolia |
| 14 | +networks, so sellers never have to run an RPC node, manage a settlement key, or hold buyer funds — |
| 15 | +the facilitator only verifies signatures and submits the settlement transaction. |
| 16 | + |
| 17 | +## Endpoints |
| 18 | + |
| 19 | +| Network | Base URL | |
| 20 | +| --- | --- | |
| 21 | +| HPP Mainnet (`eip155:190415`) | `https://facilitator.hpp.io` | |
| 22 | +| HPP Sepolia (`eip155:181228`) | `https://facilitator-sepolia.hpp.io` | |
| 23 | + |
| 24 | +Each facilitator exposes the standard x402 facilitator API: |
| 25 | + |
| 26 | +| Route | Method | Purpose | |
| 27 | +| --- | --- | --- | |
| 28 | +| `/supported` | `GET` | Lists the `(scheme, network)` pairs and extensions the facilitator supports. | |
| 29 | +| `/verify` | `POST` | Verifies a signed payment payload without settling. | |
| 30 | +| `/settle` | `POST` | Submits the payment onchain and returns a settlement receipt. | |
| 31 | + |
| 32 | +**CORS is enabled**, so browser-based clients can call the facilitator directly. |
| 33 | + |
| 34 | +You can confirm what a facilitator supports at any time: |
| 35 | + |
| 36 | +```bash |
| 37 | +curl https://facilitator.hpp.io/supported |
| 38 | +``` |
| 39 | + |
| 40 | +```json |
| 41 | +{ |
| 42 | + "kinds": [ |
| 43 | + { "x402Version": 2, "scheme": "exact", "network": "eip155:190415" }, |
| 44 | + { "x402Version": 2, "scheme": "upto", "network": "eip155:190415", |
| 45 | + "extra": { "facilitatorAddress": "0xaA03c7BD2fAf554db507D78CD3bF126a3DD2E033" } } |
| 46 | + ], |
| 47 | + "extensions": ["eip2612GasSponsoring"], |
| 48 | + "signers": { "eip155:*": ["0xaA03c7BD2fAf554db507D78CD3bF126a3DD2E033"] } |
| 49 | +} |
| 50 | +``` |
| 51 | + |
| 52 | +The Sepolia facilitator (`https://facilitator-sepolia.hpp.io/supported`) returns the same shape with |
| 53 | +`network: "eip155:181228"` and its own signer `0x420bd05aB1103b0F4A02B39Ca07C92677b5CFD9d`. |
| 54 | + |
| 55 | +## Supported schemes |
| 56 | + |
| 57 | +| Scheme | Standard | Notes | |
| 58 | +| --- | --- | --- | |
| 59 | +| `exact` | EIP-3009 (`transferWithAuthorization`) | Fixed-price payments. | |
| 60 | +| `upto` | Permit2 | Authorize a maximum, settle the actual amount. Supports gasless settlement. | |
| 61 | + |
| 62 | +Both schemes settle in **USDC.e** (`0x401eCb1D350407f13ba348573E5630B83638E30D`, 6 decimals) on both |
| 63 | +networks. See [How it works → Payment schemes](./how-it-works.md#payment-schemes). |
| 64 | + |
| 65 | +## Connecting to it |
| 66 | + |
| 67 | +You don't call the facilitator directly in normal use — your resource server does. Point a |
| 68 | +facilitator client at the right base URL: |
| 69 | + |
| 70 | +```ts |
| 71 | +import { HTTPFacilitatorClient } from "@x402/core/server"; |
| 72 | + |
| 73 | +// HPP Mainnet |
| 74 | +const facilitator = new HTTPFacilitatorClient({ url: "https://facilitator.hpp.io" }); |
| 75 | +// HPP Sepolia |
| 76 | +// const facilitator = new HTTPFacilitatorClient({ url: "https://facilitator-sepolia.hpp.io" }); |
| 77 | +``` |
| 78 | + |
| 79 | +Then register your schemes against it — see [Quickstart: Sellers](./quickstart-sellers.mdx). Buyers |
| 80 | +never configure the facilitator at all; they discover it implicitly from the seller's `402` challenge. |
| 81 | + |
| 82 | +## Verify and settle |
| 83 | + |
| 84 | +`HTTPFacilitatorClient` wraps the two POST endpoints. Both take the same body — the buyer's signed |
| 85 | +`paymentPayload` plus the `paymentRequirements` it is paying — and the SDK calls them for you during |
| 86 | +`paymentMiddleware`. The shapes: |
| 87 | + |
| 88 | +```jsonc |
| 89 | +// POST /verify and POST /settle request |
| 90 | +{ |
| 91 | + "x402Version": 2, |
| 92 | + "paymentPayload": { /* the decoded X-PAYMENT payload the buyer signed */ }, |
| 93 | + "paymentRequirements": { /* the matching accept from the 402 */ } |
| 94 | +} |
| 95 | +``` |
| 96 | + |
| 97 | +```jsonc |
| 98 | +// POST /verify response — checks the signature WITHOUT moving funds |
| 99 | +{ "isValid": true, "payer": "0x…" } |
| 100 | +// on failure: { "isValid": false, "invalidReason": "...", "invalidMessage": "..." } |
| 101 | +``` |
| 102 | + |
| 103 | +```jsonc |
| 104 | +// POST /settle response — submits the payment onchain |
| 105 | +{ |
| 106 | + "success": true, |
| 107 | + "transaction": "0x…", // settlement tx hash |
| 108 | + "network": "eip155:190415", |
| 109 | + "payer": "0x…", |
| 110 | + "amount": "10000" // actual amount settled (for `upto`, ≤ the max) |
| 111 | +} |
| 112 | +// on failure: { "success": false, "errorReason": "...", "errorMessage": "...", "transaction": "0x…" } |
| 113 | +``` |
| 114 | + |
| 115 | +In the SDK, a failed `/verify` or `/settle` surfaces **to the resource server** as `VerifyError` or |
| 116 | +`SettleError` (exported from `@x402/core`), carrying `invalidReason` / `errorReason` for branching. |
| 117 | +Buyers don't see these types — they get a non-2xx response instead (see |
| 118 | +[Quickstart: Buyers → Handling failures](./quickstart-buyers.mdx#handling-failures)). |
| 119 | + |
| 120 | +## Gasless settlement (`upto`) |
| 121 | + |
| 122 | +For the `upto` scheme, HPP's facilitator advertises the **`eip2612GasSponsoring`** extension. This |
| 123 | +lets the facilitator sponsor the buyer's one-time Permit2 approval via |
| 124 | +[EIP-2612](https://eips.ethereum.org/EIPS/eip-2612), so a paying agent needs **only USDC.e and zero |
| 125 | +native ETH** to transact. |
| 126 | + |
| 127 | +The **sponsoring signer** — the facilitator's onchain address that pays gas and submits settlement — |
| 128 | +is the same value shown as `signers` and as the `upto` `facilitatorAddress` in `/supported`: |
| 129 | + |
| 130 | +| Network | Sponsoring signer (`facilitatorAddress`) | |
| 131 | +| --- | --- | |
| 132 | +| HPP Mainnet | `0xaA03c7BD2fAf554db507D78CD3bF126a3DD2E033` | |
| 133 | +| HPP Sepolia | `0x420bd05aB1103b0F4A02B39Ca07C92677b5CFD9d` | |
| 134 | + |
| 135 | +When a seller offers an `upto` route, the SDK surfaces the `facilitatorAddress` and the |
| 136 | +`eip2612GasSponsoring` extension in the `402` challenge automatically, and a compatible buyer signs |
| 137 | +the gasless approval path with no extra configuration. |
| 138 | + |
| 139 | +## Self-hosting |
| 140 | + |
| 141 | +HPP's facilitator is a deployment of the standard open-source x402 facilitator, so you are not locked |
| 142 | +in: you can run your own and point your resource server at it instead. Use HPP's hosted endpoints to |
| 143 | +get started, and self-host if you need custom signing keys, private RPC, or independent operations. |
| 144 | +See the [x402 SDK & reference](./sdk.md) for the upstream packages. |
| 145 | + |
| 146 | +## Quick reference |
| 147 | + |
| 148 | +| Field | HPP Mainnet | HPP Sepolia | |
| 149 | +| --- | --- | --- | |
| 150 | +| Facilitator URL | `https://facilitator.hpp.io` | `https://facilitator-sepolia.hpp.io` | |
| 151 | +| Network (CAIP-2) | `eip155:190415` | `eip155:181228` | |
| 152 | +| Token (USDC.e) | `0x401eCb1D350407f13ba348573E5630B83638E30D` | `0x401eCb1D350407f13ba348573E5630B83638E30D` | |
| 153 | +| Schemes | `exact`, `upto` | `exact`, `upto` | |
| 154 | +| Gasless extension | `eip2612GasSponsoring` | `eip2612GasSponsoring` | |
| 155 | +| Sponsor signer | `0xaA03c7BD2fAf554db507D78CD3bF126a3DD2E033` | `0x420bd05aB1103b0F4A02B39Ca07C92677b5CFD9d` | |
0 commit comments