@conto_finance/sdk 0.6.0 → 0.6.1

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/dist/index.d.ts CHANGED
@@ -1,3 +1,513 @@
1
+ type PurchaseStatus = 'queued' | 'running' | 'awaiting_action' | 'submitting' | 'reconciling' | 'succeeded' | 'blocked' | 'failed' | 'cancelled';
2
+ type PurchasePhase = 'queued' | 'shopping' | 'checkout' | 'review' | 'scheduled' | 'authorization' | 'payment' | 'reconciliation' | 'closed_unconfirmed' | 'complete';
3
+ type PurchaseActionKind = 'buyer_details' | 'purchase_review' | 'organization_approval' | 'card_verification' | 'merchant_signin' | 'merchant_challenge';
4
+ type PurchaseActionAuthority = 'agent_or_buyer' | 'buyer' | 'cardholder' | 'organization';
5
+ interface PurchaseMoney {
6
+ /** Positive integer in minor units. */
7
+ amountMinor: number;
8
+ /** Uppercase ISO 4217. Purchases support USD only. */
9
+ currency: string;
10
+ }
11
+ interface PurchaseItem {
12
+ url: string;
13
+ title?: string;
14
+ quantity?: number;
15
+ options?: string[];
16
+ }
17
+ interface PurchaseAction {
18
+ id: string;
19
+ kind: PurchaseActionKind;
20
+ /** Only `agent_or_buyer` accepts `purchases.respond()`. */
21
+ authority: PurchaseActionAuthority;
22
+ revision: number;
23
+ expiresAt: string;
24
+ /** For buyer_details: the form and the field names it accepts. */
25
+ form?: 'delivery' | 'billing' | 'store_order_contact';
26
+ fields?: string[];
27
+ /**
28
+ * For buyer, cardholder and reviewer actions: the Conto page that completes
29
+ * it. It works only inside a hosted buyer session or the dashboard, so it is
30
+ * safe to show. For a seamless buyer handoff, have your server create a
31
+ * hosted action link with `ContoAdmin.purchasing.purchases.createActionLink()`.
32
+ */
33
+ url?: string;
34
+ }
35
+ interface PurchaseEvidence {
36
+ authorization: {
37
+ state: 'not_requested' | 'pending_review' | 'issued' | 'denied' | 'cancelled' | 'unknown';
38
+ };
39
+ merchant: {
40
+ state: 'not_submitted' | 'confirmed' | 'unknown';
41
+ source?: string;
42
+ reference?: string;
43
+ amount?: PurchaseMoney;
44
+ amountVerified?: boolean;
45
+ observedAt?: string;
46
+ };
47
+ /** Never observed: the card provider reports issuance only. */
48
+ settlement: {
49
+ state: 'unknown';
50
+ reason: 'NOT_REPORTED_BY_PROVIDER';
51
+ };
52
+ }
53
+ interface Purchase {
54
+ id: string;
55
+ object: 'purchase';
56
+ buyerId: string;
57
+ agentId: string;
58
+ environment: 'live' | 'test';
59
+ status: PurchaseStatus;
60
+ phase: PurchasePhase;
61
+ /** Increases by one with every visible change. */
62
+ version: number;
63
+ request: {
64
+ url: string;
65
+ task?: string;
66
+ items?: PurchaseItem[];
67
+ };
68
+ maxCost: PurchaseMoney;
69
+ quote: {
70
+ merchant: string;
71
+ description: string | null;
72
+ total: PurchaseMoney;
73
+ estimatedTax: boolean;
74
+ } | null;
75
+ requiredAction: PurchaseAction | null;
76
+ result: {
77
+ outcome: 'merchant_confirmed' | 'checkout_reported' | 'credential_unused' | 'not_completed' | 'denied' | 'cancelled';
78
+ merchantReference: string | null;
79
+ } | null;
80
+ paymentEvidence: PurchaseEvidence;
81
+ progress: {
82
+ steps: number;
83
+ message: string | null;
84
+ };
85
+ reasonCode: string | null;
86
+ cancellation: {
87
+ requestedAt: string;
88
+ } | null;
89
+ /** Present when the purchase pays under one of the buyer's open allowances. */
90
+ allowance?: {
91
+ id: string;
92
+ reviewSkipped: boolean;
93
+ };
94
+ /** Present when the purchase is one cycle of a repeat order. */
95
+ recurrence?: {
96
+ id: string;
97
+ cycleKey: string;
98
+ payAt: string | null;
99
+ changes: {
100
+ previousTotal?: {
101
+ amountMinor: number;
102
+ currency: string;
103
+ };
104
+ itemsChanged: boolean;
105
+ } | null;
106
+ };
107
+ createdAt: string;
108
+ updatedAt: string;
109
+ completedAt: string | null;
110
+ }
111
+ interface PurchaseEvent {
112
+ id: string;
113
+ purchaseId: string;
114
+ version: number;
115
+ /** purchase.created, purchase.updated, purchase.action_required, purchase.<final status>, or purchase.resync */
116
+ type: string;
117
+ createdAt: string;
118
+ data: Purchase;
119
+ }
120
+ interface PurchaseEventPage {
121
+ items: PurchaseEvent[];
122
+ latestVersion: number;
123
+ nextCursor: number;
124
+ hasMore: boolean;
125
+ }
126
+ interface PurchaseList {
127
+ items: Purchase[];
128
+ total: number;
129
+ limit: number;
130
+ offset: number;
131
+ }
132
+ interface CreatePurchaseInput {
133
+ buyerId: string;
134
+ request: {
135
+ url: string;
136
+ task?: string;
137
+ items?: PurchaseItem[];
138
+ };
139
+ /** The most this purchase may cost, delivered. It narrows the delegation, never widens it. */
140
+ maxCost: PurchaseMoney;
141
+ /**
142
+ * The card and delegation to pay with. Leave it out when the buyer has one
143
+ * active delegation for the store: a test card for a Conto test store, a
144
+ * live card otherwise. With more than one, the API refuses with
145
+ * `PAYMENT_METHOD_REQUIRED`.
146
+ */
147
+ payment?: {
148
+ methodId: string;
149
+ delegationId: string;
150
+ };
151
+ /** The buyer id, to use the buyer's saved delivery details. */
152
+ buyerProfileId?: string;
153
+ }
154
+ interface PurchaseResponseAck {
155
+ id: string;
156
+ object: 'purchase_response';
157
+ purchaseId: string;
158
+ actionId: string;
159
+ /** accepted: recorded, not yet applied. applied: used. rejected: could not be used. */
160
+ status: 'accepted' | 'applied' | 'rejected';
161
+ reasonCode: string | null;
162
+ acceptedAt: string;
163
+ appliedAt: string | null;
164
+ replayed: boolean;
165
+ }
166
+ type CancellationOutcome = 'cancelled' | 'requested' | 'too_late' | 'already_final';
167
+ interface WatchPurchaseOptions {
168
+ /** Resume after this version. Defaults to 0, the full history. */
169
+ after?: number;
170
+ signal?: AbortSignal;
171
+ /** auto streams and falls back to polling. Defaults to auto. */
172
+ mode?: 'auto' | 'stream' | 'poll';
173
+ /** Polling interval. Defaults to 2000 ms. */
174
+ pollIntervalMs?: number;
175
+ /** Stop waiting after this long. Defaults to no limit. */
176
+ maxWaitMs?: number;
177
+ }
178
+ declare const isFinalPurchaseStatus: (status: PurchaseStatus) => boolean;
179
+ interface PurchaseTransport {
180
+ request<T>(method: string, path: string, body?: Record<string, unknown>, options?: {
181
+ idempotent?: boolean;
182
+ maxRetries?: number;
183
+ }): Promise<T>;
184
+ openStream(path: string, init: {
185
+ signal?: AbortSignal;
186
+ lastEventId?: string;
187
+ }): Promise<Response>;
188
+ }
189
+ type SseFrame = {
190
+ id?: string;
191
+ event: string;
192
+ data: string;
193
+ };
194
+ /** Parses server-sent events from a byte stream. */
195
+ declare function parseServerSentEvents(body: ReadableStream<Uint8Array>): AsyncGenerator<SseFrame>;
196
+ type RecurringPurchaseCycleStatus = 'checking' | 'scheduled' | 'needs_review' | 'paying' | 'paid' | 'skipped' | 'missed' | 'failed' | 'cancelled';
197
+ /** A repeat order the buyer set up while approving a purchase on Conto's hosted page. */
198
+ interface RecurringPurchase {
199
+ id: string;
200
+ object: 'recurring_purchase';
201
+ buyerId: string;
202
+ agentId: string;
203
+ paymentMethodId: string;
204
+ environment: 'live' | 'test';
205
+ status: 'active' | 'paused' | 'cancelled' | 'ended';
206
+ merchant: {
207
+ name: string;
208
+ };
209
+ description: string | null;
210
+ request: Record<string, unknown>;
211
+ cadence: {
212
+ unit: 'day' | 'month';
213
+ every: number;
214
+ label: string;
215
+ };
216
+ limits: {
217
+ /** The most one order may cost and still go through without the buyer's review. */
218
+ maxOrderMinor: number;
219
+ baselineMinor: number;
220
+ priceToleranceBps: number;
221
+ currency: 'USD';
222
+ };
223
+ /** How long before each order the buyer gets a heads-up. */
224
+ noticeMinutes: number;
225
+ skipNext: boolean;
226
+ nextDueAt: string | null;
227
+ expiresAt: string;
228
+ createdAt: string;
229
+ endedAt: string | null;
230
+ cycles: Array<{
231
+ cycleKey: string;
232
+ status: RecurringPurchaseCycleStatus;
233
+ purchaseId: string | null;
234
+ payAt: string | null;
235
+ total: {
236
+ amountMinor: number;
237
+ currency: string;
238
+ } | null;
239
+ createdAt: string;
240
+ }>;
241
+ }
242
+ interface RecurringPurchaseCycleResult {
243
+ recurrence: RecurringPurchase;
244
+ cycle: {
245
+ cycleKey: string;
246
+ status: RecurringPurchaseCycleStatus;
247
+ purchaseId: string | null;
248
+ };
249
+ /** The order's purchase when this call started it. Follow it like any purchase. */
250
+ purchase?: Purchase;
251
+ created: boolean;
252
+ }
253
+ /**
254
+ * Repeat orders. The buyer sets one up while approving a purchase. The agent
255
+ * starts each order with a cycle key that names it, such as `2026-W41`, so a
256
+ * retry never orders twice. Conto sends the buyer a heads-up and pays at the
257
+ * order's payment time, or asks the buyer when the order changed.
258
+ */
259
+ declare class RecurringPurchasesClient {
260
+ #private;
261
+ constructor(transport: PurchaseTransport, basePath?: string);
262
+ list(buyerId?: string): Promise<{
263
+ items: RecurringPurchase[];
264
+ }>;
265
+ get(id: string): Promise<RecurringPurchase>;
266
+ /** Starts one order. The same cycle key returns the same order. */
267
+ startCycle(id: string, cycleKey: string): Promise<RecurringPurchaseCycleResult>;
268
+ /** Skips one order, also before it starts. */
269
+ skipCycle(id: string, cycleKey: string): Promise<RecurringPurchaseCycleResult['cycle']>;
270
+ }
271
+ /** The organization's view of its buyers' repeat orders. It can also cancel one. */
272
+ declare class OrganizationRecurringPurchasesClient extends RecurringPurchasesClient {
273
+ #private;
274
+ constructor(client: PurchaseTransport);
275
+ /** Stops a repeat order. An order waiting for its payment time closes unpaid. */
276
+ cancel(id: string): Promise<RecurringPurchase>;
277
+ }
278
+ /**
279
+ * The agent's purchases. Card data, browser sessions and provider handles
280
+ * never appear here. Actions the agent may not complete (review, approval,
281
+ * card verification) are refused by the API and carry a Conto page `url`.
282
+ */
283
+ declare class PurchasesClient {
284
+ #private;
285
+ constructor(transport: PurchaseTransport, basePath?: string);
286
+ /**
287
+ * Starts a purchase and returns at once. Reusing the idempotency key with the
288
+ * same input returns the same purchase, so retrying after a lost response is safe.
289
+ */
290
+ create(input: CreatePurchaseInput, options: {
291
+ idempotencyKey: string;
292
+ }): Promise<Purchase>;
293
+ list(params?: {
294
+ limit?: number;
295
+ offset?: number;
296
+ status?: PurchaseStatus;
297
+ }): Promise<PurchaseList>;
298
+ get(id: string): Promise<Purchase>;
299
+ /**
300
+ * Answers an open action whose authority is `agent_or_buyer` with the fields
301
+ * it lists. The acknowledgment means recorded; the purchase shows the result.
302
+ * The same answer again returns the same acknowledgment.
303
+ */
304
+ respond(id: string, input: {
305
+ actionId: string;
306
+ fields: Record<string, unknown>;
307
+ revision?: number;
308
+ }): Promise<PurchaseResponseAck>;
309
+ events(id: string, params?: {
310
+ after?: number;
311
+ limit?: number;
312
+ }): Promise<PurchaseEventPage>;
313
+ /**
314
+ * Requests cancellation. Before payment the purchase stops. Once payment may
315
+ * have been submitted, `cancellationOutcome` is `too_late` and the purchase
316
+ * stays in reconciliation. Nothing is refunded by this call.
317
+ */
318
+ cancel(id: string): Promise<Purchase & {
319
+ cancellationOutcome: CancellationOutcome;
320
+ }>;
321
+ /**
322
+ * Yields the purchase's events in version order until it reaches a final
323
+ * status. Streams with server-sent events and reconnects from the last
324
+ * version; falls back to polling where streaming is unavailable. A duplicate
325
+ * after a reconnect is dropped. A `purchase.resync` event carries the
326
+ * current purchase when the cursor could not be resumed.
327
+ */
328
+ watch(id: string, options?: WatchPurchaseOptions): AsyncGenerator<PurchaseEvent>;
329
+ }
330
+ interface PurchaseBuyer {
331
+ id: string;
332
+ object: 'buyer';
333
+ externalId: string;
334
+ agentId: string;
335
+ status: 'active' | 'stopped';
336
+ limits: {
337
+ perPurchaseMinor: number;
338
+ dailyMinor: number;
339
+ currency: 'USD';
340
+ confirmed: boolean;
341
+ };
342
+ createdAt: string;
343
+ }
344
+ interface PurchasePaymentMethod {
345
+ id: string;
346
+ object: 'payment_method';
347
+ buyerId: string;
348
+ type: 'card';
349
+ environment: 'live' | 'test';
350
+ brand: string;
351
+ last4: string;
352
+ status: 'active' | 'removed';
353
+ createdAt: string;
354
+ }
355
+ interface PurchaseDelegation {
356
+ id: string;
357
+ object: 'delegation';
358
+ buyerId: string;
359
+ agentId: string;
360
+ paymentMethodId: string;
361
+ status: 'active' | 'revoked';
362
+ scope: 'merchant_bound_single_use';
363
+ limits: {
364
+ perPurchaseMinor: number;
365
+ dailyMinor: number;
366
+ currency: 'USD';
367
+ };
368
+ requiresPurchaseReview: true;
369
+ requiresCardVerification: boolean;
370
+ createdAt: string;
371
+ revokedAt: string | null;
372
+ }
373
+ interface PurchaseHostedLink {
374
+ id: string;
375
+ object: 'hosted_link';
376
+ purpose: 'setup' | 'purchase';
377
+ buyerId: string;
378
+ purchaseId: string | null;
379
+ /** Single use. Send the buyer here. Expires in 10 minutes. */
380
+ url: string;
381
+ expiresAt: string;
382
+ }
383
+ interface PurchasingCapabilities {
384
+ object: 'purchasing_capabilities';
385
+ /** Test mode is open to every organization. Live needs Conto to enable it. */
386
+ environments: Record<'test' | 'live', {
387
+ available: boolean;
388
+ reason?: string;
389
+ }>;
390
+ currencies: string[];
391
+ cardNetworks: string[];
392
+ executors: Array<{
393
+ executor: string;
394
+ available: boolean;
395
+ [key: string]: unknown;
396
+ }>;
397
+ /** Whether buyers can let their agent buy at a store without review, per environment. */
398
+ allowances?: Record<'test' | 'live', {
399
+ available: boolean;
400
+ }>;
401
+ unsupported: Array<{
402
+ capability: string;
403
+ reason: string;
404
+ }>;
405
+ }
406
+ /** The organization client's transport. Same shape as the agent client's. */
407
+ type AdminTransport = PurchaseTransport;
408
+ /** The organization's purchases. Adds buyer filtering and hosted action links. */
409
+ declare class OrganizationPurchasesClient extends PurchasesClient {
410
+ #private;
411
+ constructor(client: AdminTransport);
412
+ list(params?: {
413
+ limit?: number;
414
+ offset?: number;
415
+ status?: PurchaseStatus;
416
+ buyerId?: string;
417
+ }): Promise<PurchaseList>;
418
+ /** A single-use link that opens the purchase's buyer actions on Conto's hosted page. */
419
+ createActionLink(id: string, input?: {
420
+ returnUrl?: string;
421
+ }): Promise<PurchaseHostedLink>;
422
+ }
423
+ /**
424
+ * Buyers, hosted setup, payment methods, delegations and purchase oversight.
425
+ * Only a buyer on Conto's hosted page can add a card or create a delegation.
426
+ */
427
+ declare class AdminPurchasingClient {
428
+ #private;
429
+ constructor(client: AdminTransport);
430
+ /** Buyers' repeat orders: list, read, start or skip an order, and cancel. */
431
+ readonly recurringPurchases: OrganizationRecurringPurchasesClient;
432
+ readonly buyers: {
433
+ /** Maps one of your users to a buyer with its own agent, or returns the existing one. */
434
+ create: (input: {
435
+ externalId: string;
436
+ email: string;
437
+ }) => Promise<PurchaseBuyer>;
438
+ get: (id: string) => Promise<PurchaseBuyer>;
439
+ list: (params?: {
440
+ limit?: number;
441
+ offset?: number;
442
+ }) => Promise<{
443
+ items: PurchaseBuyer[];
444
+ total: number;
445
+ limit: number;
446
+ offset: number;
447
+ }>;
448
+ /** Stops the buyer's agent. Purchases that may already be paid stay visible. */
449
+ stop: (id: string) => Promise<PurchaseBuyer>;
450
+ };
451
+ readonly paymentMethods: {
452
+ /** A single-use link to the hosted setup page: limits, card and delegation. */
453
+ createSetupLink: (input: {
454
+ buyerId: string;
455
+ returnUrl?: string;
456
+ environment?: "live" | "test";
457
+ }) => Promise<PurchaseHostedLink>;
458
+ list: (buyerId: string) => Promise<{
459
+ items: PurchasePaymentMethod[];
460
+ }>;
461
+ remove: (id: string) => Promise<{
462
+ id: string;
463
+ removed: true;
464
+ }>;
465
+ };
466
+ readonly delegations: {
467
+ list: (buyerId: string) => Promise<{
468
+ items: PurchaseDelegation[];
469
+ }>;
470
+ get: (id: string) => Promise<PurchaseDelegation>;
471
+ revoke: (id: string) => Promise<PurchaseDelegation>;
472
+ };
473
+ /**
474
+ * Purchases with the organization key: start one for a buyer, answer its
475
+ * ordinary forms, follow it and cancel it, with the same methods as the
476
+ * agent client. Buyer actions open on Conto's hosted page from `createActionLink`.
477
+ */
478
+ readonly purchases: OrganizationPurchasesClient;
479
+ readonly settings: {
480
+ get: () => Promise<{
481
+ allowedReturnOrigins: string[];
482
+ }>;
483
+ update: (input: {
484
+ allowedReturnOrigins: string[];
485
+ }) => Promise<{
486
+ allowedReturnOrigins: string[];
487
+ }>;
488
+ };
489
+ /** What this organization can run now: test mode always, live once Conto enables it. */
490
+ capabilities(): Promise<PurchasingCapabilities>;
491
+ }
492
+ /**
493
+ * Verifies a purchase webhook. Pass the raw request body exactly as received,
494
+ * the X-Conto-Signature header and your organization's webhook signing secret.
495
+ * Refuses a bad signature and a delivery older than the tolerance. Deduplicate
496
+ * on the returned deliveryId, which is the same on every retry.
497
+ */
498
+ declare function verifyPurchaseWebhook(input: {
499
+ body: string;
500
+ signature: string | null | undefined;
501
+ secret: string;
502
+ toleranceSeconds?: number;
503
+ now?: Date;
504
+ }): {
505
+ event: string;
506
+ timestamp: string;
507
+ deliveryId: string;
508
+ data: PurchaseEvent;
509
+ };
510
+
1
511
  interface ApiErrorMetadata {
2
512
  code: string;
3
513
  status: number;
@@ -647,9 +1157,25 @@ declare class ContoAdmin {
647
1157
  cards: AdminCardsClient;
648
1158
  policies: PoliciesClient;
649
1159
  team: TeamClient;
1160
+ /** Buyers, hosted setup, payment methods, delegations and purchases. */
1161
+ purchasing: AdminPurchasingClient;
650
1162
  constructor(config: ContoAdminConfig);
651
- /** Make an authenticated request to the Conto API */
652
- request<T>(method: string, path: string, body?: Record<string, unknown>): Promise<T>;
1163
+ /**
1164
+ * Opens an authenticated server-sent event stream. Used by
1165
+ * `purchasing.purchases.watch()`. The server closes it after about 50 seconds.
1166
+ * @internal
1167
+ */
1168
+ openStream(path: string, init?: {
1169
+ signal?: AbortSignal;
1170
+ lastEventId?: string;
1171
+ }): Promise<Response>;
1172
+ /**
1173
+ * Make an authenticated request to the Conto API. Reads retry. A write retries
1174
+ * only when `idempotent` says the API deduplicates it, as purchase creation does.
1175
+ */
1176
+ request<T>(method: string, path: string, body?: Record<string, unknown>, options?: {
1177
+ idempotent?: boolean;
1178
+ }): Promise<T>;
653
1179
  }
654
1180
  declare class AdminCardsClient {
655
1181
  private client;
@@ -1179,7 +1705,7 @@ interface PaymentRequestResult {
1179
1705
  /** Unique request ID - use this to execute or check status */
1180
1706
  requestId: string;
1181
1707
  /** Current status */
1182
- status: 'APPROVED' | 'DENIED' | 'REQUIRES_APPROVAL' | 'PROCESSING';
1708
+ status: 'APPROVED' | 'DENIED' | 'REQUIRES_APPROVAL' | 'PROCESSING' | 'COMPLETED';
1183
1709
  /** Requested amount */
1184
1710
  amount: number;
1185
1711
  /** Currency selected for the payment */
@@ -1479,6 +2005,23 @@ interface ConnectedCardDrawResult {
1479
2005
  /** Provider expiration of the one-time credential; present with a fresh credential. */
1480
2006
  credentialExpiresAt?: string;
1481
2007
  }
2008
+ /**
2009
+ * What happened with a card number the agent received. `USED` with no
2010
+ * `amountMinor` means the full approved amount.
2011
+ */
2012
+ interface ConnectedCardOutcomeReport {
2013
+ outcome: 'USED' | 'NOT_USED';
2014
+ /** `USED` only: the amount charged in USD cents, at most the approved amount. */
2015
+ amountMinor?: number;
2016
+ }
2017
+ interface ConnectedCardOutcomeReportResult {
2018
+ recorded: true;
2019
+ /** True when the report closed the draw: used at the full approved amount. */
2020
+ closed: boolean;
2021
+ /** True when a person must confirm before any held amount is released. */
2022
+ reviewRequired: boolean;
2023
+ settlementVerified: false;
2024
+ }
1482
2025
  interface ConnectedCardMandateMerchant {
1483
2026
  name: string | null;
1484
2027
  categoryCode: string | null;
@@ -2432,6 +2975,10 @@ declare class Conto {
2432
2975
  testCards: TestCardsClient;
2433
2976
  x402: X402Client;
2434
2977
  mpp: MppClient;
2978
+ /** Purchases from a product URL and task to a merchant-confirmed order. */
2979
+ purchases: PurchasesClient;
2980
+ /** Repeat orders the agent's buyer set up. The agent starts each order. */
2981
+ recurringPurchases: RecurringPurchasesClient;
2435
2982
  constructor(config: ContoConfig);
2436
2983
  /**
2437
2984
  * Normalize and durably revise a partial agent purchase proposal without
@@ -2510,6 +3057,15 @@ declare class Conto {
2510
3057
  * diagnostics without creating a payment.
2511
3058
  */
2512
3059
  setup(): Promise<AgentSetupResult>;
3060
+ /**
3061
+ * Opens an authenticated server-sent event stream. Used by
3062
+ * `purchases.watch()`. The server closes it after about 50 seconds.
3063
+ * @internal
3064
+ */
3065
+ openStream(path: string, init?: {
3066
+ signal?: AbortSignal;
3067
+ lastEventId?: string;
3068
+ }): Promise<Response>;
2513
3069
  /** Make an authenticated request to the Conto API */
2514
3070
  request<T>(method: string, path: string, body?: Record<string, unknown>, options?: ContoRequestOptions): Promise<T>;
2515
3071
  }
@@ -2597,17 +3153,34 @@ declare class ConnectedCardsClient {
2597
3153
  * ```
2598
3154
  */
2599
3155
  draw(input: ConnectedCardDrawInput): Promise<ConnectedCardDrawResult>;
3156
+ /** Record receipt after a fresh draw. Does not confirm checkout or payment settlement. */
3157
+ acknowledgeDelivery(requestId: string): Promise<{
3158
+ acknowledged: boolean;
3159
+ settlementVerified: false;
3160
+ }>;
3161
+ /**
3162
+ * Report what happened with the card number after checkout.
3163
+ *
3164
+ * `USED` at the full approved amount closes the draw. `NOT_USED`, or `USED`
3165
+ * with a smaller `amountMinor`, is recorded and shown to a person, who
3166
+ * confirms it before the held amount is released. A report never releases
3167
+ * held spend by itself and does not confirm settlement. Safe to repeat with
3168
+ * the same report. A different second report gets HTTP 409.
3169
+ *
3170
+ * @example
3171
+ * ```typescript
3172
+ * await conto.connectedCards.reportOutcome(draw.requestId, { outcome: 'USED' });
3173
+ * await conto.connectedCards.reportOutcome(draw.requestId, { outcome: 'USED', amountMinor: 1850 });
3174
+ * await conto.connectedCards.reportOutcome(draw.requestId, { outcome: 'NOT_USED' });
3175
+ * ```
3176
+ */
3177
+ reportOutcome(requestId: string, report: ConnectedCardOutcomeReport): Promise<ConnectedCardOutcomeReportResult>;
2600
3178
  /**
2601
3179
  * List the connected cards and active mandates this agent may draw against.
2602
3180
  *
2603
3181
  * The response is masked: no PAN and no provider tokens. This is a read-only
2604
3182
  * GET, so transport retry on transient failures is safe.
2605
3183
  */
2606
- /** Record receipt after a fresh draw. Does not confirm checkout or payment settlement. */
2607
- acknowledgeDelivery(requestId: string): Promise<{
2608
- acknowledged: boolean;
2609
- settlementVerified: false;
2610
- }>;
2611
3184
  list(): Promise<ConnectedCardListResult>;
2612
3185
  }
2613
3186
  /**
@@ -2825,4 +3398,4 @@ declare class CheckoutClient {
2825
3398
  get(checkpointId: string): Promise<CheckoutCheckpoint>;
2826
3399
  }
2827
3400
 
2828
- export { type AdminExternalCardOverlayEnforcement, type Agent, type AgentCheckoutAction, type AgentCheckoutActionKind, type AgentExternalCard, type AgentSetupResult, type AgentStatus, type AgentType, type AgentWalletLink, type ApprovedExternalCardExecution, type AssignExternalCardInput, type AssignedPolicy, type AuthorizeCheckoutActionResult, type BeginCheckoutCheckpointInput, type BeginCommerceExecutionInput, type BrowserActionClaimResult, type BrowserActionDispatchObservationInput, BrowserActionFinalizationPendingError, type BrowserActionFinalizeResult, type BrowserCheckoutAction, type BrowserCheckoutTargetResolver, type BrowserCheckoutTargetSnapshot, type BrowserCheckoutTargetVerificationCode, BrowserCheckoutTargetVerificationError, type CanonicalBrowserCheckoutTargetSnapshot, CardsClient, type ChainType, type CheckoutActionAuthorization, CheckoutApprovalDeniedError, CheckoutApprovalExpiredError, CheckoutApprovalPendingError, CheckoutApprovalTimeoutError, type CheckoutCheckpoint, type CheckoutCheckpointApproval, CheckoutCheckpointClosedError, type CheckoutCheckpointMethod, type CheckoutCheckpointNextAction, type CheckoutCheckpointStage, CheckoutClient, type CheckoutOutcome, type CommerceCheckoutMethod, type CommerceContextRequirement, type CommerceExecution, type CommerceExecutionAdapterKind, type CommerceExecutionArtifactKind, type CommerceExecutionChannel, type CommerceExecutionConstraint, type CommerceExecutionConstraintCoverage, type CommerceExecutionConstraintCoverageLevel, type CommerceExecutionDeliveryMode, type CommerceExecutionEvidence, type CommerceExecutionProvider, type CommerceExecutionResult, type CommerceExecutionSourceKind, type CommerceExecutionStatus, type CommerceFactConfidence, type CommerceFactProvenanceInput, type CommerceFactSource, type CommerceFulfillmentInput, type CommerceLineItemInput, type CommerceProposalFactKey, type CommerceProposalMissingFact, type CommerceProposalResolution, type CommerceProposalState, type CommerceSettlementRail, type CommerceTotalInput, type CommerceTotalType, type ComparePolicyVersionsResponse, type ConfirmCheckoutCheckpointInput, type ConnectedCardBrief, type ConnectedCardCredential, type ConnectedCardDrawInput, type ConnectedCardDrawMerchant, type ConnectedCardDrawResult, type ConnectedCardDrawable, type ConnectedCardListResult, type ConnectedCardMandate, type ConnectedCardMandateMerchant, type ConnectedCardReference, ConnectedCardsClient, Conto, ContoAdmin, type ContoAdminConfig, ContoAdminError, type ContoConfig, ContoError, type ContoRequestOptions, type ControlledExternalCardPaymentResult, ControlledExternalCardPaymentTool, type CreateAgentInput, type CreatePolicyInput, type CreatePolicyRuleInput, type CreateSdkKeyInput, type CreateSdkKeyResult, type CreateWalletInput, type CustodyType, type CustomerCustodyMode, type CustomerWalletControlModel, type CustomerWalletKeyAccess, type DelegationType, type ExecuteCommerceExecutionResult, type ExternalCard, type ExternalCardApprovalInput, type ExternalCardApprovalResult, type ExternalCardConfirmationInput, ExternalCardConfirmationPendingError, type ExternalCardConfirmationResult, type ExternalCardExecutionClaimResult, type ExternalCardExecutionResult, type ExternalCardExecutor, type ExternalCardOverlayEnforcement, type ExternalCardRequestStatusResult, type ExternalWalletApprovalInput, type ExternalWalletApprovalResult, type ExternalWalletConfirmationInput, type ExternalWalletConfirmationResult, type FreezeAgentInput, Conto as Giro, type ContoConfig as GiroConfig, ContoError as GiroError, type GuardCheckoutResult, type GuardedBrowserDispatchResult, type GuardedCheckoutInput, type LinkWalletInput, type ListAgentsParams, type ListAgentsResponse, type ListPoliciesParams, type ListPoliciesResponse, type ListPolicyVersionsResponse, type ListWalletsParams, type ListWalletsResponse, type MppBudgetResult, type MppPreAuthorizeInput, type MppPreAuthorizeResult, type MppRecordInput, type MppRecordResult, type NormalizeCommerceProposalInput, type OrganizationMember, type PaginatedResponse, type PaginationParams, type PauseExternalCardAssignmentResult, type PaymentExecuteResult, type PaymentRequestInput, type PaymentRequestResult, type PaymentStatusResult, type Policy, type PolicyRule, type PolicyType, type PolicyVersionChangeType, type PolicyVersionDetail, type PolicyVersionDiff, type PolicyVersionFieldChange, type PolicyVersionSnapshot, type PolicyVersionSnapshotRule, type PolicyVersionSummary, type PrivilegedBrowserCheckoutDriver, type ProtocolBudgetResult, type ProtocolPreAuthorizeResult, type ProtocolRecordGrant, type ProtocolRecordGrantResult, type ProtocolServiceSummary, type ProtocolServicesResult, type ProvisionWalletResult, type RefreshBalanceResult, type RegisterExternalCardInput, type ReportCheckoutOutcomeInput, type RollbackPolicyVersionResponse, type RuleAction, type RuleOperator, type RuleType, type RunGuardedCheckoutResult, type SdkKey, type SdkKeyType, type SetupCapabilityState, type SetupCardDiagnostics, type SetupDiagnosticAction, type SetupDiagnosticIssue, type SetupDiagnosticIssueCode, type SetupDiagnostics, type SetupWalletDiagnostics, type TestCardCredential, type TestCardDrawResult, type TestCardDrawable, type TestCardListResult, type TestCardReceipt, TestCardsClient, type TestCheckoutInput, type TestCheckoutResult, type TestMerchant, type TestMerchantProduct, type UnfreezeAgentInput, type UpdateAgentInput, type UpdateExternalCardAssignmentInput, type UpdatePolicyInput, type UpdatePolicyRuleInput, type UpdateWalletInput, type VerifiedBrowserCheckoutTarget, type WaitForCheckoutApprovalOptions, type Wallet, type WalletChainBalanceSnapshot, type WalletStatus, type WalletType, type X402Authorization, type X402BudgetResult, type X402PayInput, type X402PayResult, type X402PaymentRequirements, type X402PreAuthorizeInput, type X402PreAuthorizeResult, type X402RecordInput, type X402RecordResult, canonicalizeBrowserCheckoutTarget, createVerifiedBrowserCheckoutDriver, Conto as default, fingerprintBrowserCheckoutTarget };
3401
+ export { type AdminExternalCardOverlayEnforcement, AdminPurchasingClient, type Agent, type AgentCheckoutAction, type AgentCheckoutActionKind, type AgentExternalCard, type AgentSetupResult, type AgentStatus, type AgentType, type AgentWalletLink, type ApprovedExternalCardExecution, type AssignExternalCardInput, type AssignedPolicy, type AuthorizeCheckoutActionResult, type BeginCheckoutCheckpointInput, type BeginCommerceExecutionInput, type BrowserActionClaimResult, type BrowserActionDispatchObservationInput, BrowserActionFinalizationPendingError, type BrowserActionFinalizeResult, type BrowserCheckoutAction, type BrowserCheckoutTargetResolver, type BrowserCheckoutTargetSnapshot, type BrowserCheckoutTargetVerificationCode, BrowserCheckoutTargetVerificationError, type CancellationOutcome, type CanonicalBrowserCheckoutTargetSnapshot, CardsClient, type ChainType, type CheckoutActionAuthorization, CheckoutApprovalDeniedError, CheckoutApprovalExpiredError, CheckoutApprovalPendingError, CheckoutApprovalTimeoutError, type CheckoutCheckpoint, type CheckoutCheckpointApproval, CheckoutCheckpointClosedError, type CheckoutCheckpointMethod, type CheckoutCheckpointNextAction, type CheckoutCheckpointStage, CheckoutClient, type CheckoutOutcome, type CommerceCheckoutMethod, type CommerceContextRequirement, type CommerceExecution, type CommerceExecutionAdapterKind, type CommerceExecutionArtifactKind, type CommerceExecutionChannel, type CommerceExecutionConstraint, type CommerceExecutionConstraintCoverage, type CommerceExecutionConstraintCoverageLevel, type CommerceExecutionDeliveryMode, type CommerceExecutionEvidence, type CommerceExecutionProvider, type CommerceExecutionResult, type CommerceExecutionSourceKind, type CommerceExecutionStatus, type CommerceFactConfidence, type CommerceFactProvenanceInput, type CommerceFactSource, type CommerceFulfillmentInput, type CommerceLineItemInput, type CommerceProposalFactKey, type CommerceProposalMissingFact, type CommerceProposalResolution, type CommerceProposalState, type CommerceSettlementRail, type CommerceTotalInput, type CommerceTotalType, type ComparePolicyVersionsResponse, type ConfirmCheckoutCheckpointInput, type ConnectedCardBrief, type ConnectedCardCredential, type ConnectedCardDrawInput, type ConnectedCardDrawMerchant, type ConnectedCardDrawResult, type ConnectedCardDrawable, type ConnectedCardListResult, type ConnectedCardMandate, type ConnectedCardMandateMerchant, type ConnectedCardOutcomeReport, type ConnectedCardOutcomeReportResult, type ConnectedCardReference, ConnectedCardsClient, Conto, ContoAdmin, type ContoAdminConfig, ContoAdminError, type ContoConfig, ContoError, type ContoRequestOptions, type ControlledExternalCardPaymentResult, ControlledExternalCardPaymentTool, type CreateAgentInput, type CreatePolicyInput, type CreatePolicyRuleInput, type CreatePurchaseInput, type CreateSdkKeyInput, type CreateSdkKeyResult, type CreateWalletInput, type CustodyType, type CustomerCustodyMode, type CustomerWalletControlModel, type CustomerWalletKeyAccess, type DelegationType, type ExecuteCommerceExecutionResult, type ExternalCard, type ExternalCardApprovalInput, type ExternalCardApprovalResult, type ExternalCardConfirmationInput, ExternalCardConfirmationPendingError, type ExternalCardConfirmationResult, type ExternalCardExecutionClaimResult, type ExternalCardExecutionResult, type ExternalCardExecutor, type ExternalCardOverlayEnforcement, type ExternalCardRequestStatusResult, type ExternalWalletApprovalInput, type ExternalWalletApprovalResult, type ExternalWalletConfirmationInput, type ExternalWalletConfirmationResult, type FreezeAgentInput, Conto as Giro, type ContoConfig as GiroConfig, ContoError as GiroError, type GuardCheckoutResult, type GuardedBrowserDispatchResult, type GuardedCheckoutInput, type LinkWalletInput, type ListAgentsParams, type ListAgentsResponse, type ListPoliciesParams, type ListPoliciesResponse, type ListPolicyVersionsResponse, type ListWalletsParams, type ListWalletsResponse, type MppBudgetResult, type MppPreAuthorizeInput, type MppPreAuthorizeResult, type MppRecordInput, type MppRecordResult, type NormalizeCommerceProposalInput, type OrganizationMember, OrganizationPurchasesClient, OrganizationRecurringPurchasesClient, type PaginatedResponse, type PaginationParams, type PauseExternalCardAssignmentResult, type PaymentExecuteResult, type PaymentRequestInput, type PaymentRequestResult, type PaymentStatusResult, type Policy, type PolicyRule, type PolicyType, type PolicyVersionChangeType, type PolicyVersionDetail, type PolicyVersionDiff, type PolicyVersionFieldChange, type PolicyVersionSnapshot, type PolicyVersionSnapshotRule, type PolicyVersionSummary, type PrivilegedBrowserCheckoutDriver, type ProtocolBudgetResult, type ProtocolPreAuthorizeResult, type ProtocolRecordGrant, type ProtocolRecordGrantResult, type ProtocolServiceSummary, type ProtocolServicesResult, type ProvisionWalletResult, type Purchase, type PurchaseAction, type PurchaseActionAuthority, type PurchaseActionKind, type PurchaseBuyer, type PurchaseDelegation, type PurchaseEvent, type PurchaseEventPage, type PurchaseEvidence, type PurchaseHostedLink, type PurchaseItem, type PurchaseList, type PurchaseMoney, type PurchasePaymentMethod, type PurchasePhase, type PurchaseResponseAck, type PurchaseStatus, PurchasesClient, type PurchasingCapabilities, type RecurringPurchase, type RecurringPurchaseCycleResult, type RecurringPurchaseCycleStatus, RecurringPurchasesClient, type RefreshBalanceResult, type RegisterExternalCardInput, type ReportCheckoutOutcomeInput, type RollbackPolicyVersionResponse, type RuleAction, type RuleOperator, type RuleType, type RunGuardedCheckoutResult, type SdkKey, type SdkKeyType, type SetupCapabilityState, type SetupCardDiagnostics, type SetupDiagnosticAction, type SetupDiagnosticIssue, type SetupDiagnosticIssueCode, type SetupDiagnostics, type SetupWalletDiagnostics, type TestCardCredential, type TestCardDrawResult, type TestCardDrawable, type TestCardListResult, type TestCardReceipt, TestCardsClient, type TestCheckoutInput, type TestCheckoutResult, type TestMerchant, type TestMerchantProduct, type UnfreezeAgentInput, type UpdateAgentInput, type UpdateExternalCardAssignmentInput, type UpdatePolicyInput, type UpdatePolicyRuleInput, type UpdateWalletInput, type VerifiedBrowserCheckoutTarget, type WaitForCheckoutApprovalOptions, type Wallet, type WalletChainBalanceSnapshot, type WalletStatus, type WalletType, type WatchPurchaseOptions, type X402Authorization, type X402BudgetResult, type X402PayInput, type X402PayResult, type X402PaymentRequirements, type X402PreAuthorizeInput, type X402PreAuthorizeResult, type X402RecordInput, type X402RecordResult, canonicalizeBrowserCheckoutTarget, createVerifiedBrowserCheckoutDriver, Conto as default, fingerprintBrowserCheckoutTarget, isFinalPurchaseStatus, parseServerSentEvents, verifyPurchaseWebhook };