@agent-cards/sdk 0.21.0 → 0.23.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.
Files changed (113) hide show
  1. package/CHANGELOG.md +87 -2
  2. package/PREFLIGHT.md +32 -0
  3. package/README.md +1177 -23
  4. package/dist/aci.d.ts +173 -0
  5. package/dist/aci.generated.d.ts +87 -0
  6. package/dist/aci.generated.js +306 -0
  7. package/dist/aci.js +371 -0
  8. package/dist/adyen-merchant-hosted.generated.d.ts +3 -3
  9. package/dist/adyen-merchant-hosted.generated.js +302 -56
  10. package/dist/agentcard.d.ts +9 -2
  11. package/dist/agentcard.js +4 -2
  12. package/dist/amadeus-checkout.generated.d.ts +57 -0
  13. package/dist/amadeus-checkout.generated.js +549 -0
  14. package/dist/amadeus.d.ts +41 -0
  15. package/dist/amadeus.js +81 -0
  16. package/dist/builtin-registry.generated.js +1 -1
  17. package/dist/card-endpoint-facts.d.ts +96 -0
  18. package/dist/card-endpoint-facts.js +275 -0
  19. package/dist/card-endpoint-page.d.ts +54 -0
  20. package/dist/card-endpoint-page.js +69 -0
  21. package/dist/card-endpoint.d.ts +298 -0
  22. package/dist/card-endpoint.js +438 -0
  23. package/dist/card-fields.generated.d.ts +5 -3
  24. package/dist/card-fields.generated.js +284 -7
  25. package/dist/cdp.d.ts +5 -1
  26. package/dist/cdp.js +1155 -141
  27. package/dist/client.d.ts +456 -20
  28. package/dist/client.js +1072 -104
  29. package/dist/creditguard.generated.d.ts +79 -0
  30. package/dist/creditguard.generated.js +662 -0
  31. package/dist/cse-body.js +11 -1
  32. package/dist/cybersource-flex.d.ts +30 -0
  33. package/dist/cybersource-flex.generated.d.ts +27 -1
  34. package/dist/cybersource-flex.generated.js +42 -2
  35. package/dist/cybersource-flex.js +46 -0
  36. package/dist/datatrans.d.ts +96 -0
  37. package/dist/datatrans.generated.d.ts +64 -0
  38. package/dist/datatrans.generated.js +426 -0
  39. package/dist/datatrans.js +178 -0
  40. package/dist/ekashu.d.ts +35 -0
  41. package/dist/ekashu.js +55 -0
  42. package/dist/elavon-converge.d.ts +37 -0
  43. package/dist/elavon-converge.generated.d.ts +49 -0
  44. package/dist/elavon-converge.generated.js +439 -0
  45. package/dist/elavon-converge.js +84 -0
  46. package/dist/eprotect.d.ts +152 -0
  47. package/dist/eprotect.generated.d.ts +77 -0
  48. package/dist/eprotect.generated.js +498 -0
  49. package/dist/eprotect.js +222 -0
  50. package/dist/hosted-form.d.ts +3 -2
  51. package/dist/hosted-form.js +3 -2
  52. package/dist/index.d.ts +17 -3
  53. package/dist/index.js +6 -1
  54. package/dist/juspay-gate.d.ts +82 -0
  55. package/dist/juspay-gate.js +126 -0
  56. package/dist/juspay.generated.d.ts +89 -0
  57. package/dist/juspay.generated.js +705 -0
  58. package/dist/lifecycle.d.ts +60 -6
  59. package/dist/lifecycle.js +122 -8
  60. package/dist/merchant-card-endpoints.generated.d.ts +122 -0
  61. package/dist/merchant-card-endpoints.generated.js +4261 -0
  62. package/dist/merchant-hosted.d.ts +4 -1
  63. package/dist/merchant-hosted.js +5 -2
  64. package/dist/merchant-session-probe.d.ts +48 -0
  65. package/dist/merchant-session-probe.js +53 -0
  66. package/dist/merchant-session.generated.d.ts +69 -0
  67. package/dist/merchant-session.generated.js +919 -0
  68. package/dist/payrails.d.ts +133 -0
  69. package/dist/payrails.generated.d.ts +73 -0
  70. package/dist/payrails.generated.js +596 -0
  71. package/dist/payrails.js +305 -0
  72. package/dist/pelecard.d.ts +32 -0
  73. package/dist/pelecard.generated.d.ts +32 -0
  74. package/dist/pelecard.generated.js +283 -0
  75. package/dist/pelecard.js +42 -0
  76. package/dist/pre-claim.d.ts +81 -2
  77. package/dist/pre-claim.js +1023 -5
  78. package/dist/preflight-catalog.json +2267 -288
  79. package/dist/preflight-schemas.json +183 -6
  80. package/dist/preflight.generated.d.ts +1 -1
  81. package/dist/preflight.generated.js +243 -4
  82. package/dist/preparation.d.ts +12 -3
  83. package/dist/preparation.js +63 -12
  84. package/dist/prepared-processor.d.ts +84 -5
  85. package/dist/prepared-processor.js +147 -6
  86. package/dist/primer.d.ts +53 -0
  87. package/dist/primer.generated.d.ts +38 -0
  88. package/dist/primer.generated.js +624 -0
  89. package/dist/primer.js +82 -0
  90. package/dist/registry.d.ts +100 -8
  91. package/dist/registry.js +85 -11
  92. package/dist/shiji-sts.d.ts +144 -0
  93. package/dist/shiji-sts.generated.d.ts +72 -0
  94. package/dist/shiji-sts.generated.js +913 -0
  95. package/dist/shiji-sts.js +222 -0
  96. package/dist/stripe-checkout.generated.d.ts +1 -1
  97. package/dist/stripe-checkout.generated.js +764 -9
  98. package/dist/stripe-setup.d.ts +16 -0
  99. package/dist/stripe-setup.js +61 -0
  100. package/dist/substitutions.generated.js +187 -29
  101. package/dist/verifone.d.ts +68 -0
  102. package/dist/verifone.generated.d.ts +51 -0
  103. package/dist/verifone.generated.js +1413 -0
  104. package/dist/verifone.js +119 -0
  105. package/dist/voice-types.d.ts +27 -0
  106. package/dist/voice.d.ts +6 -1
  107. package/dist/voice.js +6 -1
  108. package/dist/wspay.d.ts +41 -0
  109. package/dist/wspay.generated.d.ts +41 -0
  110. package/dist/wspay.generated.js +370 -0
  111. package/dist/wspay.js +65 -0
  112. package/examples/preflight/kernel-native/inventory.json +1 -1
  113. package/package.json +3 -3
