@pincerpay/merchant 0.1.1 → 0.2.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/README.md +11 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](https://github.com/ds1/pincerpay/blob/master/LICENSE)
|
|
6
6
|
[](https://www.typescriptlang.org/)
|
|
7
7
|
|
|
8
|
-
Merchant SDK for accepting on-chain USDC payments from AI agents via the x402 protocol. Supports Express, Hono, and Next.js.
|
|
8
|
+
Merchant SDK for accepting on-chain USDC payments from AI agents via the [x402 protocol](https://x402.org). Supports Express, Hono, and Next.js.
|
|
9
9
|
|
|
10
10
|
> **ESM Required:** Your project must have `"type": "module"` in package.json. This package is ESM-only.
|
|
11
11
|
|
|
@@ -96,6 +96,7 @@ app.use(
|
|
|
96
96
|
pincerpayHono({
|
|
97
97
|
apiKey: process.env.PINCERPAY_API_KEY!,
|
|
98
98
|
merchantAddress: "YOUR_SOLANA_ADDRESS",
|
|
99
|
+
syncFacilitatorOnStart: false, // Avoids build-time network call during prerendering
|
|
99
100
|
routes: {
|
|
100
101
|
"GET /api/weather": {
|
|
101
102
|
price: "0.01",
|
|
@@ -151,8 +152,9 @@ const supported = await client.getSupported();
|
|
|
151
152
|
interface PincerPayConfig {
|
|
152
153
|
apiKey: string;
|
|
153
154
|
merchantAddress: string;
|
|
154
|
-
facilitatorUrl?: string;
|
|
155
|
+
facilitatorUrl?: string; // defaults to https://facilitator.pincerpay.com
|
|
155
156
|
routes: Record<string, RoutePaywallConfig>;
|
|
157
|
+
syncFacilitatorOnStart?: boolean; // defer facilitator sync to first request (default: false)
|
|
156
158
|
}
|
|
157
159
|
|
|
158
160
|
interface RoutePaywallConfig {
|
|
@@ -166,10 +168,15 @@ interface RoutePaywallConfig {
|
|
|
166
168
|
### Utility Functions
|
|
167
169
|
|
|
168
170
|
```typescript
|
|
169
|
-
import { toBaseUnits, resolveRouteChains } from "@pincerpay/merchant";
|
|
171
|
+
import { toBaseUnits, resolveRouteChains, getUsdcAsset } from "@pincerpay/merchant";
|
|
170
172
|
|
|
171
173
|
toBaseUnits("0.01"); // "10000" (USDC has 6 decimals)
|
|
174
|
+
toBaseUnits("1.00"); // "1000000"
|
|
175
|
+
|
|
172
176
|
resolveRouteChains(routeConfig); // ["solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"]
|
|
177
|
+
|
|
178
|
+
getUsdcAsset("solana-devnet"); // USDC mint address for Solana devnet
|
|
179
|
+
getUsdcAsset("base"); // USDC contract address for Base
|
|
173
180
|
```
|
|
174
181
|
|
|
175
182
|
## Common Patterns
|
|
@@ -200,7 +207,7 @@ pincerpay({
|
|
|
200
207
|
merchantAddress: "YOUR_ADDRESS",
|
|
201
208
|
routes: {
|
|
202
209
|
"GET /api/premium": { price: "1.00", chain: "solana" },
|
|
203
|
-
// GET /api/free is not listed
|
|
210
|
+
// GET /api/free is not listed -- no paywall
|
|
204
211
|
},
|
|
205
212
|
});
|
|
206
213
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pincerpay/merchant",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Merchant SDK for PincerPay. Express and Hono middleware for accepting USDC payments from AI agents.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@x402/evm": "^2.3",
|
|
63
63
|
"@x402/svm": "^2.3",
|
|
64
64
|
"zod": "^3.24",
|
|
65
|
-
"@pincerpay/core": "0.
|
|
65
|
+
"@pincerpay/core": "0.2.0"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"@x402/express": "^2.3",
|