@pincerpay/merchant 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +221 -0
- package/dist/client.d.ts +31 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +80 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/middleware/express.d.ts +18 -0
- package/dist/middleware/express.d.ts.map +1 -0
- package/dist/middleware/express.js +61 -0
- package/dist/middleware/express.js.map +1 -0
- package/dist/middleware/hono.d.ts +18 -0
- package/dist/middleware/hono.d.ts.map +1 -0
- package/dist/middleware/hono.js +61 -0
- package/dist/middleware/hono.js.map +1 -0
- package/package.json +93 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 PincerPay
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# @pincerpay/merchant
|
|
2
|
+
|
|
3
|
+
Merchant SDK for accepting on-chain USDC payments from AI agents via the x402 protocol. Supports Express, Hono, and Next.js.
|
|
4
|
+
|
|
5
|
+
> **ESM Required:** Your project must have `"type": "module"` in package.json. This package is ESM-only.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @pincerpay/merchant
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
### Express
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import express from "express";
|
|
19
|
+
import { pincerpay } from "@pincerpay/merchant/express";
|
|
20
|
+
|
|
21
|
+
const app = express();
|
|
22
|
+
|
|
23
|
+
app.use(
|
|
24
|
+
pincerpay({
|
|
25
|
+
apiKey: process.env.PINCERPAY_API_KEY!,
|
|
26
|
+
merchantAddress: "YOUR_SOLANA_ADDRESS",
|
|
27
|
+
routes: {
|
|
28
|
+
"GET /api/weather": {
|
|
29
|
+
price: "0.01",
|
|
30
|
+
chain: "solana",
|
|
31
|
+
description: "Current weather data",
|
|
32
|
+
},
|
|
33
|
+
"POST /api/analyze": {
|
|
34
|
+
price: "0.10",
|
|
35
|
+
chains: ["solana", "base"],
|
|
36
|
+
description: "AI text analysis",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
})
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
app.get("/api/weather", (req, res) => {
|
|
43
|
+
res.json({ temp: 72, unit: "F" });
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
app.listen(3000);
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Hono
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import { Hono } from "hono";
|
|
53
|
+
import { pincerpayHono } from "@pincerpay/merchant/hono";
|
|
54
|
+
|
|
55
|
+
const app = new Hono();
|
|
56
|
+
|
|
57
|
+
app.use(
|
|
58
|
+
"*",
|
|
59
|
+
pincerpayHono({
|
|
60
|
+
apiKey: process.env.PINCERPAY_API_KEY!,
|
|
61
|
+
merchantAddress: "YOUR_SOLANA_ADDRESS",
|
|
62
|
+
routes: {
|
|
63
|
+
"GET /api/weather": {
|
|
64
|
+
price: "0.01",
|
|
65
|
+
chain: "solana",
|
|
66
|
+
description: "Current weather data",
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
})
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
app.get("/api/weather", (c) => c.json({ temp: 72 }));
|
|
73
|
+
|
|
74
|
+
export default app;
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Next.js (Hono Adapter)
|
|
78
|
+
|
|
79
|
+
Next.js doesn't have native x402 middleware support. Use Hono as a lightweight handler inside a catch-all App Router route:
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
// app/api/[...route]/route.ts
|
|
83
|
+
import { Hono } from "hono";
|
|
84
|
+
import { handle } from "hono/vercel";
|
|
85
|
+
import { pincerpayHono } from "@pincerpay/merchant/hono";
|
|
86
|
+
|
|
87
|
+
const app = new Hono().basePath("/api");
|
|
88
|
+
|
|
89
|
+
app.use(
|
|
90
|
+
"*",
|
|
91
|
+
pincerpayHono({
|
|
92
|
+
apiKey: process.env.PINCERPAY_API_KEY!,
|
|
93
|
+
merchantAddress: "YOUR_SOLANA_ADDRESS",
|
|
94
|
+
routes: {
|
|
95
|
+
"GET /api/weather": {
|
|
96
|
+
price: "0.01",
|
|
97
|
+
chain: "solana",
|
|
98
|
+
description: "Current weather data",
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
})
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
app.get("/weather", (c) => c.json({ temp: 72 }));
|
|
105
|
+
|
|
106
|
+
export const GET = handle(app);
|
|
107
|
+
export const POST = handle(app);
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Install: `npm install @pincerpay/merchant hono`
|
|
111
|
+
|
|
112
|
+
> **Note:** `basePath("/api")` must match the catch-all route location. Route handlers use paths relative to basePath (`/weather` serves `/api/weather`).
|
|
113
|
+
|
|
114
|
+
## API Reference
|
|
115
|
+
|
|
116
|
+
### `pincerpay(config): Express.RequestHandler`
|
|
117
|
+
|
|
118
|
+
Express middleware that intercepts requests matching configured routes and returns HTTP 402 with x402 payment requirements.
|
|
119
|
+
|
|
120
|
+
### `pincerpayHono(config): HonoMiddleware`
|
|
121
|
+
|
|
122
|
+
Hono middleware with identical behavior. Also used for Next.js via the Hono adapter pattern (see Next.js example above).
|
|
123
|
+
|
|
124
|
+
### `PincerPayClient`
|
|
125
|
+
|
|
126
|
+
Low-level client for direct facilitator API access.
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
import { PincerPayClient } from "@pincerpay/merchant";
|
|
130
|
+
|
|
131
|
+
const client = new PincerPayClient({
|
|
132
|
+
apiKey: process.env.PINCERPAY_API_KEY!,
|
|
133
|
+
merchantAddress: "YOUR_ADDRESS",
|
|
134
|
+
facilitatorUrl: "https://facilitator.pincerpay.com", // default
|
|
135
|
+
routes: {},
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
const result = await client.settle(paymentPayload, paymentRequirements);
|
|
139
|
+
const status = await client.getStatus(txHash);
|
|
140
|
+
const supported = await client.getSupported();
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Config
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
interface PincerPayConfig {
|
|
147
|
+
apiKey: string;
|
|
148
|
+
merchantAddress: string;
|
|
149
|
+
facilitatorUrl?: string; // defaults to https://facilitator.pincerpay.com
|
|
150
|
+
routes: Record<string, RoutePaywallConfig>;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
interface RoutePaywallConfig {
|
|
154
|
+
price: string; // USDC amount (e.g., "0.01")
|
|
155
|
+
chain?: string; // Chain shorthand (e.g., "solana", "base")
|
|
156
|
+
chains?: string[]; // Multiple chains
|
|
157
|
+
description?: string; // Human-readable description
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Utility Functions
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
import { toBaseUnits, resolveRouteChains } from "@pincerpay/merchant";
|
|
165
|
+
|
|
166
|
+
toBaseUnits("0.01"); // "10000" (USDC has 6 decimals)
|
|
167
|
+
resolveRouteChains(routeConfig); // ["solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"]
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Common Patterns
|
|
171
|
+
|
|
172
|
+
### Multi-chain pricing
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
pincerpay({
|
|
176
|
+
apiKey: process.env.PINCERPAY_API_KEY!,
|
|
177
|
+
merchantAddress: "YOUR_ADDRESS",
|
|
178
|
+
routes: {
|
|
179
|
+
"GET /api/data": {
|
|
180
|
+
price: "0.05",
|
|
181
|
+
chains: ["solana", "base", "polygon"],
|
|
182
|
+
description: "Accept USDC on any supported chain",
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
});
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Free routes alongside paid routes
|
|
189
|
+
|
|
190
|
+
Routes not listed in `routes` pass through without payment. Only matching `METHOD /path` patterns trigger the 402 paywall.
|
|
191
|
+
|
|
192
|
+
```typescript
|
|
193
|
+
pincerpay({
|
|
194
|
+
apiKey: process.env.PINCERPAY_API_KEY!,
|
|
195
|
+
merchantAddress: "YOUR_ADDRESS",
|
|
196
|
+
routes: {
|
|
197
|
+
"GET /api/premium": { price: "1.00", chain: "solana" },
|
|
198
|
+
// GET /api/free is not listed — no paywall
|
|
199
|
+
},
|
|
200
|
+
});
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Anti-Patterns
|
|
204
|
+
|
|
205
|
+
### Don't hardcode API keys
|
|
206
|
+
|
|
207
|
+
```typescript
|
|
208
|
+
// Bad
|
|
209
|
+
pincerpay({ apiKey: "pp_live_abc123...", ... });
|
|
210
|
+
|
|
211
|
+
// Good
|
|
212
|
+
pincerpay({ apiKey: process.env.PINCERPAY_API_KEY!, ... });
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Don't use the merchant SDK on the agent side
|
|
216
|
+
|
|
217
|
+
The merchant SDK is for servers accepting payments. Agents should use `@pincerpay/agent` to make payments.
|
|
218
|
+
|
|
219
|
+
### Don't set price to "0"
|
|
220
|
+
|
|
221
|
+
A price of "0" will still trigger the 402 flow. If a route should be free, omit it from the `routes` config.
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { PincerPayConfig, RoutePaywallConfig } from "@pincerpay/core";
|
|
2
|
+
/**
|
|
3
|
+
* PincerPayClient wraps the facilitator HTTP API.
|
|
4
|
+
* Used by merchant middleware to verify and settle payments.
|
|
5
|
+
*/
|
|
6
|
+
export declare class PincerPayClient {
|
|
7
|
+
readonly facilitatorUrl: string;
|
|
8
|
+
readonly apiKey: string;
|
|
9
|
+
readonly merchantAddress: string;
|
|
10
|
+
constructor(config: PincerPayConfig);
|
|
11
|
+
private request;
|
|
12
|
+
verify(paymentPayload: unknown, paymentRequirements: unknown): Promise<unknown>;
|
|
13
|
+
settle(paymentPayload: unknown, paymentRequirements: unknown): Promise<unknown>;
|
|
14
|
+
getSupported(): Promise<unknown>;
|
|
15
|
+
getStatus(txHash: string): Promise<unknown>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Resolve route config chains to CAIP-2 network IDs.
|
|
19
|
+
* "base" → "eip155:8453", etc.
|
|
20
|
+
*/
|
|
21
|
+
export declare function resolveRouteChains(route: RoutePaywallConfig): string[];
|
|
22
|
+
/**
|
|
23
|
+
* Convert USDC human-readable amount to base units (6 decimals).
|
|
24
|
+
* "0.01" → "10000"
|
|
25
|
+
*/
|
|
26
|
+
export declare function toBaseUnits(amount: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Get chain-specific USDC asset address from a chain shorthand.
|
|
29
|
+
*/
|
|
30
|
+
export declare function getUsdcAsset(chainShorthand: string): string;
|
|
31
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAGzB;;;GAGG;AACH,qBAAa,eAAe;IAC1B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;gBAErB,MAAM,EAAE,eAAe;YAMrB,OAAO;IAmBf,MAAM,CAAC,cAAc,EAAE,OAAO,EAAE,mBAAmB,EAAE,OAAO;IAO5D,MAAM,CAAC,cAAc,EAAE,OAAO,EAAE,mBAAmB,EAAE,OAAO;IAO5D,YAAY;IAIZ,SAAS,CAAC,MAAM,EAAE,MAAM;CAG/B;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAGtE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMlD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAM3D"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { DEFAULT_FACILITATOR_URL, FACILITATOR_ROUTES, API_KEY_HEADER, } from "@pincerpay/core";
|
|
2
|
+
import { resolveChain, toCAIP2 } from "@pincerpay/core";
|
|
3
|
+
/**
|
|
4
|
+
* PincerPayClient wraps the facilitator HTTP API.
|
|
5
|
+
* Used by merchant middleware to verify and settle payments.
|
|
6
|
+
*/
|
|
7
|
+
export class PincerPayClient {
|
|
8
|
+
facilitatorUrl;
|
|
9
|
+
apiKey;
|
|
10
|
+
merchantAddress;
|
|
11
|
+
constructor(config) {
|
|
12
|
+
this.facilitatorUrl = config.facilitatorUrl ?? DEFAULT_FACILITATOR_URL;
|
|
13
|
+
this.apiKey = config.apiKey;
|
|
14
|
+
this.merchantAddress = config.merchantAddress;
|
|
15
|
+
}
|
|
16
|
+
async request(path, body) {
|
|
17
|
+
const url = `${this.facilitatorUrl}${path}`;
|
|
18
|
+
const res = await fetch(url, {
|
|
19
|
+
method: body ? "POST" : "GET",
|
|
20
|
+
headers: {
|
|
21
|
+
"Content-Type": "application/json",
|
|
22
|
+
[API_KEY_HEADER]: this.apiKey,
|
|
23
|
+
},
|
|
24
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
25
|
+
});
|
|
26
|
+
if (!res.ok) {
|
|
27
|
+
const text = await res.text().catch(() => "Unknown error");
|
|
28
|
+
throw new Error(`Facilitator ${path} failed (${res.status}): ${text}`);
|
|
29
|
+
}
|
|
30
|
+
return res.json();
|
|
31
|
+
}
|
|
32
|
+
async verify(paymentPayload, paymentRequirements) {
|
|
33
|
+
return this.request(FACILITATOR_ROUTES.verify, {
|
|
34
|
+
paymentPayload,
|
|
35
|
+
paymentRequirements,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
async settle(paymentPayload, paymentRequirements) {
|
|
39
|
+
return this.request(FACILITATOR_ROUTES.settle, {
|
|
40
|
+
paymentPayload,
|
|
41
|
+
paymentRequirements,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
async getSupported() {
|
|
45
|
+
return this.request(FACILITATOR_ROUTES.supported);
|
|
46
|
+
}
|
|
47
|
+
async getStatus(txHash) {
|
|
48
|
+
return this.request(`${FACILITATOR_ROUTES.status}/${txHash}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Resolve route config chains to CAIP-2 network IDs.
|
|
53
|
+
* "base" → "eip155:8453", etc.
|
|
54
|
+
*/
|
|
55
|
+
export function resolveRouteChains(route) {
|
|
56
|
+
const shorthands = route.chains ?? (route.chain ? [route.chain] : ["solana"]);
|
|
57
|
+
return shorthands.map(toCAIP2);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Convert USDC human-readable amount to base units (6 decimals).
|
|
61
|
+
* "0.01" → "10000"
|
|
62
|
+
*/
|
|
63
|
+
export function toBaseUnits(amount) {
|
|
64
|
+
const parts = amount.split(".");
|
|
65
|
+
const whole = parts[0] ?? "0";
|
|
66
|
+
const frac = (parts[1] ?? "").padEnd(6, "0").slice(0, 6);
|
|
67
|
+
const result = BigInt(whole) * BigInt(1_000_000) + BigInt(frac);
|
|
68
|
+
return result.toString();
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Get chain-specific USDC asset address from a chain shorthand.
|
|
72
|
+
*/
|
|
73
|
+
export function getUsdcAsset(chainShorthand) {
|
|
74
|
+
const chain = resolveChain(chainShorthand);
|
|
75
|
+
if (!chain) {
|
|
76
|
+
throw new Error(`Unknown chain: ${chainShorthand}`);
|
|
77
|
+
}
|
|
78
|
+
return chain.usdcAddress;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,cAAc,GACf,MAAM,iBAAiB,CAAC;AAKzB,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAExD;;;GAGG;AACH,MAAM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;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,cAAsB;IACjD,MAAM,KAAK,GAAG,YAAY,CAAC,cAAc,CAAC,CAAC;IAC3C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,kBAAkB,cAAc,EAAE,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,KAAK,CAAC,WAAW,CAAC;AAC3B,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PincerPayConfig } from "@pincerpay/core";
|
|
2
|
+
import { type PaywallConfig } from "@x402/express";
|
|
3
|
+
/**
|
|
4
|
+
* Express middleware factory — the dead-simple API from the plan:
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* app.use(pincerpay({
|
|
8
|
+
* apiKey: process.env.PINCERPAY_API_KEY!,
|
|
9
|
+
* merchantAddress: "0xYourAddress",
|
|
10
|
+
* routes: {
|
|
11
|
+
* "GET /api/weather": { price: "0.01", chain: "base", description: "Weather data" },
|
|
12
|
+
* },
|
|
13
|
+
* }));
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function pincerpay(config: PincerPayConfig, paywallConfig?: PaywallConfig): (req: import("express").Request, res: import("express").Response, next: import("express").NextFunction) => Promise<void>;
|
|
17
|
+
export { PincerPayClient } from "../client.js";
|
|
18
|
+
//# sourceMappingURL=express.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../../src/middleware/express.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,eAAe,CAAC;AAMvB;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,eAAe,EAAE,aAAa,CAAC,EAAE,aAAa,4HA6D/E;AAED,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { resolveChain, DEFAULT_FACILITATOR_URL } from "@pincerpay/core";
|
|
2
|
+
import { paymentMiddlewareFromConfig, } from "@x402/express";
|
|
3
|
+
import { HTTPFacilitatorClient } from "@x402/core/server";
|
|
4
|
+
import { ExactEvmScheme } from "@x402/evm/exact/server";
|
|
5
|
+
import { ExactSvmScheme } from "@x402/svm/exact/server";
|
|
6
|
+
/**
|
|
7
|
+
* Express middleware factory — the dead-simple API from the plan:
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* app.use(pincerpay({
|
|
11
|
+
* apiKey: process.env.PINCERPAY_API_KEY!,
|
|
12
|
+
* merchantAddress: "0xYourAddress",
|
|
13
|
+
* routes: {
|
|
14
|
+
* "GET /api/weather": { price: "0.01", chain: "base", description: "Weather data" },
|
|
15
|
+
* },
|
|
16
|
+
* }));
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export function pincerpay(config, paywallConfig) {
|
|
20
|
+
const facilitatorUrl = config.facilitatorUrl ?? DEFAULT_FACILITATOR_URL;
|
|
21
|
+
// Build x402-compatible routes config
|
|
22
|
+
// Pass price as Money (string) so the EVM server scheme handles conversion
|
|
23
|
+
// and automatically includes EIP-712 domain parameters (name, version)
|
|
24
|
+
const x402Routes = {};
|
|
25
|
+
for (const [pattern, routeConfig] of Object.entries(config.routes)) {
|
|
26
|
+
const chains = routeConfig.chains ?? (routeConfig.chain ? [routeConfig.chain] : ["solana"]);
|
|
27
|
+
const accepts = chains.map((chainShorthand) => {
|
|
28
|
+
const chain = resolveChain(chainShorthand);
|
|
29
|
+
if (!chain)
|
|
30
|
+
throw new Error(`Unknown chain: ${chainShorthand}`);
|
|
31
|
+
return {
|
|
32
|
+
scheme: "exact",
|
|
33
|
+
network: chain.caip2Id,
|
|
34
|
+
payTo: config.merchantAddress,
|
|
35
|
+
price: routeConfig.price,
|
|
36
|
+
maxTimeoutSeconds: 300,
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
x402Routes[pattern] = {
|
|
40
|
+
accepts,
|
|
41
|
+
description: routeConfig.description ?? pattern,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
// Create facilitator client pointing to PincerPay
|
|
45
|
+
const facilitatorClient = new HTTPFacilitatorClient({
|
|
46
|
+
url: facilitatorUrl,
|
|
47
|
+
createAuthHeaders: async () => ({
|
|
48
|
+
verify: { "x-pincerpay-api-key": config.apiKey },
|
|
49
|
+
settle: { "x-pincerpay-api-key": config.apiKey },
|
|
50
|
+
supported: { "x-pincerpay-api-key": config.apiKey },
|
|
51
|
+
}),
|
|
52
|
+
});
|
|
53
|
+
// Register server schemes so the resource server can build payment requirements
|
|
54
|
+
const schemes = [
|
|
55
|
+
{ network: "eip155:*", server: new ExactEvmScheme() },
|
|
56
|
+
{ network: "solana:*", server: new ExactSvmScheme() },
|
|
57
|
+
];
|
|
58
|
+
return paymentMiddlewareFromConfig(x402Routes, facilitatorClient, schemes, paywallConfig);
|
|
59
|
+
}
|
|
60
|
+
export { PincerPayClient } from "../client.js";
|
|
61
|
+
//# sourceMappingURL=express.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"express.js","sourceRoot":"","sources":["../../src/middleware/express.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EACL,2BAA2B,GAE5B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,SAAS,CAAC,MAAuB,EAAE,aAA6B;IAC9E,MAAM,cAAc,GAAG,MAAM,CAAC,cAAc,IAAI,uBAAuB,CAAC;IAExE,sCAAsC;IACtC,2EAA2E;IAC3E,uEAAuE;IACvE,MAAM,UAAU,GASX,EAAE,CAAC;IAER,KAAK,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QACnE,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;QAE5F,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,cAAc,EAAE,EAAE;YAC5C,MAAM,KAAK,GAAG,YAAY,CAAC,cAAc,CAAC,CAAC;YAC3C,IAAI,CAAC,KAAK;gBAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,cAAc,EAAE,CAAC,CAAC;YAEhE,OAAO;gBACL,MAAM,EAAE,OAAgB;gBACxB,OAAO,EAAE,KAAK,CAAC,OAAkB;gBACjC,KAAK,EAAE,MAAM,CAAC,eAAe;gBAC7B,KAAK,EAAE,WAAW,CAAC,KAAK;gBACxB,iBAAiB,EAAE,GAAG;aACvB,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,UAAU,CAAC,OAAO,CAAC,GAAG;YACpB,OAAO;YACP,WAAW,EAAE,WAAW,CAAC,WAAW,IAAI,OAAO;SAChD,CAAC;IACJ,CAAC;IAED,kDAAkD;IAClD,MAAM,iBAAiB,GAAG,IAAI,qBAAqB,CAAC;QAClD,GAAG,EAAE,cAAc;QACnB,iBAAiB,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;YAC9B,MAAM,EAAE,EAAE,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE;YAChD,MAAM,EAAE,EAAE,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE;YAChD,SAAS,EAAE,EAAE,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE;SACpD,CAAC;KACH,CAAC,CAAC;IAEH,gFAAgF;IAChF,MAAM,OAAO,GAAG;QACd,EAAE,OAAO,EAAE,UAAqB,EAAE,MAAM,EAAE,IAAI,cAAc,EAAE,EAAE;QAChE,EAAE,OAAO,EAAE,UAAqB,EAAE,MAAM,EAAE,IAAI,cAAc,EAAE,EAAE;KACjE,CAAC;IAEF,OAAO,2BAA2B,CAChC,UAAU,EACV,iBAAiB,EACjB,OAAO,EACP,aAAa,CACd,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PincerPayConfig } from "@pincerpay/core";
|
|
2
|
+
import { type PaywallConfig } from "@x402/hono";
|
|
3
|
+
/**
|
|
4
|
+
* Hono middleware factory for PincerPay merchants.
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* app.use("*", pincerpayHono({
|
|
8
|
+
* apiKey: process.env.PINCERPAY_API_KEY!,
|
|
9
|
+
* merchantAddress: "0xYourAddress",
|
|
10
|
+
* routes: {
|
|
11
|
+
* "GET /api/weather": { price: "0.01", chain: "base", description: "Weather data" },
|
|
12
|
+
* },
|
|
13
|
+
* }));
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function pincerpayHono(config: PincerPayConfig, paywallConfig?: PaywallConfig): import("hono").MiddlewareHandler;
|
|
17
|
+
export { PincerPayClient } from "../client.js";
|
|
18
|
+
//# sourceMappingURL=hono.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hono.d.ts","sourceRoot":"","sources":["../../src/middleware/hono.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,YAAY,CAAC;AAMpB;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,aAAa,CAAC,EAAE,aAAa,oCA6DnF;AAED,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { resolveChain, DEFAULT_FACILITATOR_URL } from "@pincerpay/core";
|
|
2
|
+
import { paymentMiddlewareFromConfig, } from "@x402/hono";
|
|
3
|
+
import { HTTPFacilitatorClient } from "@x402/core/server";
|
|
4
|
+
import { ExactEvmScheme } from "@x402/evm/exact/server";
|
|
5
|
+
import { ExactSvmScheme } from "@x402/svm/exact/server";
|
|
6
|
+
/**
|
|
7
|
+
* Hono middleware factory for PincerPay merchants.
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* app.use("*", pincerpayHono({
|
|
11
|
+
* apiKey: process.env.PINCERPAY_API_KEY!,
|
|
12
|
+
* merchantAddress: "0xYourAddress",
|
|
13
|
+
* routes: {
|
|
14
|
+
* "GET /api/weather": { price: "0.01", chain: "base", description: "Weather data" },
|
|
15
|
+
* },
|
|
16
|
+
* }));
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export function pincerpayHono(config, paywallConfig) {
|
|
20
|
+
const facilitatorUrl = config.facilitatorUrl ?? DEFAULT_FACILITATOR_URL;
|
|
21
|
+
// Build x402-compatible routes config
|
|
22
|
+
// Pass price as Money (string) so the EVM server scheme handles conversion
|
|
23
|
+
// and automatically includes EIP-712 domain parameters (name, version)
|
|
24
|
+
const x402Routes = {};
|
|
25
|
+
for (const [pattern, routeConfig] of Object.entries(config.routes)) {
|
|
26
|
+
const chains = routeConfig.chains ?? (routeConfig.chain ? [routeConfig.chain] : ["solana"]);
|
|
27
|
+
const accepts = chains.map((chainShorthand) => {
|
|
28
|
+
const chain = resolveChain(chainShorthand);
|
|
29
|
+
if (!chain)
|
|
30
|
+
throw new Error(`Unknown chain: ${chainShorthand}`);
|
|
31
|
+
return {
|
|
32
|
+
scheme: "exact",
|
|
33
|
+
network: chain.caip2Id,
|
|
34
|
+
payTo: config.merchantAddress,
|
|
35
|
+
price: routeConfig.price,
|
|
36
|
+
maxTimeoutSeconds: 300,
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
x402Routes[pattern] = {
|
|
40
|
+
accepts,
|
|
41
|
+
description: routeConfig.description ?? pattern,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
// Create facilitator client pointing to PincerPay
|
|
45
|
+
const facilitatorClient = new HTTPFacilitatorClient({
|
|
46
|
+
url: facilitatorUrl,
|
|
47
|
+
createAuthHeaders: async () => ({
|
|
48
|
+
verify: { "x-pincerpay-api-key": config.apiKey },
|
|
49
|
+
settle: { "x-pincerpay-api-key": config.apiKey },
|
|
50
|
+
supported: { "x-pincerpay-api-key": config.apiKey },
|
|
51
|
+
}),
|
|
52
|
+
});
|
|
53
|
+
// Register server schemes so the resource server can build payment requirements
|
|
54
|
+
const schemes = [
|
|
55
|
+
{ network: "eip155:*", server: new ExactEvmScheme() },
|
|
56
|
+
{ network: "solana:*", server: new ExactSvmScheme() },
|
|
57
|
+
];
|
|
58
|
+
return paymentMiddlewareFromConfig(x402Routes, facilitatorClient, schemes, paywallConfig);
|
|
59
|
+
}
|
|
60
|
+
export { PincerPayClient } from "../client.js";
|
|
61
|
+
//# sourceMappingURL=hono.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hono.js","sourceRoot":"","sources":["../../src/middleware/hono.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EACL,2BAA2B,GAE5B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,aAAa,CAAC,MAAuB,EAAE,aAA6B;IAClF,MAAM,cAAc,GAAG,MAAM,CAAC,cAAc,IAAI,uBAAuB,CAAC;IAExE,sCAAsC;IACtC,2EAA2E;IAC3E,uEAAuE;IACvE,MAAM,UAAU,GASX,EAAE,CAAC;IAER,KAAK,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QACnE,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;QAE5F,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,cAAc,EAAE,EAAE;YAC5C,MAAM,KAAK,GAAG,YAAY,CAAC,cAAc,CAAC,CAAC;YAC3C,IAAI,CAAC,KAAK;gBAAE,MAAM,IAAI,KAA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express and Hono middleware for accepting USDC payments from AI agents.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://pincerpay.com",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/ds1/pincerpay.git",
|
|
14
|
+
"directory": "packages/merchant"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/ds1/pincerpay/issues"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"pincerpay",
|
|
21
|
+
"x402",
|
|
22
|
+
"usdc",
|
|
23
|
+
"payments",
|
|
24
|
+
"ai-agents",
|
|
25
|
+
"solana",
|
|
26
|
+
"merchant-sdk",
|
|
27
|
+
"middleware",
|
|
28
|
+
"express",
|
|
29
|
+
"hono"
|
|
30
|
+
],
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"README.md",
|
|
34
|
+
"LICENSE"
|
|
35
|
+
],
|
|
36
|
+
"main": "dist/index.js",
|
|
37
|
+
"types": "dist/index.d.ts",
|
|
38
|
+
"exports": {
|
|
39
|
+
".": {
|
|
40
|
+
"types": "./dist/index.d.ts",
|
|
41
|
+
"import": "./dist/index.js"
|
|
42
|
+
},
|
|
43
|
+
"./express": {
|
|
44
|
+
"types": "./dist/middleware/express.d.ts",
|
|
45
|
+
"import": "./dist/middleware/express.js"
|
|
46
|
+
},
|
|
47
|
+
"./hono": {
|
|
48
|
+
"types": "./dist/middleware/hono.d.ts",
|
|
49
|
+
"import": "./dist/middleware/hono.js"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@x402/core": "^2.3",
|
|
54
|
+
"@x402/evm": "^2.3",
|
|
55
|
+
"@x402/svm": "^2.3",
|
|
56
|
+
"zod": "^3.24",
|
|
57
|
+
"@pincerpay/core": "0.1.0"
|
|
58
|
+
},
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"@x402/express": "^2.3",
|
|
61
|
+
"@x402/hono": "^2.3",
|
|
62
|
+
"express": "^4 || ^5",
|
|
63
|
+
"hono": "^4"
|
|
64
|
+
},
|
|
65
|
+
"peerDependenciesMeta": {
|
|
66
|
+
"@x402/express": {
|
|
67
|
+
"optional": true
|
|
68
|
+
},
|
|
69
|
+
"@x402/hono": {
|
|
70
|
+
"optional": true
|
|
71
|
+
},
|
|
72
|
+
"express": {
|
|
73
|
+
"optional": true
|
|
74
|
+
},
|
|
75
|
+
"hono": {
|
|
76
|
+
"optional": true
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"devDependencies": {
|
|
80
|
+
"@types/express": "^5",
|
|
81
|
+
"@x402/express": "^2.3",
|
|
82
|
+
"@x402/hono": "^2.3",
|
|
83
|
+
"express": "^5",
|
|
84
|
+
"hono": "^4.12.0",
|
|
85
|
+
"typescript": "^5.7"
|
|
86
|
+
},
|
|
87
|
+
"scripts": {
|
|
88
|
+
"build": "tsc",
|
|
89
|
+
"test": "vitest run",
|
|
90
|
+
"typecheck": "tsc --noEmit",
|
|
91
|
+
"clean": "rm -rf dist"
|
|
92
|
+
}
|
|
93
|
+
}
|