package/dist/client.d.ts CHANGED
@@ -3,11 +3,16 @@ import type { Substitutions } from './substitute.js';
3
3
  import { type MerchantHostedSubstitutions, type MerchantProfile, type SandboxMerchantDeclaration } from './merchant-hosted.js';
4
4
  import { type MerchantTotalApproved, type MerchantTotalCapture } from './merchant-total.js';
5
5
  import { type PreparationMode, type PreparationProcessor } from './prepared-processor.js';
6
+ import { type VerifoneProfile, type VerifoneSubstitutions } from './verifone.js';
7
+ import { type MerchantSessionCapture } from './merchant-session-probe.js';
6
8
  import { VoiceModule, type VoiceOptions } from './voice.js';
7
9
  import { BuyModule } from './buy.js';
8
10
  import { RequestRegistry } from './requests.js';
9
11
  import type { ApiTransport } from './api-module.js';
10
- import { type MicroformSidecar } from './cybersource-flex.js';
12
+ import { type MicroformField, type MicroformSidecar } from './cybersource-flex.js';
13
+ import { type CardEndpointSession } from './card-endpoint.js';
14
+ import type { CardEndpointFactsRecord } from './card-endpoint-facts.js';
15
+ import { type PayrailsSidecar } from './payrails.js';
11
16
  export interface PausedRequest {
12
17
  url: string;
13
18
  method: string;
@@ -23,11 +28,33 @@ export interface PausedRequest {
23
28
  capture_context?: string;
24
29
  /** CyberSource Flex only: the Microform fields that loaded and the one that sent this request. */
25
30
  microform?: MicroformSidecar;
31
+ /**
32
+ * A reviewed merchant's own card endpoint (see card-endpoint.ts): the profile and the
33
+ * paused request's session, which the adapters capture, and, for a merchant that keeps
34
+ * its own record of the order, that record as the adapters read it from the page, cut
35
+ * to the values payment-core's reader reads (card-endpoint-facts.ts). Cardholder data:
36
+ * it travels only in the create's `merchant_card_endpoint` member, never in `request`.
37
+ */
38
+ merchant_card_endpoint?: {
39
+ profile: string;
40
+ session: CardEndpointSession;
41
+ facts?: CardEndpointFactsRecord;
42
+ };
43
+ /**
44
+ * A Payrails card save (mode device_encrypt) only: the session key the page's
45
+ * Payrails init payload named (vaultConfiguration.encryptionPublicKey), which
46
+ * the save itself does not carry. The adapters capture it; a caller running
47
+ * its own interception passes it here, and a save without it is refused
48
+ * before anything is created.
49
+ */
50
+ payrails?: PayrailsSidecar;
26
51
  }
27
52
  /**
28
53
  * The modes this SDK can finish. Asked for on syncRegistry (the API serves
29
54
  * only recognizers in these modes, so a request this build cannot complete
30
- * is never paused) and sent on every create.
55
+ * is never paused) and sent on every create. `device_encrypt`: the adapters
56
+ * capture the Payrails session key the page's init payload names (payrails.ts),
57
+ * and the cardholder's device encrypts and sends the save.
31
58
  */
32
59
  export declare const SUPPORTED_MODES: readonly CheckoutMode[];
33
60
  /**
@@ -59,6 +86,96 @@ export declare const SUPPORTED_REGISTRY_FEATURES: readonly string[];
59
86
  * serves Flex's recognizer the same way, only for a company Agentcard turned it on for.
60
87
  * A gated recognizer is never in BUILTIN_REGISTRY, so a build reaches it only through a
61
88
  * sync that declares its capability.
89
+ * `juspay_txns.v1`: Juspay's card flow (juspay-gate.ts), whose page tokenize
90
+ * this build answers locally and whose /txns it pauses, served and refused by
91
+ * the same rule. A gated recognizer is never in BUILTIN_REGISTRY, so a build
92
+ * reaches it only through a sync that declares its capability.
93
+ * `datatrans_secure_fields_tokenize`: Datatrans Secure Fields' TOKENIZE card
94
+ * post, which this build judges before it pauses, under the card-on-file
95
+ * policy served with the entry, and answers again for a repeat of the same
96
+ * form (datatrans.ts). A gated recognizer never sits in BUILTIN_REGISTRY, so
97
+ * it is paused only after a sync.
98
+ * `authorize_net_dpm_form`: the Authorize.Net Direct Post Method and SIM card
99
+ * form, one form navigation to transact.dll that the cardholder's device submits
100
+ * itself (hosted_form). This build finishes it with the hosted_form flow it
101
+ * already speaks, holds the bare endpoint the entry names (bareEndpoint in
102
+ * findRecognizer), and reads the form's keys without regard to case
103
+ * (card-fields.js). The API serves it, like Fiserv's, only to an org Agentcard
104
+ * enabled for that processor; every other org is served the ungated catalog.
105
+ * `pelecard_transaction`: Pelecard's card submission, which this build judges
106
+ * before it pauses (pelecard.ts) and pays only for the amount the agent passes.
107
+ * Declaring it is not enough: the API serves a gated recognizer only to an org
108
+ * Agentcard has enabled for that processor, so for every other org this build
109
+ * syncs the same catalog as one that declares nothing and leaves the processor's
110
+ * requests alone. A gated recognizer never sits in BUILTIN_REGISTRY, so it is
111
+ * paused only after a sync.
112
+ * `aci_split_card.v1`: ACI's COPYandPAY widget, whose card reaches ACI as
113
+ * several requests to one checkout. This build pauses the card-number request
114
+ * for a prepared checkout, holds the page's own CVC and expiry requests and
115
+ * answers them with that request's answer, and continues the page's /payment
116
+ * submission once, with the placeholder expiry removed (aci.ts). A gated
117
+ * recognizer is never in BUILTIN_REGISTRY, so a build reaches it only through a
118
+ * sync that declares its capability, and whether an org may pay through it
119
+ * stays the API's decision.
120
+ * `creditguard_pps_process`: CreditGuard's hosted payment page (Hyp PPS), whose
121
+ * card submit this build pays only under a prepared checkout that names the
122
+ * framed page (prepare({ psp: 'creditguard', environment, paymentPageUrl })). The
123
+ * API serves CreditGuard's recognizer on the same terms as Fiserv's.
124
+ * `primer_payment_instruments`: Primer's card tokenization, which this build
125
+ * judges before it pauses (primer.ts) and hands back to the page only as a
126
+ * single-use token. A merchant's client session can save the card after the
127
+ * payment with no sign in that request, so the API creates a Primer
128
+ * authorization only for a test-mode client and refuses a live one (400
129
+ * invalid_primer_request, live_keep_on_file) until the cardholder can consent
130
+ * to that save; this build then aborts the paused request with nothing sent. A
131
+ * gated recognizer never sits in BUILTIN_REGISTRY, so it is paused only after a
132
+ * sync.
133
+ * `payrails_device_encrypt`: Payrails' card-form save, which this build pauses
134
+ * only once it has bound the save to a captured session (payrails.ts). A gated
135
+ * recognizer never sits in BUILTIN_REGISTRY, so it is paused only after a sync.
136
+ * `converge_hpp_process`: Elavon Converge's Hosted Payment Page card request
137
+ * (elavon-converge.ts), paused in token mode and judged by the pre-claim gate.
138
+ * A gated recognizer never sits in BUILTIN_REGISTRY, so it is paused only after a
139
+ * sync, and the API also refuses a Converge payment for every company the
140
+ * processor is off for.
141
+ * `worldpay_eprotect_jsonp`: Worldpay eProtect, whose card rides in the query of
142
+ * a JSONP <script> GET that this build pauses, binds to a prepared checkout and
143
+ * answers with the registration in the script's own callback (eprotect.ts). A
144
+ * gated recognizer is never in BUILTIN_REGISTRY, so a build reaches either only
145
+ * through a sync that declares its capability, and the API serves it on that
146
+ * sync only for a company it has turned the processor on for.
147
+ * `wspay_confirm`: WSPay Components' card confirm, which this build judges
148
+ * before it pauses (wspay.ts) and pays only for the amount the agent passes.
149
+ * The API serves a gated recognizer only to a build that lists its capability
150
+ * and only for a company Agentcard turned that processor on for, so an older
151
+ * SDK never pauses a request it cannot finish and no SDK pauses one for a
152
+ * company the processor is off for; the API also refuses that processor's
153
+ * payment for every such company. A gated recognizer never sits in
154
+ * BUILTIN_REGISTRY, so it is paused only after a sync.
155
+ * `shiji_sts_pinned_key`: this build swaps Shiji STS's ciphertexts at the body
156
+ * root under the pinned key, binds the getCvvId companion to the getTokenId it
157
+ * continued, and refuses every other Shiji request in the browser (shiji-sts.ts).
158
+ * The API serves it on the same terms, only for a company Agentcard turned Shiji
159
+ * STS on for.
160
+ * `amadeus_checkout_actions.v1`: Amadeus Checkout (the Checkout Web SDK add and
161
+ * the Data Collection Page store), served on the same terms. This build lets every
162
+ * other action on those URLs through without claiming a preparation, so the page's
163
+ * own `load` never spends or blocks one, takes the card request only through a
164
+ * prepared checkout bound to the approved page's host, and fails a paused SDK add
165
+ * the device has not started 20 seconds after the pause (AMADEUS_SEND_WINDOW_MS).
166
+ * `worldline_mycheckout_form`: Worldline MyCheckout's card form (DHL Express),
167
+ * a top-level form POST this build holds like Tranzila's (mode hosted_form) and
168
+ * answers with the submission notice once the cardholder's device submitted the
169
+ * form itself. The page's cancel and its other payment methods on the same URL
170
+ * carry no card and continue untouched. The API serves the recognizer only to a
171
+ * build that lists it and only for a company Agentcard turned it on for.
172
+ * `verifone_card_capture`: a reviewed Verifone merchant's own card request (a
173
+ * verifone.js blob sent to the merchant's server), which this build pauses and pays
174
+ * only through a prepared checkout (verifone.ts); the API serves the Verifone
175
+ * profiles only to a build that lists it, for a company Agentcard turned Verifone on for.
176
+ * `ekashu_hosted_payment_page`: NMI's hosted payment page, whose card-free entry this
177
+ * build pauses for the cardholder's device and whose card page this build never lets
178
+ * the agent's browser post to (pre-claim.ts, ekashu.ts); served on the same terms.
62
179
  */
63
180
  export declare const SUPPORTED_CAPABILITIES: readonly string[];
64
181
  /**
@@ -77,6 +194,17 @@ export declare const SUPPORTED_CAPABILITIES: readonly string[];
77
194
  export type AmountAuthority = 'processor' | 'agent' | 'page' | 'none';
78
195
  /** An integer in the smallest unit, or a decimal string in normal units with a point; nothing else. */
79
196
  export declare function validAmountInput(amount: unknown): amount is number | string;
197
+ /** Digits after the point when the API reads an amount in `currency`. */
198
+ export declare function amountDigits(currency: string): 0 | 2 | 3;
199
+ /**
200
+ * Why an amount is refused, worded for the agent that sent it: the rule, the value it passed, and
201
+ * each amount that value can mean, in the forms the API accepts. An agent told only the rule sends
202
+ * the same value again, and a tool harness that serializes every argument as text turns 2667 into
203
+ * "2667" on each try. A value that does not read as a price (long, or more digits than any amount)
204
+ * is described and never echoed, so a card number typed into the wrong field cannot reach a log
205
+ * line. A value below zero is named as such and never offered back as a positive amount.
206
+ */
207
+ export declare function amountRefusal(amount: unknown, currency?: unknown): string;
80
208
  /** How an existing authorization is being handled; omitted by older APIs. */
81
209
  export interface ExecutionMetadata {
82
210
  executionMode?: 'user_approval' | 'autopilot';
@@ -140,6 +268,14 @@ export interface CseReplay extends ExecutionMetadata {
140
268
  kind?: undefined;
141
269
  authorizationId: string;
142
270
  substitutions: Substitutions;
271
+ /**
272
+ * Shiji STS only: the getCvvId keySequence values the API reviewed as the booking page's own and
273
+ * served beside the set (`shiji_sts_companion`). The adapters bind the companion getCvvId to them
274
+ * (shiji-sts.ts ShijiStsCompanions), so the device's CVV goes under no other key.
275
+ */
276
+ shijiStsCompanion?: Readonly<{
277
+ keySequences: readonly string[];
278
+ }>;
143
279
  amountAuthority?: AmountAuthority;
144
280
  }
145
281
  /**
@@ -176,6 +312,29 @@ export interface MerchantHostedReplay extends ExecutionMetadata {
176
312
  merchantTotal?: MerchantTotalApproved;
177
313
  amountAuthority?: AmountAuthority;
178
314
  }
315
+ /**
316
+ * The cse flow at a reviewed Verifone merchant's OWN endpoint (verifone.ts): the
317
+ * cardholder's device encrypted the card with verifone.js's format under the key
318
+ * Agentcard pinned for that merchant, and nothing was sent. The paused request
319
+ * continues from this browser with the device's blob in place of the page's
320
+ * (substituteVerifoneBody), and only when the live body still hashes to
321
+ * `bodySha256`, the body the API checked at create. The merchant's server charges
322
+ * the card and answers its own page; its order state is the outcome. Only a
323
+ * prepared checkout pays one, never Autopilot.
324
+ */
325
+ export interface VerifoneReplay extends ExecutionMetadata {
326
+ mode: 'cse';
327
+ kind: 'verifone';
328
+ authorizationId: string;
329
+ /** The reviewed Verifone profile the approval pays. */
330
+ profile: string;
331
+ substitutions: VerifoneSubstitutions;
332
+ /** SHA-256 (lowercase hex) of the paused body the API checked at create. */
333
+ bodySha256: string;
334
+ /** When the API stops serving this blob, if it said. */
335
+ substitutionsExpiresAt: string | null;
336
+ amountAuthority?: AmountAuthority;
337
+ }
179
338
  /**
180
339
  * The hosted_form flow (Tranzila): the cardholder's device rebuilt the
181
340
  * processor's own form with the real card and submitted it itself, top-level,
@@ -204,8 +363,55 @@ export interface HostedFormReplay extends ExecutionMetadata {
204
363
  submittedAt: string;
205
364
  amountAuthority?: AmountAuthority;
206
365
  }
366
+ /**
367
+ * The card_endpoint flow: a reviewed merchant's own card endpoint. The cardholder's
368
+ * device sent the merchant's card request itself, with the real card and the paused
369
+ * request's session, and reported the merchant's answer, which the adapters hand to
370
+ * the paused request: `status`, the profile's answer `headers`, and `body`, with
371
+ * `setCookies` written into the agent's browser on the endpoint host, or on the parent
372
+ * domain of a cookie the browser already holds there, which the write replaces.
373
+ *
374
+ * `withheld` is set when the device found the card in the answer, a compressed
375
+ * stream it cannot read, or a step the review refuses (FastSpring's EBANX step): nothing
376
+ * of the answer travels, the adapters answer the paused request with a fixed error, and
377
+ * the outcome is unknown until the merchant order is checked. The card request was sent
378
+ * either way. Amounts are not reconciled on this mode: the agent's amount is the only
379
+ * authority, held before the create to the merchant's own total where its page keeps one.
380
+ */
381
+ export interface CardEndpointReplay extends ExecutionMetadata {
382
+ mode: 'card_endpoint';
383
+ authorizationId: string;
384
+ /** The reviewed profile the device paid. */
385
+ profile: string;
386
+ /** The merchant's HTTP status for the card request. */
387
+ status: number;
388
+ headers: Record<string, string>;
389
+ setCookies: string[];
390
+ body: string;
391
+ withheld: 'card_in_response' | 'unreadable_in_response' | 'refused_step_in_response' | null;
392
+ amountAuthority?: AmountAuthority;
393
+ }
394
+ /**
395
+ * The device_encrypt flow (Payrails): the cardholder's device encrypted the
396
+ * real card under the session key the page's init payload named and sent the
397
+ * save to Payrails itself. This is Payrails' 201 for that save, rebuilt from an
398
+ * allow-list (the instrument's identifiers, its status, the network, the BIN
399
+ * cut to six digits, the last four, the expiry, the holder name and the
400
+ * fingerprint), to replay into the paused request as in the token flow. The
401
+ * ciphertext the device made never reaches the runtime or the page. Never an
402
+ * autopilot result: autopilot refuses this mode.
403
+ */
404
+ export interface DeviceEncryptReplay extends ExecutionMetadata {
405
+ mode: 'device_encrypt';
406
+ authorizationId: string;
407
+ status: number;
408
+ headers: Record<string, string>;
409
+ /** Body to hand back to the browser, verbatim. */
410
+ body: string;
411
+ amountAuthority?: AmountAuthority;
412
+ }
207
413
  /** What authorize() resolves with; branch on `mode` (absent means token). */
208
- export type ReplayResponse = TokenReplay | CseReplay | MerchantHostedReplay | HostedFormReplay;
414
+ export type ReplayResponse = TokenReplay | CseReplay | MerchantHostedReplay | VerifoneReplay | HostedFormReplay | CardEndpointReplay | DeviceEncryptReplay;
209
415
  export interface PrepareCheckoutOptions {
210
416
  psp: PreparationProcessor;
211
417
  /** The processor environment, independent of your Agentcard client's mode. */
@@ -222,10 +428,53 @@ export interface PrepareCheckoutOptions {
222
428
  * approve a payment to the merchant that key belongs to, so the checkout's `merchant`
223
429
  * must be that merchant's name (`Agentcard sandbox` for `agentcard_sandbox`), and the
224
430
  * one card capture this preparation pays must carry an envelope under that key.
431
+ *
432
+ * A Verifone checkout (psp 'verifone'): the id of the Verifone profile Agentcard
433
+ * reviewed for the merchant, which this client must have armed and enabled
434
+ * (syncRegistry), in the profile's own environment. The cardholder is shown the
435
+ * merchant the profile names, whatever label `merchant` carries, and the profile's
436
+ * reviewed card request is the one request this preparation pays.
225
437
  */
226
438
  merchantProfile?: string;
439
+ /**
440
+ * CreditGuard only, and required there: the address of CreditGuard's hosted
441
+ * payment page the checkout framed, the iframe's `src` as CreditGuard handed
442
+ * it to the merchant (https://pps.creditguard.co.il/?txId=<transaction id>;
443
+ * pps2 is production too, ppsuat is the sandbox). Agentcard reads that
444
+ * transaction from CreditGuard before the cardholder is asked, and only that
445
+ * transaction's card submit can use the preparation.
446
+ */
447
+ paymentPageUrl?: string;
448
+ /**
449
+ * Worldpay eProtect only, and required there: the merchant's eProtect
450
+ * paypageId, 1 to 64 letters and digits. It names the Worldpay merchant the
451
+ * card registration is for, which is also the merchant Worldpay lets charge
452
+ * the card again, so it is fixed before the page sends anything: a
453
+ * registration naming another paypageId never spends the approval. Read it off
454
+ * the checkout before Pay (the Worldpay iframe's `payframe_<paypageId>_...`
455
+ * URL, or the merchant's eProtect configuration). Refused on every other
456
+ * processor.
457
+ */
458
+ paypageId?: string;
459
+ /**
460
+ * CyberSource Flex only: the cardholder's device tokenizes the card when it approves, before
461
+ * Pay, under the capture context of the card fields the page already loaded, so the page's
462
+ * createToken is answered at once. For a page that gives createToken only seconds (Alaska
463
+ * Airlines' flight checkout gives it three). Call prepare() once the card fields show; the
464
+ * attachment reads their capture context and fields and refuses with `microform_not_loaded`,
465
+ * `microform_ambiguous` or `microform_unsupported` when it cannot.
466
+ */
467
+ tokenizeBeforePay?: boolean;
227
468
  signal?: AbortSignal;
228
469
  }
470
+ /** A CyberSource Flex preparation that tokenizes before Pay: the loaded card field's capture context and fields. */
471
+ export interface PreparedCybersourceFlex {
472
+ captureContext: string;
473
+ microform: {
474
+ version: string;
475
+ fields: MicroformField[];
476
+ };
477
+ }
229
478
  export interface PrepareCheckoutInput extends PrepareCheckoutOptions {
230
479
  user: string;
231
480
  merchant: string;
@@ -238,6 +487,12 @@ export interface PrepareCheckoutInput extends PrepareCheckoutOptions {
238
487
  timeoutMs?: number;
239
488
  onPreparationCreated?: (id: string) => void;
240
489
  onApprovalUrl?: (url: string) => void;
490
+ /**
491
+ * CyberSource Flex, tokenized before Pay: the capture context and fields of the card Microform
492
+ * the page loaded (the attachments read them for prepare({ tokenizeBeforePay: true })). Verified
493
+ * here and by the API before any preparation exists.
494
+ */
495
+ cybersourceFlex?: PreparedCybersourceFlex;
241
496
  }
242
497
  /** Real user consent and an unlocked device; no processor request or payment yet. */
243
498
  export interface PreparedCheckout {
@@ -266,11 +521,34 @@ export interface PreparedCheckout {
266
521
  endpoint: string;
267
522
  clientKey: string;
268
523
  }>;
524
+ /** CreditGuard only: the hosted payment page whose transaction the cardholder approved. */
525
+ readonly paymentPageUrl?: string;
526
+ /** Worldpay eProtect only: the paypageId the API confirmed, the one merchant whose registration may spend this approval. */
527
+ readonly paypageId?: string;
528
+ /**
529
+ * CyberSource Flex, tokenized before Pay: the capture context and fields the cardholder's device
530
+ * tokenized the card under. Only a field request loaded under this context, with these fields,
531
+ * binds this preparation.
532
+ */
533
+ readonly cybersourceFlex?: Readonly<{
534
+ captureContext: string;
535
+ microform: Readonly<{
536
+ version: string;
537
+ fields: readonly MicroformField[];
538
+ }>;
539
+ }>;
269
540
  }
270
541
  export declare class CheckoutPreparationError extends Error {
271
542
  preparationId: string | null;
272
543
  reason: string;
273
- constructor(preparationId: string | null, reason: string);
544
+ /**
545
+ * The API's own reason code under `reason`, when it gave one: a CreditGuard
546
+ * transaction refused as `creditguard_transaction_refused` names what the
547
+ * Vault cannot finish here (`three_d_secure`, `otp`, `installments`, ...).
548
+ */
549
+ readonly detail?: string;
550
+ /** `explanation` follows the reason in the message: what the caller passed and what to send instead. */
551
+ constructor(preparationId: string | null, reason: string, detail?: string, explanation?: string);
274
552
  }
275
553
  export interface AuthorizeInput extends ExecutionMetadata {
276
554
  /** Native Checkout defaults to TEST; LIVE requires this explicit opt-in. */
@@ -292,9 +570,13 @@ export interface AuthorizeInput extends ExecutionMetadata {
292
570
  * smallest unit is refused with nothing charged (an AmountMismatchError;
293
571
  * `stage` says which check). Agentcard derives the display string; you
294
572
  * never send one. Both or neither: one without the other is refused.
295
- * Required when the processor's request names no amount at all (GMO): then
296
- * this pair is what the cardholder approves, and a request without it
297
- * throws AmountRequiredError before anything is created.
573
+ * Required when the processor's request names no amount at all (GMO,
574
+ * Pelecard, WSPay): then this pair is what the cardholder approves, and a
575
+ * request without it throws AmountRequiredError before anything is created.
576
+ * No Pelecard answer states an amount, so for Pelecard the page's total
577
+ * (`pageAmount`) is required beside it: see the README's Pelecard section.
578
+ * WSPay's answer is compared with it only when that answer names an amount;
579
+ * a 3-D Secure step names none (see the README's WSPay section).
298
580
  */
299
581
  amount?: number | string;
300
582
  currency?: string;
@@ -302,6 +584,9 @@ export interface AuthorizeInput extends ExecutionMetadata {
302
584
  * The total read off the checkout page, the lowest authority: used only
303
585
  * when neither the processor's request nor your hint names an amount. The
304
586
  * adapters fill it from `[data-agentcard-amount]` when a page carries one.
587
+ * Required for Pelecard, whose request names no amount: the API holds the
588
+ * agent's pair to it, and a Pelecard request without it throws
589
+ * PageAmountRequiredError before anything is created.
305
590
  */
306
591
  pageAmount?: {
307
592
  amount: number;
@@ -419,16 +704,35 @@ export declare class PreparationRequiredError extends Error {
419
704
  /**
420
705
  * The paused request names no amount and none was passed. A GMO card token
421
706
  * request carries no amount (the merchant's server charges the token later),
422
- * so the `amount` and `currency` you pass are what the cardholder approves.
423
- * Thrown locally before any create or prompt, and terminal: the same request
424
- * without an amount fails the same way. The API answers 400 amount_required
425
- * for the same case. A page total (`pageAmount`) does not count.
707
+ * and neither does a Pelecard card submission (the merchant's server bound it
708
+ * to the payment page when it created it) or a WSPay confirm (WSPay fixed it
709
+ * when the merchant's server created the payment), so the `amount` and
710
+ * `currency` you pass are what the cardholder approves, and for WSPay the
711
+ * figure the API compares with WSPay's answer when that answer names one (a
712
+ * 3-D Secure step names none). Thrown locally before any create or
713
+ * prompt, and terminal: the same request without an amount fails the same
714
+ * way. The API answers 400 amount_required for the same case. A page total
715
+ * (`pageAmount`) does not count.
426
716
  */
427
717
  export declare class AmountRequiredError extends Error {
428
718
  psp: string;
429
719
  readonly code: "amount_required";
430
720
  constructor(psp: string);
431
721
  }
722
+ /**
723
+ * The paused request names no amount, and the total its payment page shows
724
+ * (`pageAmount`) was not passed. Pelecard's merchant bound the total to the
725
+ * payment page when it created it, and no Pelecard request or answer states
726
+ * it, so the page's total is the one figure that ties the `amount` the
727
+ * cardholder approves to what the page charges. Thrown locally before any
728
+ * create or prompt; the API answers 400 page_amount_required for the same
729
+ * case. Not terminal: the page's next submission reads the total again.
730
+ */
731
+ export declare class PageAmountRequiredError extends Error {
732
+ psp: string;
733
+ readonly code: "page_amount_required";
734
+ constructor(psp: string);
735
+ }
432
736
  export declare class ApprovalTimeoutError extends Error {
433
737
  constructor(ms: number);
434
738
  }
@@ -442,6 +746,15 @@ export declare const RUNTIME_CANCEL_REASONS: readonly RuntimeCancelReason[];
442
746
  export declare class PaymentOutcomeUnknownError extends Error {
443
747
  authorizationId: string | null;
444
748
  reason: string;
749
+ /**
750
+ * False when the API confirmed it retired this authorization before any processor
751
+ * request started: authorize() cancels an authorization it could not finish (a card
752
+ * endpoint, a prepared or a native checkout, or a request the page abandoned), and the
753
+ * cancel came back with `processor_request_started: false`, so nothing reached the
754
+ * processor or the merchant. Null when that is not known. The controller still reads
755
+ * `outcome_unknown`; a card form navigation's page reads this to say nothing was sent.
756
+ */
757
+ processorRequestStarted: false | null;
445
758
  constructor(authorizationId: string | null, reason: string);
446
759
  }
447
760
  export declare class ApprovalDeclinedError extends Error {
@@ -689,9 +1002,20 @@ export declare class CheckoutApiError extends Error {
689
1002
  * already has, or already answered, the prompt for this submission, and
690
1003
  * once that prior authorization is declined or expired the same form is a
691
1004
  * new question. The adapters quiet the page's re-post the way they quiet a
692
- * decline instead of latching the attachment.
1005
+ * decline instead of latching the attachment. NOT a stale form fingerprint
1006
+ * either (isStaleFingerprint): the bytes of that form are refused for good,
1007
+ * but the merchant's page renders a fresh fingerprint on reload, so the
1008
+ * page's next form is a new question and is quieted the same way.
693
1009
  */
694
1010
  get permanent(): boolean;
1011
+ /**
1012
+ * True for a 400 `hosted_form_field_refused` whose reason is
1013
+ * `stale_fingerprint`: an Authorize.Net DPM or SIM form signed more than 40
1014
+ * minutes before the create, or ahead of the API's clock. Authorize.Net
1015
+ * would refuse that fingerprint itself, and the page renders a fresh one
1016
+ * when it reloads, so the refusal holds for this form only.
1017
+ */
1018
+ get isStaleFingerprint(): boolean;
695
1019
  }
696
1020
  /** The client-credentials exchange was refused: the RFC 6749 error, with the status the token endpoint answered. */
697
1021
  export declare class CheckoutAuthError extends Error {
@@ -703,6 +1027,13 @@ export declare class CheckoutAuthError extends Error {
703
1027
  * A URL as it may appear in an error message: origin + path only. A paused
704
1028
  * request's URL can carry a client secret in its query string, and error
705
1029
  * messages travel further than anyone intends (onEvent, logs, crash reports).
1030
+ * CreditGuard puts one in the path: on its hosts the transaction id after
1031
+ * /txn/ is that transaction's only credential (payment-core's creditguard.js),
1032
+ * so it reads {txId}, as does any other id-shaped segment there.
1033
+ * On the Monri and WSPay hosts the secret is a path segment, so it is replaced
1034
+ * with `{client_secret}`: https://proxy.wspay.biz/v2/payment/{client_secret}/confirm.
1035
+ * A string that is not a URL keeps the part before any `?` or `#`, with the
1036
+ * same segment masked.
706
1037
  */
707
1038
  export declare function redactUrl(raw: string): string;
708
1039
  export interface VaultClientOptions {
@@ -786,6 +1117,12 @@ export declare class VaultClient {
786
1117
  * in 'observe' until a sync reads that the API enabled it (armServedProfiles).
787
1118
  */
788
1119
  private merchantProfiles;
1120
+ /**
1121
+ * The reviewed Verifone profiles this client arms: only the ones the API served on the
1122
+ * last sync, which it serves only to a company Agentcard turned Verifone on for
1123
+ * (armServedVerifoneProfiles). None before a sync.
1124
+ */
1125
+ private verifoneProfiles;
789
1126
  /** This client's own sandbox declarations (sandboxMerchants), armed at construction, one per profile. */
790
1127
  private readonly declaredProfiles;
791
1128
  private readonly preparations;
@@ -837,10 +1174,26 @@ export declare class VaultClient {
837
1174
  find: (url: string) => Recognizer | null;
838
1175
  };
839
1176
  private mergedRegistry;
840
- /** The recogniser that claims a card request (`POST` to a recognised endpoint), or null; what a paused request names as `recognizer`. */
1177
+ /**
1178
+ * The recogniser that claims a card request, or null; what a paused request names as
1179
+ * `recognizer`. A POST to a recognised endpoint, or for a recognizer whose card request is a
1180
+ * GET (Worldpay eProtect) that exact GET, query included.
1181
+ */
841
1182
  recognizerOf(url: string, method?: string): Recognizer | null;
842
1183
  /** Refresh recognizers from the API so new PSPs work without a redeploy. */
843
1184
  syncRegistry(): Promise<void>;
1185
+ /**
1186
+ * The armed Verifone profile whose endpoint origin this URL is on, with its status on
1187
+ * this client; null for any other URL, and for every URL before a sync served one. The
1188
+ * adapters pause every request to that origin and judge it with
1189
+ * classifyVerifoneProfileRequest. A raw runtime that pauses one must never continue a
1190
+ * body carrying a verifone.js blob there unless authorize() paid it.
1191
+ */
1192
+ verifoneProfileOf(url: string): VerifoneProfile | null;
1193
+ /** The armed Verifone profile with this id, or null. */
1194
+ verifoneProfile(id: string): VerifoneProfile | null;
1195
+ /** Fetch.enable globs for every armed Verifone profile's endpoint origins; none before a sync served one. */
1196
+ verifoneProfileUrlPatterns(): string[];
844
1197
  /**
845
1198
  * The reviewed Adyen merchant profile whose card endpoint (or a sibling of it,
846
1199
  * the same path under another query) this URL is, with its status on this
@@ -860,21 +1213,52 @@ export declare class VaultClient {
860
1213
  * after syncRegistry; a sync changes only a profile's status.
861
1214
  */
862
1215
  merchantProfileUrlPatterns(): string[];
863
- /** True when this request is a card tokenization we can take over. */
1216
+ /**
1217
+ * The card-on-file policy the API served with the recognizer for this
1218
+ * request (Recognizer.cardOnFile), or null when no recognizer matches or
1219
+ * its entry names none. The Datatrans gate refuses a post that asks to keep
1220
+ * the card on file only while this is `refuse` or a value it does not know.
1221
+ */
1222
+ cardOnFilePolicy(url: string, method?: string): string | null;
1223
+ /**
1224
+ * True when this request is a card tokenization we can take over: a POST to
1225
+ * a recognized endpoint, or for a recognizer whose card request is a GET
1226
+ * (Worldpay eProtect) that exact GET, query included.
1227
+ */
864
1228
  isCardRequest(url: string, method?: string): boolean;
1229
+ /**
1230
+ * Whether the current registry holds this processor's recognizer. A
1231
+ * processor that ships dark is served only to a build that declares its
1232
+ * capability (syncRegistry does), so before a sync, or against an API that
1233
+ * withheld it, the adapters leave that processor's traffic exactly as they
1234
+ * found it. prepare() asks this for ACI, whose card-number request names a
1235
+ * checkout id the merchant mints only at Pay time, and for a processor whose
1236
+ * card request is a GET (Worldpay eProtect), since that request is recognized
1237
+ * by a query the page has not written yet.
1238
+ */
1239
+ recognizesProcessor(psp: string): boolean;
865
1240
  /**
866
1241
  * What happens to a card request (by URL) whose body carries no card: null
867
1242
  * when it carries one, so it is a card request as usual; 'continue' when the
868
1243
  * recognizer marks the endpoint as one where such requests are routine and
869
1244
  * never ours; 'refuse' otherwise, such as a Stripe confirmation paying with
870
- * a method this checkout never approved. The adapters ask only after their
871
- * holds, so a request that would reuse an approved token is refused there
872
- * first. A body that could not be read is not judged here.
1245
+ * a method this checkout never approved. The adapters continue a 'continue'
1246
+ * in every state and judge a 'refuse' after their holds. A body that could
1247
+ * not be read is not judged here.
1248
+ *
1249
+ * `handedTo` lists the requests the attachment has already handed the card
1250
+ * to (CheckoutLifecycle.cardHandoffs). Once one of them went to the same
1251
+ * processor, a processor in CARD_FREE_AFTER_HANDOFF_REFUSED answers 'refuse'
1252
+ * where it would have answered 'continue'.
1253
+ *
1254
+ * A sandbox client's loopback fixture is judged on the processor's own
1255
+ * hosts, as it is recognised (urlsOnProcessorHosts), so a card-free request
1256
+ * the catalog lets through there continues on the fixture too.
873
1257
  */
874
- withoutCard(url: string, body: string | null | undefined): 'continue' | 'refuse' | null;
1258
+ withoutCard(url: string, body: string | null | undefined, handedTo?: readonly string[]): 'continue' | 'refuse' | null;
875
1259
  /**
876
- * How the card would reach the processor on this request (`token`, `cse`
877
- * or `hosted_form`; absent on the entry means `token`), or null when the
1260
+ * How the card would reach the processor on this request (`token`, `cse`,
1261
+ * `hosted_form` or `device_encrypt`; absent on the entry means `token`), or null when the
878
1262
  * registry does not recognize it. The adapters read it to decide whether an
879
1263
  * approval outlives the page's own request: a hosted form is a navigation
880
1264
  * and cannot.
@@ -912,6 +1296,15 @@ export declare class VaultClient {
912
1296
  prepareCheckout(input: PrepareCheckoutInput): Promise<PreparedCheckout>;
913
1297
  /** Cancel only an unconsumed preparation; a bound request is reconciled separately. */
914
1298
  cancelPreparation(id: string): Promise<void>;
1299
+ /**
1300
+ * Retire a ready preparation whose authorization create has not answered, and name the request
1301
+ * that already holds it. Resolves null once the API confirms no merchant request can bind the
1302
+ * preparation any more (cancelled or expired: the API takes a cancel and a create's bind under one
1303
+ * lock), or the ID of the authorization it is already bound to, which the caller retires like any
1304
+ * other (cancelAuthorization). Rejects when the API confirms neither. The Amadeus send window uses
1305
+ * it (amadeus.ts).
1306
+ */
1307
+ retirePreparation(id: string): Promise<string | null>;
915
1308
  observePreparation(id: string, guidance: 'presented_not_filled' | 'not_presented', reason?: string): Promise<void>;
916
1309
  reportDuplicateGuard(authorizationId: string): Promise<void>;
917
1310
  /**
@@ -968,6 +1361,49 @@ export declare class VaultClient {
968
1361
  amount: number;
969
1362
  currency: string;
970
1363
  }>;
1364
+ /**
1365
+ * Ask whether the page may save the card with the Stripe payment method an
1366
+ * approval produced: a SetupIntent confirm that carries no card and pays with
1367
+ * exactly the approved payment method (the page's own, or written by the
1368
+ * adapters in place of a card the confirm carries again).
1369
+ * The API allows a card save only for a company Agentcard turned it on for,
1370
+ * for an approval given on the Vault page, not by voice, with no amount, and
1371
+ * a SetupIntent Stripe reports still confirmable on the same Stripe account;
1372
+ * any other answer rejects with a CheckoutApiError whose code says why (for
1373
+ * example `continuation_invalid` where it is off, `amount_mismatch`). Nothing
1374
+ * is charged: the adapters continue the page's request once this resolves.
1375
+ */
1376
+ checkStripeSetupContinuation(authorizationId: string, request: {
1377
+ url: string;
1378
+ method: string;
1379
+ headers: Record<string, string>;
1380
+ body: string;
1381
+ }): Promise<{
1382
+ setupIntentId: string;
1383
+ }>;
1384
+ /**
1385
+ * Create a merchant-session probe, the phase-0 read of the deterministic merchant total:
1386
+ * `user` is the org's connected user, who opens the returned Vault link and reads the
1387
+ * merchant's own total once through Agentcard's merchant-session relay. The capture is
1388
+ * the merchant's cookie jar as captureMerchantSession read it; the capture rules run
1389
+ * again here, so no bot-manager cookie and no signed-in session ever leaves. No card is
1390
+ * involved. The API answers 404 for every org not on its probe list.
1391
+ */
1392
+ createMerchantSessionProbe(input: {
1393
+ user: string;
1394
+ capture: MerchantSessionCapture;
1395
+ }): Promise<{
1396
+ id: string;
1397
+ profile: string;
1398
+ approvalUrl: string;
1399
+ expiresAt: string;
1400
+ }>;
1401
+ /**
1402
+ * Record the same read made from the autopilot egress by the rustls runner (the API's
1403
+ * egressResultSchema: statuses, header names, sizes, times, totals, hashes and the
1404
+ * certificate chain's SPKI hashes). Once per probe.
1405
+ */
1406
+ recordMerchantSessionEgress(probeId: string, result: unknown): Promise<void>;
971
1407
  /**
972
1408
  * After a merchant-hosted payment priced by the merchant's own total: what the merchant's
973
1409
  * confirmation says it charged (merchant-total.ts merchantChargeReport builds `report`