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
You can use either `x402-fetch` or `x402-axios` to automatically handle 402 Payment Required responses and complete payment flows.
64
65
65
66
!!! info x402-fetch
66
-
**x402-fetch** extends the native `fetch` API to handle 402 responses and payment headers for you. [Full example here](https://github.com/AkshatGada/x402_Polygon/blob/feature/facilitator-amoy/demo/quickstart-local/buyer_x402.js)
67
+
**x402-fetch** extends the native `fetch` API to handle 402 responses and payment headers for you. [Full example here](https://github.com/AkshatGada/x402_Polygon/tree/feature/facilitator-amoy/demo/quickstart-local)
Copy file name to clipboardExpand all lines: docs/pos/payments/x402/quickstart-sellers.md
+5-18Lines changed: 5 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,6 @@ Install the [x402 Express middleware package](https://www.npmjs.com/package/x402
26
26
27
27
```bash
28
28
npm install x402-express
29
-
npm install @coinbase/x402 # for the mainnet facilitator
30
29
```
31
30
32
31
Install the [x402 Next.js middleware package](https://www.npmjs.com/package/x402-next).
@@ -39,37 +38,25 @@ npm install x402-next
39
38
npm install x402-hono
40
39
```
41
40
42
-
This [community package](https://github.com/ethanniser/x402-mcp) showcases how you can use MCP (Model Context Protocol) with x402. We're working on enshrining an official MCP spec in x402 soon.
43
-
44
-
```bash
45
-
npm install x402-mcp
46
-
```
47
-
48
-
Full example in the repo [here](https://github.com/ethanniser/x402-mcp/tree/main/apps/example).
49
-
50
-
51
41
### 2. Add Payment Middleware
52
42
53
43
Integrate the payment middleware into your application. You will need
54
44
to provide:
55
45
56
46
* The Facilitator URL or facilitator object. For testing,
57
47
use `https://facilitator.x402.rs/` which works on Polygon Mainnet and Amoy.
58
-
* For more information on running in production on mainnet, check
59
-
out [CDP's Quickstart for Sellers](https://docs.cdp.coinbase.com/x402/docs/
60
-
quickstart-sellers). For a facilitator access on Polygon, please contact us [here.](https://t.me/PolygonHQ/32)
48
+
* For a facilitator access on Polygon, please contact us [here.](https://t.me/PolygonHQ/32)
61
49
* The routes you want to protect.
62
50
* Your receiving wallet address.
63
51
64
52
65
-
Full example in the repo [here](https://github.com/coinbase/x402/tree/main/examples/typescript/servers/express).
66
-
Please adapt for Polygon.
53
+
Full example in the repo [here](https://github.com/AkshatGada/x402_Polygon/tree/feature/facilitator-amoy/demo/quickstart-local).
54
+
67
55
68
56
69
57
```javascript
70
58
importexpressfrom"express";
71
59
import { paymentMiddleware } from"x402-express";
72
-
// import { facilitator } from "@coinbase/x402"; // For mainnet
73
60
74
61
constapp=express();
75
62
@@ -119,7 +106,7 @@ app.listen(4021, () => {
119
106
});
120
107
```
121
108
122
-
Full example in the repo [here](https://github.com/AkshatGada/x402_Polygon/blob/feature/facilitator-amoy/demo/quickstart-local/seller_x402.js).
109
+
Full example in the repo [here](https://github.com/AkshatGada/x402_Polygon/tree/feature/facilitator-amoy/demo/quickstart-local).
123
110
Since this is a fullstack example, we recommend using the example to build
124
111
this yourself, and treat the code snippet below as a reference to adapt for
125
112
Polygon.
@@ -152,7 +139,7 @@ export const config = {
152
139
};
153
140
```
154
141
155
-
Full example in the repo [here](https://github.com/coinbase/x402/tree/main/examples/typescript/servers/express).
0 commit comments