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: docs/getting-started/paying-for-content.md
+43-11Lines changed: 43 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,9 +5,42 @@ sidebar_label: "Pay for Content"
5
5
6
6
# Paying for Monetized Content
7
7
8
-
In this section, we'll walk through paying for monetized content (URLs or files), understanding how to handle test versus production payments, and how to use access credits. We'll use the Proxy402 client from the GitHub repository.
8
+
In this section, we'll walk through paying for monetized content (URLs or files), understanding how to handle test versus production payments, and how to use access credits. We'll cover both the web-based debug tool and the CLI client.
9
9
10
-
## Setting Up the Client
10
+
## Method 1: Web Interface (Recommended)
11
+
12
+
The fastest way to test and pay for X402 content is using the web interface at [proxy402.com/fetch](https://proxy402.com/fetch).
2. Paste your monetized URL (e.g., `https://proxy402.com/OsD8kKUZo3`)
20
+
3. Click "Test Request" to see the X402 response with payment details
21
+
4. Copy the X-Payment header if you want to use it manually
22
+
23
+
### Making Payments
24
+
25
+
1. Click "Connect Wallet" to connect via WalletConnect (MetaMask, etc.)
26
+
2. For test payments, get test funds from the [Circle USDC Faucet](https://faucet.circle.com/) (select "BASE USDC" for Base Sepolia)
27
+

28
+
3. Click "Pay" to complete the payment using your connected wallet
29
+
4. After payment, you'll see the response with headers including the `X-Payment` header for future access
30
+
31
+
### Using Purchased Credits
32
+
33
+
If your resource grants multiple access credits, use the `X-Payment` header from your successful payment:
34
+
35
+
1. Paste the `X-Payment` header value in the "Paste your X-Payment header here" field
36
+
2. Click "Test Request" to access the content using your credits
37
+
3. Each use consumes one credit without requiring a new blockchain transaction
38
+
39
+
## Method 2: CLI Client
40
+
41
+
For developers who prefer command-line tools or need to integrate payments programmatically:
42
+
43
+
### Setting Up the Client
11
44
12
45
Let's start by cloning the Proxy402 repository and navigating to the client folder:
13
46
@@ -31,7 +64,7 @@ And install dependencies:
31
64
npm install
32
65
```
33
66
34
-
## Creating a Wallet
67
+
###Creating a Wallet
35
68
36
69
You'll need a private key for a Base address to make payments. You can use an existing wallet or create a new one. If you don't have one, you can create it using Foundry:
37
70
@@ -69,7 +102,7 @@ You'll need a private key for a Base address to make payments. You can use an ex
69
102
>
70
103
> For more details on installing Foundry, see the [official documentation](https://book.getfoundry.sh/getting-started/installation).
71
104
72
-
## Making Your First Payment Attempt
105
+
###Making Your First Payment Attempt
73
106
74
107
With the client set up and your private key in the `.env` file, try accessing a monetized URL (e.g., one you created in the previous guide, or the demo `https://proxy402.com/OsD8kKUZo3`):
75
108
@@ -79,7 +112,7 @@ npm run client -- https://proxy402.com/OsD8kKUZo3
79
112
80
113
If your wallet is new and unfunded, you'll likely see an error message from the client indicating **"Insufficient funds"**. This is expected.
81
114
82
-
## Adding Test Funds
115
+
###Adding Test Funds
83
116
84
117
To proceed with test payments (for resources in "test mode" on Proxy402), your wallet needs test USDC for the Base Sepolia network.
85
118
@@ -88,7 +121,7 @@ To proceed with test payments (for resources in "test mode" on Proxy402), your w
88
121

89
122
3. Enter your wallet address (the one that starts with `0x` from the `cast wallet new` step) and request funds.
90
123
91
-
## Successful Payment and Accessing Content
124
+
###Successful Payment and Accessing Content
92
125
93
126
Once your wallet has test funds, run the command again:
94
127
@@ -108,7 +141,7 @@ This time, the payment should succeed! Here's what to expect:
108
141
```
109
142
To download the file, copy the entire `download_url` and paste it into your web browser, or use a command-line tool like `curl "PASTED_DOWNLOAD_URL" -o bitcoin-paper.pdf`.
110
143
111
-
## Using Purchased Credits
144
+
### Using Purchased Credits
112
145
113
146
When you successfully pay for a resource, the Proxy402 server always includes an `X-Payment` header in its HTTP response. If the resource you paid for grants multiple access credits, this `X-Payment` header value is the token you'll use to access your remaining credits.
114
147
@@ -142,7 +175,7 @@ If your token is invalid (e.g., all credits used or expired), the `proxy402/clie
142
175
143
176
For more client command details, see the `proxy402/client/README.md`.
144
177
145
-
## Making Production Payments (Mainnet)
178
+
###Making Production Payments (Mainnet)
146
179
147
180
When you want to pay for resources that are *not* in "test mode" (i.e., they require real payment on the Base mainnet):
148
181
@@ -154,13 +187,12 @@ When you want to pay for resources that are *not* in "test mode" (i.e., they req
154
187
```
155
188
The client requires you to specify the network; it does not automatically detect it from the server's L402 challenge.
156
189
157
-
## Checking Your Monetized Resources
190
+
### Checking Your Monetized Resources
158
191
159
192
If you created your own monetized URL or file, you can use the client to pay for it too:
160
193
161
194
```bash
162
195
npm run client -- https://proxy402.com/OsD8kKUZo3
163
196
```
164
197
165
-
After making a payment (or using a credit), go back to your Proxy402 dashboard and check your resource's statistics. You'll see that the "Attempts," "Payments," and potentially "Accesses" (if credits were used) counters have increased, and your earnings reflect any new payments.
166
-
198
+
After making a payment (or using a credit), go back to your Proxy402 dashboard and check your resource's statistics. You'll see that the "Attempts," "Payments," and potentially "Accesses" (if credits were used) counters have increased, and your earnings reflect any new payments.
0 commit comments