Skip to content

Commit de1547f

Browse files
committed
changed x402 to 402 Gated Payments
1 parent cc1a9e1 commit de1547f

File tree

1 file changed

+22
-22
lines changed
  • apps/portal/src/app/payments/x402

1 file changed

+22
-22
lines changed

apps/portal/src/app/payments/x402/page.mdx

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import { ArticleIconCard } from "@doc";
22
import { ReactIcon } from "@/icons";
33

4-
# x402 payments
4+
# 402 Gated Payments
55

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.
77

88
<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"
1111
icon={ReactIcon}
1212
href="https://playground.thirdweb.com/payments/x402"
1313
/>
1414

1515
## Introduction & Core Concepts
1616

17-
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.
1818

1919
### How it works
2020
When a user makes a request to a paid API:
@@ -30,27 +30,27 @@ When a user makes a request to a paid API:
3030
- **Instant monetization**: Start earning from your APIs immediately
3131
- **Micropayment friendly**: Perfect for small, frequent transactions
3232

33-
## X402 Protocol Fundamentals
33+
## 402 Payment Protocol Fundamentals
3434

3535
### Payment Flow
36-
The x402 protocol follows a simple request-retry pattern:
36+
The 402 payment protocol follows a simple request-retry pattern:
3737

3838
1. **Initial request**: Client makes normal API call
3939
2. **402 response**: Server responds with payment requirements if payment needed
4040
3. **Payment authorization**: User signs payment message in their wallet
4141
4. **Retry with payment**: Request is retried with payment header
4242
5. **Content delivery**: Server validates payment and returns content
4343

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:
4646
- Validates payment signatures from users
4747
- Executes on-chain transfers to collect payments
4848
- Provides payment infrastructure to API providers
4949

5050
### Payment Schemes
51-
Currently, x402 supports:
52-
- **"exact"**: Fixed price payments (e.g., exactly $0.01 USDC)
53-
- Additional schemes (percentage-based, auction-style) are planned for future versions
51+
thirdweb's 402 payment implementation currently supports:
52+
- **"exact"**: Fixed price payments (e.g., exactly $0.01 USDC) - our first supported scheme
53+
- Additional schemes (percentage-based, auction-style, variable pricing) are planned for future versions
5454

5555
### Security Model
5656
- **Signature-based**: Users sign payment authorizations, no direct token transfers from client
@@ -60,7 +60,7 @@ Currently, x402 supports:
6060
## Supported Payment Networks & Tokens
6161

6262
### Supported Networks
63-
thirdweb's x402 facilitator currently supports payments on:
63+
thirdweb's 402 payment processor currently supports payments on:
6464
- **Base** (mainnet)
6565
- **Base Sepolia** (testnet)
6666
- **Avalanche** (C-Chain)
@@ -80,9 +80,9 @@ If your wallet is connected to a different network than required for payment, th
8080
2. Prompt you to switch to the correct network
8181
3. Proceed with payment once switched
8282

83-
## thirdweb as X402 Facilitator
83+
## thirdweb as 402 Payment Processor
8484

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.
8686

8787
### What thirdweb Provides
8888
- **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
108108

109109
### Basic Usage
110110

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:
112112
1. Make the initial request
113113
2. If a 402 response is received, parse the payment requirements
114114
3. Verify the payment amount is within the allowed maximum
@@ -206,9 +206,9 @@ function PayableAPICall() {
206206

207207
### Basic Middleware Setup
208208

209-
To make your API calls payable, you can use any x402 middleware library like `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.
210210

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.
212212

213213
Here's an example with Next.js:
214214

@@ -235,7 +235,7 @@ export const middleware = paymentMiddleware(
235235
facilitator({
236236
client,
237237
serverWalletAddress: process.env.SERVER_WALLET_ADDRESS,
238-
}),
238+
}), // thirdweb payment processor configuration
239239
);
240240

241241
// Configure which paths the middleware should run on
@@ -244,9 +244,9 @@ export const config = {
244244
};
245245
```
246246

247-
### Facilitator Configuration Deep-Dive
247+
### Payment Processor Configuration Deep-Dive
248248

249-
The `facilitator` function accepts several configuration options:
249+
The `facilitator` function configures thirdweb's payment processor and accepts several options:
250250

251251
```typescript
252252
facilitator({
@@ -279,7 +279,7 @@ export const middleware = paymentMiddleware(
279279
config: { description: "AI-powered data processing" },
280280
},
281281
},
282-
facilitator({ client, serverWalletAddress }),
282+
facilitator({ client, serverWalletAddress }), // thirdweb payment processor
283283
);
284284

285285
export const config = {

0 commit comments

Comments
 (0)