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: src/pages/guides/use-mpp-with-x402.mdx
+82Lines changed: 82 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -181,6 +181,88 @@ console.log(response.status)
181
181
// @log: 200
182
182
```
183
183
184
+
### Build a client for MPP and x402
185
+
186
+
Register `evm.charge` for x402 exact Challenges and the MPP methods you want to support. The HTTP client reads both `WWW-Authenticate` and `PAYMENT-REQUIRED`, then retries with either `Authorization` or `PAYMENT-SIGNATURE`.
Use this pattern for coding agents, CLIs, SDKs, and application clients that need to call both native MPP APIs and x402 exact APIs.
216
+
217
+
### Send x402 headers manually
218
+
219
+
Use `Mppx.create` when you need explicit control over the first request and retry. `createCredential` returns a `PAYMENT-SIGNATURE` value when the selected Challenge came from `PAYMENT-REQUIRED`.
Because MPP uses the standard `WWW-Authenticate` scheme, it works with HTTP intermediaries (proxies, CDNs, API gateways) that understand [RFC 7235](https://www.rfc-editor.org/rfc/rfc7235) authentication.
Elysia apps can serve MPP and x402 clients from the same endpoint when you register [`evm.charge`](/payment-methods/evm/charge) with `x402.facilitator`.
Copy file name to clipboardExpand all lines: src/pages/sdk/typescript/middlewares/express.mdx
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -97,3 +97,35 @@ app.get(
97
97
},
98
98
)
99
99
```
100
+
101
+
## x402-compatible clients
102
+
103
+
Express routes can serve MPP and x402 clients from the same endpoint when you register [`evm.charge`](/payment-methods/evm/charge) with `x402.facilitator`.
Copy file name to clipboardExpand all lines: src/pages/sdk/typescript/middlewares/hono.mdx
+34Lines changed: 34 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -97,3 +97,37 @@ app.get(
97
97
},
98
98
)
99
99
```
100
+
101
+
## x402-compatible clients
102
+
103
+
Hono apps, including apps deployed on Cloudflare Workers, can serve MPP and x402 clients from the same endpoint when you register [`evm.charge`](/payment-methods/evm/charge) with `x402.facilitator`.
Copy file name to clipboardExpand all lines: src/pages/sdk/typescript/middlewares/nextjs.mdx
+27Lines changed: 27 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,3 +85,30 @@ export const GET =
85
85
returnResponse.json({ payer })
86
86
})
87
87
```
88
+
89
+
## x402-compatible clients
90
+
91
+
Next.js route handlers, including routes deployed on Vercel, can serve MPP and x402 clients from the same endpoint when you register [`evm.charge`](/payment-methods/evm/charge) with `x402.facilitator`.
0 commit comments