@agent-score/commerce 1.0.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 +306 -0
- package/dist/_response-DmziuJz6.d.mts +137 -0
- package/dist/_response-rbK0zM7y.d.ts +137 -0
- package/dist/api/index.d.mts +1 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +37 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/index.mjs +14 -0
- package/dist/api/index.mjs.map +1 -0
- package/dist/challenge/index.d.mts +523 -0
- package/dist/challenge/index.d.ts +523 -0
- package/dist/challenge/index.js +354 -0
- package/dist/challenge/index.js.map +1 -0
- package/dist/challenge/index.mjs +318 -0
- package/dist/challenge/index.mjs.map +1 -0
- package/dist/core.d.mts +252 -0
- package/dist/core.d.ts +252 -0
- package/dist/core.js +500 -0
- package/dist/core.js.map +1 -0
- package/dist/core.mjs +472 -0
- package/dist/core.mjs.map +1 -0
- package/dist/discovery/index.d.mts +382 -0
- package/dist/discovery/index.d.ts +382 -0
- package/dist/discovery/index.js +675 -0
- package/dist/discovery/index.js.map +1 -0
- package/dist/discovery/index.mjs +630 -0
- package/dist/discovery/index.mjs.map +1 -0
- package/dist/identity/express.d.mts +44 -0
- package/dist/identity/express.d.ts +44 -0
- package/dist/identity/express.js +777 -0
- package/dist/identity/express.js.map +1 -0
- package/dist/identity/express.mjs +738 -0
- package/dist/identity/express.mjs.map +1 -0
- package/dist/identity/fastify.d.mts +63 -0
- package/dist/identity/fastify.d.ts +63 -0
- package/dist/identity/fastify.js +780 -0
- package/dist/identity/fastify.js.map +1 -0
- package/dist/identity/fastify.mjs +741 -0
- package/dist/identity/fastify.mjs.map +1 -0
- package/dist/identity/hono.d.mts +83 -0
- package/dist/identity/hono.d.ts +83 -0
- package/dist/identity/hono.js +779 -0
- package/dist/identity/hono.js.map +1 -0
- package/dist/identity/hono.mjs +740 -0
- package/dist/identity/hono.mjs.map +1 -0
- package/dist/identity/nextjs.d.mts +62 -0
- package/dist/identity/nextjs.d.ts +62 -0
- package/dist/identity/nextjs.js +784 -0
- package/dist/identity/nextjs.js.map +1 -0
- package/dist/identity/nextjs.mjs +747 -0
- package/dist/identity/nextjs.mjs.map +1 -0
- package/dist/identity/policy.d.mts +115 -0
- package/dist/identity/policy.d.ts +115 -0
- package/dist/identity/policy.js +81 -0
- package/dist/identity/policy.js.map +1 -0
- package/dist/identity/policy.mjs +53 -0
- package/dist/identity/policy.mjs.map +1 -0
- package/dist/identity/web.d.mts +82 -0
- package/dist/identity/web.d.ts +82 -0
- package/dist/identity/web.js +775 -0
- package/dist/identity/web.js.map +1 -0
- package/dist/identity/web.mjs +738 -0
- package/dist/identity/web.mjs.map +1 -0
- package/dist/index.d.mts +252 -0
- package/dist/index.d.ts +252 -0
- package/dist/index.js +432 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +388 -0
- package/dist/index.mjs.map +1 -0
- package/dist/payment/index.d.mts +716 -0
- package/dist/payment/index.d.ts +716 -0
- package/dist/payment/index.js +691 -0
- package/dist/payment/index.js.map +1 -0
- package/dist/payment/index.mjs +639 -0
- package/dist/payment/index.mjs.map +1 -0
- package/dist/signer-Cvdwn6Cs.d.mts +48 -0
- package/dist/signer-Cvdwn6Cs.d.ts +48 -0
- package/dist/stripe-multichain/index.d.mts +221 -0
- package/dist/stripe-multichain/index.d.ts +221 -0
- package/dist/stripe-multichain/index.js +243 -0
- package/dist/stripe-multichain/index.js.map +1 -0
- package/dist/stripe-multichain/index.mjs +199 -0
- package/dist/stripe-multichain/index.mjs.map +1 -0
- package/dist/wwwauthenticate-CU1eNvMQ.d.mts +37 -0
- package/dist/wwwauthenticate-CU1eNvMQ.d.ts +37 -0
- package/package.json +172 -0
|
@@ -0,0 +1,716 @@
|
|
|
1
|
+
export { P as PaymentRequiredHeaderInput, a as aliasAmountFields, p as paymentRequiredHeader, w as wwwAuthenticateHeader } from '../wwwauthenticate-CU1eNvMQ.js';
|
|
2
|
+
export { P as PaymentSigner, S as SignerNetwork, a as extractPaymentSigner, r as readX402PaymentHeader } from '../signer-Cvdwn6Cs.js';
|
|
3
|
+
|
|
4
|
+
interface PaymentRequestInput {
|
|
5
|
+
/** Symbolic rail name (e.g., 'tempo-mainnet', 'x402-base-mainnet') — fills in defaults */
|
|
6
|
+
rail?: string;
|
|
7
|
+
/** Amount in USD as a number or string. Converted to raw integer using `decimals`. */
|
|
8
|
+
amountUsd: string | number;
|
|
9
|
+
/** Token contract address or currency code. Defaults from rail. */
|
|
10
|
+
currency?: string;
|
|
11
|
+
/** Decimal precision for the amount. Defaults from rail (6 for USDC, 2 for USD). */
|
|
12
|
+
decimals?: number;
|
|
13
|
+
/** Recipient address (on-chain). Optional for stripe-style rails. */
|
|
14
|
+
recipient?: string;
|
|
15
|
+
/** EVM chain ID (goes into methodDetails.chainId). Defaults from rail. */
|
|
16
|
+
chainId?: number;
|
|
17
|
+
/** Stripe profile_id or similar (goes into methodDetails.networkId — note camelCase per link-cli's mpp decode validator). */
|
|
18
|
+
networkId?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Build the base64-encoded `request` blob for an MPP Payment directive (per the
|
|
22
|
+
* paymentauth.org spec). Output shape matches what link-cli `mpp decode` expects:
|
|
23
|
+
*
|
|
24
|
+
* { amount: "<raw_integer>", currency: "<token>", recipient?: "<addr>",
|
|
25
|
+
* methodDetails?: { chainId?: number, networkId?: string } }
|
|
26
|
+
*/
|
|
27
|
+
declare function buildPaymentRequestBlob(input: PaymentRequestInput): string;
|
|
28
|
+
interface PaymentDirectiveInput {
|
|
29
|
+
/** Symbolic rail name — sets `method` automatically */
|
|
30
|
+
rail?: string;
|
|
31
|
+
/** Challenge id (unique per request, used to correlate retries) */
|
|
32
|
+
id: string;
|
|
33
|
+
/** Realm — the host of the merchant URL (e.g., "agents.merchant.example") */
|
|
34
|
+
realm: string;
|
|
35
|
+
/** MPP method name. Defaults from rail (e.g., 'tempo', 'stripe'). */
|
|
36
|
+
method?: string;
|
|
37
|
+
/** MPP intent. Defaults to 'charge'. */
|
|
38
|
+
intent?: string;
|
|
39
|
+
/** ISO-8601 expiry timestamp. Defaults to now + 5 minutes. */
|
|
40
|
+
expires?: string;
|
|
41
|
+
/** Base64-encoded request blob. Pass the result of buildPaymentRequestBlob. */
|
|
42
|
+
request: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Format an MPP Payment directive string for the WWW-Authenticate header.
|
|
46
|
+
* Output shape: `Payment id="...", realm="...", method="...", intent="charge",
|
|
47
|
+
* expires="...", request="<base64>"`
|
|
48
|
+
*/
|
|
49
|
+
declare function paymentDirective(input: PaymentDirectiveInput): string;
|
|
50
|
+
interface BuildPaymentDirectiveInput extends Omit<PaymentRequestInput, 'rail'>, Omit<PaymentDirectiveInput, 'request'> {
|
|
51
|
+
rail: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Convenience: build the request blob and the directive in one call. Most vendors
|
|
55
|
+
* want this rather than the two-step form.
|
|
56
|
+
*/
|
|
57
|
+
declare function buildPaymentDirective(input: BuildPaymentDirectiveInput): string;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Named network registry. Vendors reference symbolic names (`networks.base.mainnet.caip2`)
|
|
61
|
+
* instead of magic strings. Lifted from agentscore-pay's constants.
|
|
62
|
+
*/
|
|
63
|
+
declare const networks: {
|
|
64
|
+
readonly base: {
|
|
65
|
+
readonly mainnet: {
|
|
66
|
+
readonly caip2: "eip155:8453";
|
|
67
|
+
readonly chainId: 8453;
|
|
68
|
+
};
|
|
69
|
+
readonly sepolia: {
|
|
70
|
+
readonly caip2: "eip155:84532";
|
|
71
|
+
readonly chainId: 84532;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
readonly solana: {
|
|
75
|
+
readonly mainnet: {
|
|
76
|
+
readonly caip2: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
77
|
+
};
|
|
78
|
+
readonly devnet: {
|
|
79
|
+
readonly caip2: "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1";
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
readonly tempo: {
|
|
83
|
+
readonly mainnet: {
|
|
84
|
+
readonly caip2: "eip155:4217";
|
|
85
|
+
readonly chainId: 4217;
|
|
86
|
+
};
|
|
87
|
+
readonly testnet: {
|
|
88
|
+
readonly caip2: "eip155:42431";
|
|
89
|
+
readonly chainId: 42431;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
type NetworkFamily = keyof typeof networks;
|
|
94
|
+
/**
|
|
95
|
+
* Returns the family name (base/solana/tempo) for a given CAIP-2 network string,
|
|
96
|
+
* or null if the network isn't in the registry. Useful for routing settlement
|
|
97
|
+
* by network.
|
|
98
|
+
*/
|
|
99
|
+
declare function networkFamily(caip2: string): NetworkFamily | null;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* USDC token registry per network. Used by paymentDirective and rail definitions.
|
|
103
|
+
* Lifted from agentscore-pay's constants.
|
|
104
|
+
*/
|
|
105
|
+
declare const USDC: {
|
|
106
|
+
readonly base: {
|
|
107
|
+
readonly mainnet: {
|
|
108
|
+
readonly address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
109
|
+
readonly decimals: 6;
|
|
110
|
+
};
|
|
111
|
+
readonly sepolia: {
|
|
112
|
+
readonly address: "0x036CbD53842c5426634e7929541eC2318f3dCF7e";
|
|
113
|
+
readonly decimals: 6;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
readonly solana: {
|
|
117
|
+
readonly mainnet: {
|
|
118
|
+
readonly mint: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
119
|
+
readonly decimals: 6;
|
|
120
|
+
};
|
|
121
|
+
readonly devnet: {
|
|
122
|
+
readonly mint: "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU";
|
|
123
|
+
readonly decimals: 6;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
readonly tempo: {
|
|
127
|
+
readonly mainnet: {
|
|
128
|
+
readonly address: "0x20C000000000000000000000b9537d11c60E8b50";
|
|
129
|
+
readonly decimals: 6;
|
|
130
|
+
};
|
|
131
|
+
readonly testnet: {
|
|
132
|
+
readonly address: "0x20c0000000000000000000000000000000000000";
|
|
133
|
+
readonly decimals: 6;
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Symbolic rail names mapped to their protocol details. Vendors pass `rail: 'tempo-mainnet'`
|
|
140
|
+
* to the directive builder and the SDK fills in method/network/decimals/currency from this
|
|
141
|
+
* registry. Custom rails not in this registry can be passed by setting the lower-level
|
|
142
|
+
* fields directly on the directive builder.
|
|
143
|
+
*/
|
|
144
|
+
declare const rails: {
|
|
145
|
+
readonly 'tempo-mainnet': {
|
|
146
|
+
readonly method: "tempo";
|
|
147
|
+
readonly network: "eip155:4217";
|
|
148
|
+
readonly chainId: 4217;
|
|
149
|
+
readonly currency: "0x20C000000000000000000000b9537d11c60E8b50";
|
|
150
|
+
readonly decimals: 6;
|
|
151
|
+
readonly asset: "0x20C000000000000000000000b9537d11c60E8b50";
|
|
152
|
+
};
|
|
153
|
+
readonly 'tempo-testnet': {
|
|
154
|
+
readonly method: "tempo";
|
|
155
|
+
readonly network: "eip155:42431";
|
|
156
|
+
readonly chainId: 42431;
|
|
157
|
+
readonly currency: "0x20c0000000000000000000000000000000000000";
|
|
158
|
+
readonly decimals: 6;
|
|
159
|
+
readonly asset: "0x20c0000000000000000000000000000000000000";
|
|
160
|
+
};
|
|
161
|
+
readonly 'x402-base-mainnet': {
|
|
162
|
+
readonly method: "x402";
|
|
163
|
+
readonly network: "eip155:8453";
|
|
164
|
+
readonly chainId: 8453;
|
|
165
|
+
readonly currency: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
166
|
+
readonly decimals: 6;
|
|
167
|
+
readonly asset: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
168
|
+
};
|
|
169
|
+
readonly 'x402-base-sepolia': {
|
|
170
|
+
readonly method: "x402";
|
|
171
|
+
readonly network: "eip155:84532";
|
|
172
|
+
readonly chainId: 84532;
|
|
173
|
+
readonly currency: "0x036CbD53842c5426634e7929541eC2318f3dCF7e";
|
|
174
|
+
readonly decimals: 6;
|
|
175
|
+
readonly asset: "0x036CbD53842c5426634e7929541eC2318f3dCF7e";
|
|
176
|
+
};
|
|
177
|
+
readonly 'x402-base-mainnet-upto': {
|
|
178
|
+
readonly method: "x402-upto";
|
|
179
|
+
readonly network: "eip155:8453";
|
|
180
|
+
readonly chainId: 8453;
|
|
181
|
+
readonly currency: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
182
|
+
readonly decimals: 6;
|
|
183
|
+
readonly asset: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
184
|
+
};
|
|
185
|
+
readonly 'x402-base-sepolia-upto': {
|
|
186
|
+
readonly method: "x402-upto";
|
|
187
|
+
readonly network: "eip155:84532";
|
|
188
|
+
readonly chainId: 84532;
|
|
189
|
+
readonly currency: "0x036CbD53842c5426634e7929541eC2318f3dCF7e";
|
|
190
|
+
readonly decimals: 6;
|
|
191
|
+
readonly asset: "0x036CbD53842c5426634e7929541eC2318f3dCF7e";
|
|
192
|
+
};
|
|
193
|
+
readonly 'x402-solana-mainnet': {
|
|
194
|
+
readonly method: "x402";
|
|
195
|
+
readonly network: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
196
|
+
readonly currency: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
197
|
+
readonly decimals: 6;
|
|
198
|
+
readonly asset: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
199
|
+
};
|
|
200
|
+
readonly 'x402-solana-devnet': {
|
|
201
|
+
readonly method: "x402";
|
|
202
|
+
readonly network: "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1";
|
|
203
|
+
readonly currency: "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU";
|
|
204
|
+
readonly decimals: 6;
|
|
205
|
+
readonly asset: "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU";
|
|
206
|
+
};
|
|
207
|
+
readonly 'stripe-spt': {
|
|
208
|
+
readonly method: "stripe";
|
|
209
|
+
readonly currency: "usd";
|
|
210
|
+
readonly decimals: 2;
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
type RailName = keyof typeof rails;
|
|
214
|
+
interface RailDefinition {
|
|
215
|
+
method: string;
|
|
216
|
+
network?: string;
|
|
217
|
+
chainId?: number;
|
|
218
|
+
currency: string;
|
|
219
|
+
decimals: number;
|
|
220
|
+
asset?: string;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Lookup a rail definition by symbolic name. Returns undefined if the rail isn't in
|
|
224
|
+
* the registry — vendors with custom rails should pass the low-level fields directly.
|
|
225
|
+
*/
|
|
226
|
+
declare function lookupRail(name: string): RailDefinition | undefined;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Generic x402 server interface. Different versions of @x402/core may expose different
|
|
230
|
+
* shapes; we only require register() and (optionally) registerV1().
|
|
231
|
+
*/
|
|
232
|
+
interface X402ServerLike {
|
|
233
|
+
register(network: string, scheme: unknown): void;
|
|
234
|
+
registerV1?(network: string, scheme: unknown): void;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Registers an x402 scheme on both v1 and v2 of the protocol.
|
|
238
|
+
*
|
|
239
|
+
* Why: the @x402/core HTTP parser hardcodes `x402Version === 1`, while the client's
|
|
240
|
+
* `.register()` defaults to v2. Without registering on both versions, a merchant
|
|
241
|
+
* emitting a v1 response gets "No client registered for x402 version: 1" even
|
|
242
|
+
* though the scheme handler is identical between versions. Every merchant trips
|
|
243
|
+
* on this; the helper hides the workaround.
|
|
244
|
+
*/
|
|
245
|
+
declare function registerX402SchemesV1V2(server: X402ServerLike, network: string, scheme: unknown): void;
|
|
246
|
+
|
|
247
|
+
type X402SymbolicRail = 'x402-base-mainnet' | 'x402-base-sepolia' | 'x402-solana-mainnet' | 'x402-solana-devnet' | 'x402-base-mainnet-upto' | 'x402-base-sepolia-upto';
|
|
248
|
+
type X402FacilitatorChoice = 'coinbase' | 'http' | unknown;
|
|
249
|
+
interface CreateX402ServerOptions {
|
|
250
|
+
/**
|
|
251
|
+
* Facilitator selection:
|
|
252
|
+
* - 'coinbase' → Coinbase CDP facilitator (requires `@coinbase/x402` installed)
|
|
253
|
+
* - 'http' → HTTP-only public testnet facilitator
|
|
254
|
+
* - any object → custom facilitator instance, used directly
|
|
255
|
+
* - omitted → defaults to 'http'
|
|
256
|
+
*/
|
|
257
|
+
facilitator?: X402FacilitatorChoice;
|
|
258
|
+
/**
|
|
259
|
+
* Symbolic rail names to register schemes for. Each gets v1+v2 dual-register applied.
|
|
260
|
+
* Requires the corresponding peer dep installed (`@x402/evm` for base, `@x402/svm` for solana).
|
|
261
|
+
*/
|
|
262
|
+
rails?: X402SymbolicRail[];
|
|
263
|
+
/** Advanced: register custom {network, scheme} pairs (in addition to or instead of `rails`). */
|
|
264
|
+
schemes?: {
|
|
265
|
+
network: string;
|
|
266
|
+
scheme: unknown;
|
|
267
|
+
}[];
|
|
268
|
+
/** Register the Bazaar discovery extension. Requires `@x402/extensions` installed. */
|
|
269
|
+
bazaar?: boolean;
|
|
270
|
+
/** Initialize the server immediately (calls facilitator). Default true. */
|
|
271
|
+
initialize?: boolean;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Loose type for the x402 resource server. We name the methods commerce calls during
|
|
275
|
+
* setup; everything else (settlePayment, buildPaymentRequirements, processPaymentRequest,
|
|
276
|
+
* enrichExtensions, etc.) is callable via the index signature so vendor code can use the
|
|
277
|
+
* full @x402/core surface without us having to mirror every method signature.
|
|
278
|
+
*/
|
|
279
|
+
interface X402Server {
|
|
280
|
+
register(network: string, scheme: unknown): void;
|
|
281
|
+
registerV1?(network: string, scheme: unknown): void;
|
|
282
|
+
registerExtension(ext: unknown): void;
|
|
283
|
+
initialize(): Promise<void>;
|
|
284
|
+
[key: string]: any;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* One-call x402 server setup. Resolves facilitator, constructs the server, registers
|
|
288
|
+
* schemes per network with v1+v2 dual-register, optionally adds the Bazaar extension,
|
|
289
|
+
* and initializes — replaces ~15 lines of boilerplate with a single config call.
|
|
290
|
+
*
|
|
291
|
+
* x402 packages are peer dependencies — vendors install only the schemes they use.
|
|
292
|
+
* Throws a guiding error if a required peer is missing.
|
|
293
|
+
*
|
|
294
|
+
* const server = await createX402Server({
|
|
295
|
+
* facilitator: 'coinbase',
|
|
296
|
+
* rails: ['x402-base-mainnet', 'x402-solana-mainnet'],
|
|
297
|
+
* bazaar: true,
|
|
298
|
+
* });
|
|
299
|
+
*/
|
|
300
|
+
declare function createX402Server(opts?: CreateX402ServerOptions): Promise<X402Server>;
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* `processX402Settle` — single-call x402 verify+settle for merchants.
|
|
304
|
+
*
|
|
305
|
+
* Wraps the four x402-server steps every x402-accepting merchant repeats:
|
|
306
|
+
* 1. `buildPaymentRequirements(resourceConfig)` — builds the requirement entries the
|
|
307
|
+
* facilitator validates against
|
|
308
|
+
* 2. `enrichExtensions(extension, transportContext)` — folds in Bazaar (or other)
|
|
309
|
+
* extensions for the verify step
|
|
310
|
+
* 3. `processPaymentRequest(payload, resourceConfig, resourceMeta, extensions)` —
|
|
311
|
+
* runs verify against the facilitator
|
|
312
|
+
* 4. `settlePayment(payload, matchedRequirement)` — settles on-chain
|
|
313
|
+
*
|
|
314
|
+
* Returns a tagged result so the caller can map errors to merchant-shaped responses
|
|
315
|
+
* without owning the orchestration boilerplate.
|
|
316
|
+
*/
|
|
317
|
+
|
|
318
|
+
interface ProcessX402SettleInput {
|
|
319
|
+
/** The x402 server instance from `createX402Server`. */
|
|
320
|
+
x402Server: X402Server;
|
|
321
|
+
/** The verified x402 payload extracted from the X-Payment header. */
|
|
322
|
+
payload: unknown;
|
|
323
|
+
/** Resource configuration the facilitator validates against (network, price, payTo,
|
|
324
|
+
* asset, maxTimeoutSeconds, etc.). Shape is x402-server-specific. */
|
|
325
|
+
resourceConfig: unknown;
|
|
326
|
+
/** Resource metadata exposed to the facilitator (URL, description, mime type). */
|
|
327
|
+
resourceMeta: {
|
|
328
|
+
url: string;
|
|
329
|
+
description: string;
|
|
330
|
+
mimeType: string;
|
|
331
|
+
};
|
|
332
|
+
/** Optional extension to enrich during verify (e.g. Bazaar). */
|
|
333
|
+
extension?: unknown;
|
|
334
|
+
/** Transport context for the extension enrich step. Defaults to `{ method: 'POST',
|
|
335
|
+
* adapter: { getPath: () => new URL(resourceMeta.url).pathname }, routePattern: <pathname> }`. */
|
|
336
|
+
transportContext?: unknown;
|
|
337
|
+
}
|
|
338
|
+
type ProcessX402SettleResult = {
|
|
339
|
+
success: true;
|
|
340
|
+
/** The matched requirement passed to `settlePayment`. */
|
|
341
|
+
matchedRequirement: unknown;
|
|
342
|
+
/** The settlement response from the facilitator. */
|
|
343
|
+
settleResult: unknown;
|
|
344
|
+
/** Base64-encoded JSON of `settleResult`, ready to set as the `payment-response`
|
|
345
|
+
* HTTP header on the merchant's success response. x402 clients (`@x402/fetch`,
|
|
346
|
+
* `agentscore-pay`) read this to confirm settlement landed. `undefined` when
|
|
347
|
+
* there's no settle result (shouldn't happen on success path but typed defensively). */
|
|
348
|
+
paymentResponseHeader: string | undefined;
|
|
349
|
+
/** The x402 server's `processPaymentRequest` verify result. */
|
|
350
|
+
verifyResult: {
|
|
351
|
+
success: true;
|
|
352
|
+
[key: string]: unknown;
|
|
353
|
+
};
|
|
354
|
+
} | {
|
|
355
|
+
success: false;
|
|
356
|
+
phase: 'no_requirements';
|
|
357
|
+
reason: string;
|
|
358
|
+
} | {
|
|
359
|
+
success: false;
|
|
360
|
+
phase: 'verify_failed';
|
|
361
|
+
verifyResult: unknown;
|
|
362
|
+
} | {
|
|
363
|
+
success: false;
|
|
364
|
+
phase: 'settle_failed';
|
|
365
|
+
error: unknown;
|
|
366
|
+
matchedRequirement: unknown;
|
|
367
|
+
};
|
|
368
|
+
declare function processX402Settle(input: ProcessX402SettleInput): Promise<ProcessX402SettleResult>;
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* x402 boot-time + per-request validation helpers.
|
|
372
|
+
*
|
|
373
|
+
* Two layers of validation every x402-accepting merchant repeats:
|
|
374
|
+
*
|
|
375
|
+
* - **Boot-time**: validate the configured `X402_BASE_NETWORK` + `X402_SVM_NETWORK`
|
|
376
|
+
* env vars are in the supported set, and aren't pointing at the same network
|
|
377
|
+
* family. Failing loud at boot is much better than per-request "unsupported
|
|
378
|
+
* network" errors after a misconfigured deploy.
|
|
379
|
+
*
|
|
380
|
+
* - **Per-request**: when an x402 X-Payment header arrives, parse the base64
|
|
381
|
+
* payload, extract the signed network + payTo, validate against the merchant's
|
|
382
|
+
* accepted networks, validate the payTo address shape per network family, and
|
|
383
|
+
* check that the payTo was minted by THIS merchant (cache hit). Each step has
|
|
384
|
+
* its own denial code and `next_steps` shape — getting the message right by
|
|
385
|
+
* hand across 4 conditions is fiddly.
|
|
386
|
+
*/
|
|
387
|
+
/** CAIP-2 networks the commerce SDK supports for x402 Base (EVM USDC). */
|
|
388
|
+
declare const X402_SUPPORTED_BASE_NETWORKS: Set<string>;
|
|
389
|
+
/** CAIP-2 networks the commerce SDK supports for x402 Solana (SPL Token USDC). */
|
|
390
|
+
declare const X402_SUPPORTED_SVM_NETWORKS: Set<string>;
|
|
391
|
+
interface ValidateX402NetworkConfigInput {
|
|
392
|
+
/** CAIP-2 base network string (e.g. `'eip155:8453'`). */
|
|
393
|
+
baseNetwork: string;
|
|
394
|
+
/** CAIP-2 SVM network string (e.g. `'solana:5eykt…'`). */
|
|
395
|
+
svmNetwork: string;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Boot-time guard: throws if either network isn't supported, or if both point at the
|
|
399
|
+
* same family (which would silently route Solana payments to the Base path or vice
|
|
400
|
+
* versa). Call once at module init / server boot.
|
|
401
|
+
*
|
|
402
|
+
* Throws `Error` with a message that names the unsupported value AND lists the valid
|
|
403
|
+
* options — agents tracking down a misconfigured deploy don't need to grep for the
|
|
404
|
+
* supported list.
|
|
405
|
+
*/
|
|
406
|
+
declare function validateX402NetworkConfig(input: ValidateX402NetworkConfigInput): void;
|
|
407
|
+
interface VerifyX402RequestInput {
|
|
408
|
+
/** The incoming Request — `verifyX402Request` reads the X-Payment / payment-signature header. */
|
|
409
|
+
request: Request;
|
|
410
|
+
/** Async lookup that returns true when the address was minted by this merchant
|
|
411
|
+
* (typically `piCache.hasAddress`). The cache check defends against agents replaying
|
|
412
|
+
* credentials against attacker-controlled deposit addresses. */
|
|
413
|
+
isCachedAddress: (address: string) => Promise<boolean>;
|
|
414
|
+
/** The merchant's accepted networks per family. Both required — pass the same env
|
|
415
|
+
* values you fed to `validateX402NetworkConfig`. */
|
|
416
|
+
acceptedNetworks: {
|
|
417
|
+
/** CAIP-2 base network — e.g. `'eip155:8453'`. */
|
|
418
|
+
base: string;
|
|
419
|
+
/** CAIP-2 SVM network — e.g. `'solana:5eykt…'`. */
|
|
420
|
+
svm: string;
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
type VerifyX402RequestResult = {
|
|
424
|
+
ok: true;
|
|
425
|
+
/** The base64-decoded JSON payload from the X-Payment header. */
|
|
426
|
+
payload: {
|
|
427
|
+
accepted?: {
|
|
428
|
+
network?: string;
|
|
429
|
+
payTo?: string;
|
|
430
|
+
};
|
|
431
|
+
[key: string]: unknown;
|
|
432
|
+
};
|
|
433
|
+
/** The CAIP-2 network the agent signed for. */
|
|
434
|
+
signedNetwork: string;
|
|
435
|
+
/** The on-chain pay-to address the agent signed for (already validated). */
|
|
436
|
+
signedPayTo: string;
|
|
437
|
+
/** True when the signed network is Solana — useful for routing settlement. */
|
|
438
|
+
isSolana: boolean;
|
|
439
|
+
} | {
|
|
440
|
+
ok: false;
|
|
441
|
+
/** Suitable as a JSON body for the merchant's denial response. Includes
|
|
442
|
+
* `next_steps` with `regenerate_payment_credential` action + a per-condition
|
|
443
|
+
* `user_message` and a footgun `warning` so agents can recover deterministically
|
|
444
|
+
* from the response alone. */
|
|
445
|
+
body: {
|
|
446
|
+
error: {
|
|
447
|
+
code: string;
|
|
448
|
+
message: string;
|
|
449
|
+
};
|
|
450
|
+
next_steps: {
|
|
451
|
+
action: 'regenerate_payment_credential';
|
|
452
|
+
user_message: string;
|
|
453
|
+
warning: string;
|
|
454
|
+
};
|
|
455
|
+
};
|
|
456
|
+
/** HTTP status to use for the denial response. */
|
|
457
|
+
status: 400;
|
|
458
|
+
};
|
|
459
|
+
/**
|
|
460
|
+
* Per-request: parse the x402 X-Payment header, validate the network + payTo, and
|
|
461
|
+
* confirm the address was minted by this merchant. One call replaces ~45 lines of
|
|
462
|
+
* inline header decode + regex validation + cache lookup.
|
|
463
|
+
*
|
|
464
|
+
* Returns `{ok: true, payload, signedNetwork, signedPayTo, isSolana}` when valid; the
|
|
465
|
+
* caller passes `payload` straight into `processX402Settle`.
|
|
466
|
+
*
|
|
467
|
+
* Returns `{ok: false, body, status}` when invalid — the merchant just does
|
|
468
|
+
* `return c.json(body, status)` (or framework equivalent).
|
|
469
|
+
*
|
|
470
|
+
* Reads the header from `payment-signature` first, falling back to `x-payment` (both
|
|
471
|
+
* are in the wild as the binary-friendly transport name evolved).
|
|
472
|
+
*/
|
|
473
|
+
declare function verifyX402Request(input: VerifyX402RequestInput): Promise<VerifyX402RequestResult>;
|
|
474
|
+
|
|
475
|
+
interface CreateMppxServerOptions {
|
|
476
|
+
/** Symbolic rail config — commerce wires the boilerplate (tempo.charge, mppStripe.charge, etc.). */
|
|
477
|
+
rails?: {
|
|
478
|
+
/** One-shot Tempo USDC charge (intent: 'charge'). */
|
|
479
|
+
tempo?: {
|
|
480
|
+
recipient: string;
|
|
481
|
+
/** Custom currency token. Default: USDC on Tempo. */
|
|
482
|
+
currency?: string;
|
|
483
|
+
/** Use Tempo testnet (Moderato). Default false. */
|
|
484
|
+
testnet?: boolean;
|
|
485
|
+
};
|
|
486
|
+
/**
|
|
487
|
+
* Tempo session (intent: 'session') — pay-as-you-go channel for repeated calls or
|
|
488
|
+
* SSE-streamed responses. Vendor brings their own ChannelStore (DB-backed implementation
|
|
489
|
+
* tracking open channels + voucher state) and an `escrowContract` address.
|
|
490
|
+
*/
|
|
491
|
+
tempo_session?: {
|
|
492
|
+
recipient: string;
|
|
493
|
+
currency?: string;
|
|
494
|
+
testnet?: boolean;
|
|
495
|
+
/**
|
|
496
|
+
* On-chain escrow contract address that holds channel deposits and pays out
|
|
497
|
+
* cumulative vouchers on settlement. Vendor-deployed.
|
|
498
|
+
*/
|
|
499
|
+
escrowContract: string;
|
|
500
|
+
/**
|
|
501
|
+
* Channel store implementation tracking open channels + cumulative voucher state.
|
|
502
|
+
* Pass an instance of mppx's `ChannelStore` interface (you can use the in-memory
|
|
503
|
+
* default for dev or implement a Postgres/Redis-backed store for production).
|
|
504
|
+
*/
|
|
505
|
+
store: unknown;
|
|
506
|
+
/** Optional supported chains; defaults to mppx defaults. */
|
|
507
|
+
chains?: unknown;
|
|
508
|
+
};
|
|
509
|
+
/** Stripe SPT (Shared Payment Token) — see also @agent-score/commerce/stripe-multichain. */
|
|
510
|
+
stripe?: {
|
|
511
|
+
profileId: string;
|
|
512
|
+
secretKey: string;
|
|
513
|
+
paymentMethodTypes?: string[];
|
|
514
|
+
};
|
|
515
|
+
};
|
|
516
|
+
/** Advanced: pass mppx method instances directly (in addition to or instead of `rails`). */
|
|
517
|
+
methods?: unknown[];
|
|
518
|
+
/** MPP secret key (merchant's). */
|
|
519
|
+
secretKey: string;
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* One-call mppx server setup. Wires `tempo.charge(...)`, `tempo.session(...)`, and Stripe SPT
|
|
523
|
+
* (via createMppxStripe) from symbolic rail config, replacing the boilerplate of constructing
|
|
524
|
+
* each method by hand.
|
|
525
|
+
*
|
|
526
|
+
* const mppx = await createMppxServer({
|
|
527
|
+
* rails: {
|
|
528
|
+
* tempo: { recipient: TEMPO_ADDR, testnet: false }, // intent: 'charge'
|
|
529
|
+
* tempo_session: { // intent: 'session'
|
|
530
|
+
* recipient: TEMPO_ADDR,
|
|
531
|
+
* escrowContract: ESCROW_ADDR,
|
|
532
|
+
* store: myChannelStore,
|
|
533
|
+
* },
|
|
534
|
+
* stripe: { profileId: STRIPE_PROFILE_ID, secretKey: STRIPE_SECRET_KEY },
|
|
535
|
+
* },
|
|
536
|
+
* secretKey: MPP_SECRET_KEY,
|
|
537
|
+
* });
|
|
538
|
+
*
|
|
539
|
+
* `mppx` is an OPTIONAL peer dependency — install it only if you accept MPP rails.
|
|
540
|
+
*/
|
|
541
|
+
declare function createMppxServer(opts: CreateMppxServerOptions): Promise<unknown>;
|
|
542
|
+
|
|
543
|
+
interface SettlementHandlers<TPayload, TResult> {
|
|
544
|
+
evm?: (payload: TPayload) => TResult | Promise<TResult>;
|
|
545
|
+
svm?: (payload: TPayload) => TResult | Promise<TResult>;
|
|
546
|
+
}
|
|
547
|
+
interface SettlementPayloadLike {
|
|
548
|
+
accepted: {
|
|
549
|
+
network: string;
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Dispatches a settlement payload to the right network-family handler based on
|
|
554
|
+
* the CAIP-2 network string in `payload.accepted.network`:
|
|
555
|
+
*
|
|
556
|
+
* - eip155:* → handlers.evm
|
|
557
|
+
* - solana:* → handlers.svm
|
|
558
|
+
*
|
|
559
|
+
* Throws if the network is unrecognized or the matching handler is missing.
|
|
560
|
+
* Most vendors will register handlers for both rail families they accept.
|
|
561
|
+
*/
|
|
562
|
+
declare function dispatchSettlementByNetwork<TPayload extends SettlementPayloadLike, TResult>(payload: TPayload, handlers: SettlementHandlers<TPayload, TResult>): Promise<TResult>;
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Multi-rail payment header bundle — one call composes both `WWW-Authenticate` (the
|
|
566
|
+
* `paymentauth.org` Payment directives) and the standard x402 `PAYMENT-REQUIRED` header
|
|
567
|
+
* from a single rails declaration. Reduces ~10 lines of merchant boilerplate per 402
|
|
568
|
+
* response.
|
|
569
|
+
*
|
|
570
|
+
* Layered on top of `paymentDirective` / `wwwAuthenticateHeader` / `paymentRequiredHeader`
|
|
571
|
+
* — those primitives stay exposed for vendors who want full control.
|
|
572
|
+
*/
|
|
573
|
+
interface PaymentHeadersRail {
|
|
574
|
+
/** Symbolic rail name — `tempo-mainnet`, `x402-base-mainnet`, `stripe`, etc. */
|
|
575
|
+
rail: string;
|
|
576
|
+
/** Amount in USD as a number or string. */
|
|
577
|
+
amountUsd: string | number;
|
|
578
|
+
/** Recipient address (on-chain) — required for crypto rails. */
|
|
579
|
+
recipient?: string;
|
|
580
|
+
/** Stripe profile_id / network_id — required for `stripe` rail. */
|
|
581
|
+
networkId?: string;
|
|
582
|
+
/** EVM chain id override — usually inferred from rail. */
|
|
583
|
+
chainId?: number;
|
|
584
|
+
/** Token contract / currency override — usually inferred from rail. */
|
|
585
|
+
currency?: string;
|
|
586
|
+
/** Decimal precision override — usually inferred from rail (USDC=6, etc.). */
|
|
587
|
+
decimals?: number;
|
|
588
|
+
/** MPP method override — usually inferred from rail. */
|
|
589
|
+
method?: string;
|
|
590
|
+
/** MPP intent. Default `charge`. */
|
|
591
|
+
intent?: string;
|
|
592
|
+
/** ISO-8601 expiry. Default now + 5 min. */
|
|
593
|
+
expires?: string;
|
|
594
|
+
}
|
|
595
|
+
interface BuildPaymentHeadersInput {
|
|
596
|
+
/** Rails the merchant accepts on this 402. Each becomes one `Payment` directive. */
|
|
597
|
+
rails: PaymentHeadersRail[];
|
|
598
|
+
/** Order id used as the directive challenge id (per-rail it becomes `${orderId}-${rail}`). */
|
|
599
|
+
orderId: string;
|
|
600
|
+
/** Realm — the host of the merchant URL (e.g. `agents.merchant.example`). */
|
|
601
|
+
realm: string;
|
|
602
|
+
/**
|
|
603
|
+
* Optional x402 `accepts` array — included as the standard PAYMENT-REQUIRED header so
|
|
604
|
+
* x402 clients (`@x402/fetch`, `@x402/core` HTTPClient, `agentscore-pay`) can parse the
|
|
605
|
+
* base64-encoded JSON form instead of the WWW-Authenticate text directives. Pass
|
|
606
|
+
* `undefined` (or omit) to skip the PAYMENT-REQUIRED header.
|
|
607
|
+
*/
|
|
608
|
+
x402?: {
|
|
609
|
+
accepts: unknown[];
|
|
610
|
+
version?: 1 | 2;
|
|
611
|
+
resource?: {
|
|
612
|
+
url: string;
|
|
613
|
+
mimeType?: string;
|
|
614
|
+
};
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
interface PaymentHeadersResult {
|
|
618
|
+
'www-authenticate': string;
|
|
619
|
+
'PAYMENT-REQUIRED'?: string;
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* Compose `WWW-Authenticate` (multi-directive) and `PAYMENT-REQUIRED` (x402 base64) headers
|
|
623
|
+
* from a single rails declaration. Returns an object suitable for spreading into a
|
|
624
|
+
* `Headers` constructor or the `headers` field of a `Response`.
|
|
625
|
+
*
|
|
626
|
+
* Example:
|
|
627
|
+
* ```ts
|
|
628
|
+
* const headers = buildPaymentHeaders({
|
|
629
|
+
* orderId: 'ord_123',
|
|
630
|
+
* realm: 'agents.merchant.example',
|
|
631
|
+
* rails: [
|
|
632
|
+
* { rail: 'tempo-mainnet', amountUsd: 25, recipient: TEMPO_ADDR },
|
|
633
|
+
* { rail: 'x402-base-mainnet', amountUsd: 25, recipient: BASE_ADDR },
|
|
634
|
+
* { rail: 'stripe', amountUsd: 25, networkId: STRIPE_PROFILE_ID },
|
|
635
|
+
* ],
|
|
636
|
+
* x402: { accepts: x402Accepts, version: 1 },
|
|
637
|
+
* });
|
|
638
|
+
* return new Response(JSON.stringify(body), { status: 402, headers });
|
|
639
|
+
* ```
|
|
640
|
+
*/
|
|
641
|
+
declare function buildPaymentHeaders(input: BuildPaymentHeadersInput): PaymentHeadersResult;
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* Idempotency-key composition.
|
|
645
|
+
*
|
|
646
|
+
* Stable per-payment keys that retries of the same logical payment can reuse, so AgentScore's
|
|
647
|
+
* `/v1/credentials/wallets` capture endpoint dedupes correctly and the operator's
|
|
648
|
+
* `transaction_count` doesn't inflate.
|
|
649
|
+
*
|
|
650
|
+
* Convention (matches what martin-estate uses today):
|
|
651
|
+
* 1. Prefer the upstream payment-rail's stable identifier (Stripe PaymentIntent id, x402
|
|
652
|
+
* tx hash) when one exists — those are already idempotent on their side.
|
|
653
|
+
* 2. Fall back to a synthesized `pi-{orderId}-{amountCents}` key when no upstream id is
|
|
654
|
+
* available (e.g. pre-creation, or rails without a PI concept).
|
|
655
|
+
* 3. Server caps idempotency keys at 200 chars; this helper warns when that boundary is
|
|
656
|
+
* crossed so a future caller doesn't silently get truncation collisions.
|
|
657
|
+
*/
|
|
658
|
+
interface BuildIdempotencyKeyInput {
|
|
659
|
+
/** Upstream rail's stable payment id — Stripe PaymentIntent id, x402 tx hash, etc. Wins when present. */
|
|
660
|
+
paymentIntentId?: string | null;
|
|
661
|
+
/** Order id — used to compose a fallback key when no paymentIntentId exists. */
|
|
662
|
+
orderId?: string | null;
|
|
663
|
+
/** Amount in cents (or smallest currency unit) — added to the fallback for extra collision resistance. */
|
|
664
|
+
amountCents?: number;
|
|
665
|
+
/** Optional extra prefix to namespace the key (e.g. `"refund"`, `"void"`). */
|
|
666
|
+
prefix?: string;
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* Compose a stable idempotency key for AgentScore wallet capture and other retry-safe POSTs.
|
|
670
|
+
*
|
|
671
|
+
* Returns `undefined` when no inputs are present (caller should treat as "no idempotency
|
|
672
|
+
* key — first attempt only", same shape as omitting the field entirely).
|
|
673
|
+
*
|
|
674
|
+
* Examples:
|
|
675
|
+
* ```ts
|
|
676
|
+
* buildIdempotencyKey({ paymentIntentId: 'pi_abc' }); // → 'pi_abc'
|
|
677
|
+
* buildIdempotencyKey({ orderId: 'ord_x', amountCents: 25000 }); // → 'pi-ord_x-25000'
|
|
678
|
+
* buildIdempotencyKey({ orderId: 'ord_x' }); // → 'pi-ord_x'
|
|
679
|
+
* buildIdempotencyKey({ paymentIntentId: 'pi_abc', prefix: 'refund' }); // → 'refund-pi_abc'
|
|
680
|
+
* buildIdempotencyKey({}); // → undefined
|
|
681
|
+
* ```
|
|
682
|
+
*/
|
|
683
|
+
declare function buildIdempotencyKey(input: BuildIdempotencyKeyInput): string | undefined;
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* x402 Settlement-Overrides header helpers — used with the `upto` scheme to specify the
|
|
687
|
+
* actual amount to charge after the work is done. The header is JSON-encoded and lives
|
|
688
|
+
* on the merchant's response; the facilitator settles for that amount instead of the
|
|
689
|
+
* advertised maximum.
|
|
690
|
+
*
|
|
691
|
+
* Per the x402 docs (https://docs.x402.org/getting-started/quickstart-for-sellers), the
|
|
692
|
+
* amount field accepts three formats:
|
|
693
|
+
* - raw atomic units, e.g., '1000' for $0.001 USDC at 6 decimals
|
|
694
|
+
* - percentage, e.g., '50%' of the authorized maximum
|
|
695
|
+
* - dollar price, e.g., '$0.05' (converted to atomic via the network's default token)
|
|
696
|
+
*/
|
|
697
|
+
declare const SETTLEMENT_OVERRIDES_HEADER = "Settlement-Overrides";
|
|
698
|
+
interface SettlementOverrides {
|
|
699
|
+
/** Raw atomic units, '<n>%' percentage, or '$X.YZ' dollar price. */
|
|
700
|
+
amount: string;
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Build a `{ name, value }` pair for the x402 Settlement-Overrides header. Vendors
|
|
704
|
+
* set this on their response to direct the facilitator to settle for the actual amount
|
|
705
|
+
* (used in the upto scheme flow):
|
|
706
|
+
*
|
|
707
|
+
* const { name, value } = settlementOverrideHeader({ amount: '1500' });
|
|
708
|
+
* res.setHeader(name, value); // Express
|
|
709
|
+
* c.header(name, value); // Hono
|
|
710
|
+
*/
|
|
711
|
+
declare function settlementOverrideHeader(overrides: SettlementOverrides): {
|
|
712
|
+
name: string;
|
|
713
|
+
value: string;
|
|
714
|
+
};
|
|
715
|
+
|
|
716
|
+
export { type BuildIdempotencyKeyInput, type BuildPaymentDirectiveInput, type BuildPaymentHeadersInput, type CreateMppxServerOptions, type CreateX402ServerOptions, type NetworkFamily, type PaymentDirectiveInput, type PaymentHeadersRail, type PaymentHeadersResult, type PaymentRequestInput, type ProcessX402SettleInput, type ProcessX402SettleResult, type RailDefinition, type RailName, SETTLEMENT_OVERRIDES_HEADER, type SettlementHandlers, type SettlementOverrides, type SettlementPayloadLike, USDC, type ValidateX402NetworkConfigInput, type VerifyX402RequestInput, type VerifyX402RequestResult, type X402FacilitatorChoice, type X402Server, type X402ServerLike, type X402SymbolicRail, X402_SUPPORTED_BASE_NETWORKS, X402_SUPPORTED_SVM_NETWORKS, buildIdempotencyKey, buildPaymentDirective, buildPaymentHeaders, buildPaymentRequestBlob, createMppxServer, createX402Server, dispatchSettlementByNetwork, lookupRail, networkFamily, networks, paymentDirective, processX402Settle, rails, registerX402SchemesV1V2, settlementOverrideHeader, validateX402NetworkConfig, verifyX402Request };
|