You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/portal/src/app/payments/x402/page.mdx
+22-22Lines changed: 22 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,20 +1,20 @@
1
1
import { ArticleIconCard } from"@doc";
2
2
import { ReactIcon } from"@/icons";
3
3
4
-
# x402 payments
4
+
# 402 Gated Payments
5
5
6
-
Implement paid API calls using the x402 protocol. Every request is paid for by the user with a micro payment onchain.
6
+
Implement gated API access with pay-per-request pricing. Users pay small amounts for each API call using cryptocurrency through the HTTP 402 Payment Required protocol.
7
7
8
8
<ArticleIconCard
9
-
title="x402 Playground"
10
-
description="Try out a x402 payment in our live playground"
9
+
title="402 Payments Playground"
10
+
description="Try out a 402 gated payment in our live playground"
The **x402 payment protocol**enables micropayments for API access, allowing developers to monetize their APIs with per-request pricing. Instead of traditional subscription models or API keys, users pay small amounts (typically $0.01-$0.10) for each API call using cryptocurrency.
17
+
**402 gated payments**enable micropayments for API access using the HTTP 402 Payment Required status code, allowing developers to monetize their APIs with per-request pricing. Instead of traditional subscription models or API keys, users pay small amounts (typically $0.01-$0.10) for each API call using cryptocurrency.
18
18
19
19
### How it works
20
20
When a user makes a request to a paid API:
@@ -30,27 +30,27 @@ When a user makes a request to a paid API:
30
30
-**Instant monetization**: Start earning from your APIs immediately
31
31
-**Micropayment friendly**: Perfect for small, frequent transactions
32
32
33
-
## X402 Protocol Fundamentals
33
+
## 402 Payment Protocol Fundamentals
34
34
35
35
### Payment Flow
36
-
The x402 protocol follows a simple request-retry pattern:
36
+
The 402 payment protocol follows a simple request-retry pattern:
37
37
38
38
1.**Initial request**: Client makes normal API call
39
39
2.**402 response**: Server responds with payment requirements if payment needed
40
40
3.**Payment authorization**: User signs payment message in their wallet
41
41
4.**Retry with payment**: Request is retried with payment header
42
42
5.**Content delivery**: Server validates payment and returns content
43
43
44
-
### Facilitators
45
-
A **facilitator** is a service that handles payment verification and settlement for x402 payments. Think of it as the payment processor that:
44
+
### Payment Processors
45
+
A **payment processor** is a service that handles payment verification and settlement for 402 payments. Think of it as the backend service that:
46
46
- Validates payment signatures from users
47
47
- Executes on-chain transfers to collect payments
48
48
- Provides payment infrastructure to API providers
- Additional schemes (percentage-based, auction-style, variable pricing) are planned for future versions
54
54
55
55
### Security Model
56
56
-**Signature-based**: Users sign payment authorizations, no direct token transfers from client
@@ -60,7 +60,7 @@ Currently, x402 supports:
60
60
## Supported Payment Networks & Tokens
61
61
62
62
### Supported Networks
63
-
thirdweb's x402 facilitator currently supports payments on:
63
+
thirdweb's 402 payment processor currently supports payments on:
64
64
-**Base** (mainnet)
65
65
-**Base Sepolia** (testnet)
66
66
-**Avalanche** (C-Chain)
@@ -80,9 +80,9 @@ If your wallet is connected to a different network than required for payment, th
80
80
2. Prompt you to switch to the correct network
81
81
3. Proceed with payment once switched
82
82
83
-
## thirdweb as X402 Facilitator
83
+
## thirdweb as 402 Payment Processor
84
84
85
-
thirdweb provides a complete x402 facilitator service that handles all the payment infrastructure for your APIs.
85
+
thirdweb provides a complete 402 payment processing service that handles all the payment infrastructure for your APIs.
86
86
87
87
### What thirdweb Provides
88
88
-**Payment verification**: Validates user payment signatures and wallet balances
@@ -108,7 +108,7 @@ Your **server wallet** is the blockchain address where all API payments are coll
108
108
109
109
### Basic Usage
110
110
111
-
`wrapFetchWithPayment` wraps the native fetch API to automatically handle `402 Payment Required` responses from any API call. It will:
111
+
`wrapFetchWithPayment` wraps the native fetch API to automatically handle `402 Payment Required` responses, implementing thirdweb's "exact" payment scheme. It will:
112
112
1. Make the initial request
113
113
2. If a 402 response is received, parse the payment requirements
114
114
3. Verify the payment amount is within the allowed maximum
@@ -206,9 +206,9 @@ function PayableAPICall() {
206
206
207
207
### Basic Middleware Setup
208
208
209
-
To make your API calls payable, you can use any x402 middleware librarylike `x402-hono`, `x402-next`, `x402-express`, etc.
209
+
To make your API calls payable, you can use any 402 payment middleware library. thirdweb provides payment processor integration for popular frameworks like `x402-next`, `x402-hono`, `x402-express`, etc.
210
210
211
-
Then, use the `facilitator` configuration function to settle transactions with your thirdweb server wallet gaslessly and pass it to the middleware.
211
+
Then, use the thirdweb payment processor configuration to settle transactions with your server wallet gaslessly and pass it to the middleware.
0 commit comments