Skip to content

Commit fff14d4

Browse files
committed
2 parents b73522a + 0364115 commit fff14d4

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

llm.txt

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15106,7 +15106,7 @@ sequenceDiagram
1510615106
Agent->>API Server: GET /premium-data
1510715107
API Server-->>Agent: 402 Payment Required (price, recipient)
1510815108
Agent->>Agent: Sign EIP-712 payment
15109-
Agent->>API Server: GET /premium-data + X-PAYMENT header
15109+
Agent->>API Server: GET /premium-data + PAYMENT-SIGNATURE (v2) / X-PAYMENT (v1)
1511015110
API Server->>x402 Facilitator: Verify signature
1511115111
x402 Facilitator->>Blockchain: Execute transfer
1511215112
Blockchain-->>x402 Facilitator: Confirmed
@@ -15117,9 +15117,9 @@ sequenceDiagram
1511715117
| Step | What Happens |
1511815118
|------|--------------|
1511915119
| **1. Request** | Agent calls a paid API endpoint |
15120-
| **2. 402 Response** | Server returns payment requirements (amount, token, recipient) |
15120+
| **2. 402 Response** | Server returns payment requirements (v2 via `PAYMENT-REQUIRED`, legacy v1 via JSON body) |
1512115121
| **3. Sign** | Agent signs an EIP-712 typed-data payload (no gas yet) |
15122-
| **4. Retry** | Agent sends request again with signed payment header |
15122+
| **4. Retry** | Agent sends request again with the signed payment header (`PAYMENT-SIGNATURE` for v2, `X-PAYMENT` for v1) |
1512315123
| **5. Verify & Execute** | Facilitator verifies signature and executes transfer on-chain |
1512415124
| **6. Success** | Server returns the requested data |
1512515125

@@ -15218,21 +15218,21 @@ sequenceDiagram
1521815218
Agent->>Agent: Merge requirements + config overrides
1521915219
Agent->>Agent: Select signer (PRIVATE_KEY or Turnkey)
1522015220
Agent->>Agent: Build typed-data payload
15221-
Agent->>Agent: Sign -> X-PAYMENT header
15222-
Agent->>Paywall: Retry with X-PAYMENT
15221+
Agent->>Agent: Sign -> PAYMENT-SIGNATURE (v2) / X-PAYMENT (v1)
15222+
Agent->>Paywall: Retry with signed payment header
1522315223
Paywall->>Facilitator: verify_payment (optional settle)
1522415224
Facilitator-->>Paywall: Valid? + receipt
1522515225
alt Invalid
1522615226
Paywall-->>Agent: 402 / error
1522715227
else Valid
15228-
Paywall-->>Agent: 200 + X-PAYMENT-RESPONSE
15228+
Paywall-->>Agent: 200 + PAYMENT-RESPONSE (v2) / X-PAYMENT-RESPONSE (v1)
1522915229
Agent->>Agent: Log receipt / update memory
1523015230
Agent-->>User: Protected content + summary
1523115231
end
1523215232
end
1523315233
```
1523415234

15235-
If the paid retry fails (for example `verify_payment` rejects the header or the facilitator reports an error), the paywall server immediately returns another `402` or error payload and the agent decides whether to run `x402_paywalled_request` again with corrected parameters. A successful verification moves straight into settlement and target agent execution, so there is no additional retry cycle once the `X-PAYMENT` header is accepted.
15235+
If the paid retry fails (for example `verify_payment` rejects the header or the facilitator reports an error), the paywall server immediately returns another `402` or error payload and the agent decides whether to run `x402_paywalled_request` again with corrected parameters. A successful verification moves straight into settlement and target agent execution, so there is no additional retry cycle once the payment header is accepted (`PAYMENT-SIGNATURE` in v2, `X-PAYMENT` in legacy v1).
1523615236

1523715237
## Operational checklist
1523815238

@@ -15731,10 +15731,10 @@ What happens:
1573115731

1573215732
1. The script prints signer details and the target resource (`https://www.x402.org/protected` by default).
1573315733
2. A `SpoonReactAI` instance performs a ReAct loop:
15734-
- Calls `http_probe` (no payment) to capture the 402 challenge.
15734+
- Calls `web_scraper` (no payment) to capture the 402 challenge.
1573515735
- Calls `x402_paywalled_request` to sign and submit a 0.01 USDC payment.
1573615736
- Retrieves the protected payload (a SoundCloud embed) after settlement.
15737-
3. The console logs tool traces, the signed `X-PAYMENT` header, and the decoded settlement receipt (transaction hash, payer, network).
15737+
3. The console logs tool traces, the signed `PAYMENT-SIGNATURE` (x402 v2) header, and the decoded settlement receipt from `PAYMENT-RESPONSE` (transaction hash, payer, network).
1573815738

1573915739
## Troubleshooting
1574015740

@@ -20925,9 +20925,11 @@ Consult [API Reference: x402](../api-reference/spoon_ai/payments/) for:
2092520925
Follow [Example: x402 ReAct agent](../examples/x402-react-agent.md) to run the ReAct demo (`uv run python examples/x402_agent_demo.py`). It walks through:
2092620926

2092720927
- Preparing `.env` and funding the signer.
20928-
- Observing the agent call `http_probe`, then `x402_paywalled_request`, retrieve the protected page, and print the signed `X-PAYMENT` + settlement receipt.
20928+
- Observing the agent call `web_scraper`, then `x402_paywalled_request`, retrieve the protected page, and print the signed `PAYMENT-SIGNATURE` + settlement receipt.
2092920929
- Troubleshooting common facilitator or configuration errors.
2093020930

20931+
> Note: x402 v2 uses `PAYMENT-REQUIRED` / `PAYMENT-SIGNATURE` / `PAYMENT-RESPONSE` headers. SpoonOS tools still support the legacy `X-PAYMENT` / `X-PAYMENT-RESPONSE` headers for older v1 paywalls.
20932+
2093120933
## Quick checklist
2093220934

2093320935
- Fund the signer via [Circle faucet](https://faucet.circle.com/).

0 commit comments

Comments
 (0)