@invonetwork/web-sdk 2.5.1 → 3.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/dist/server.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { o as InvoError, H as Http, v as AuthHeader, w as PlatformPurchaseInput, d as CallOptions, x as PlatformPurchaseResult, y as PlatformOrderStatusResult, z as PlatformRefundInput, F as PlatformRefundResult, S as ServerConfig, G as PlayerToken, J as InitiateSendInput, K as InitiateResult, N as InitiateTransferInput, O as CreateCheckoutInput, Q as CreateCheckoutResult, T as PurchaseInput, U as PurchaseResult, W as ConfirmPaymentResult, X as OrderDetailsResult, Y as PurchaseItemInput, Z as PurchaseItemResult, _ as ItemHistoryQuery, $ as ItemHistoryResult, a0 as ItemOrderQuery, a1 as PlayerBalanceQuery, a2 as PlayerBalanceResult, a3 as InboundPendingQuery, a4 as InboundPendingResult, a5 as LinkedIdentitiesQuery, a6 as LinkedIdentitiesResult, a7 as SmsVerifyResult, a8 as ClaimTransferInput, a9 as ClaimResult, aa as ClaimCurrencyInput, ab as TransactionStatusResult, ac as GuardianApprovalStatusResult, ad as ServerDestinationsQuery, f as DestinationsResult, ae as PhoneShareContact, af as PhoneShareInitiateResult, ag as PhoneShareApproveInput, ah as PhoneShareApproveResult, ai as PhoneShareStatusResult } from './types-BHvVjdMV.js';
2
- export { aj as BillingAddress, ak as CurrencyBalance, k as DestinationGame, al as FundingSource, am as InboundPendingItem, p as InvoErrorInfo, q as InvoHooks, r as InvoRequestInfo, s as InvoResponseInfo, an as LinkedIdentityEmail, ao as PlatformPurchaseStatus, u as Rail, V as VerificationMethod } from './types-BHvVjdMV.js';
1
+ import { I as InvoError, H as Http, o as AuthHeader, p as PlatformPurchaseInput, b as CallOptions, q as PlatformPurchaseResult, r as PlatformOrderStatusResult, s as PlatformRefundInput, t as PlatformRefundResult, S as ServerConfig, u as PlayerToken, v as InitiateSendInput, w as InitiateResult, x as InitiateTransferInput, y as CreateCheckoutInput, z as CreateCheckoutResult, F as PurchaseInput, G as PurchaseResult, J as ConfirmPaymentResult, O as OrderDetailsResult, K as PurchaseItemInput, N as PurchaseItemResult, Q as ItemHistoryQuery, T as ItemHistoryResult, U as ItemOrderQuery, W as PlayerBalanceQuery, X as PlayerBalanceResult, Y as InboundPendingQuery, Z as InboundPendingResult, _ as LinkedIdentitiesQuery, $ as LinkedIdentitiesResult, a0 as SmsVerifyResult, a1 as ClaimTransferInput, a2 as ClaimResult, a3 as ClaimCurrencyInput, a4 as TransactionStatusResult, a5 as GuardianApprovalStatusResult, a6 as ServerDestinationsQuery, d as DestinationsResult, a7 as PhoneShareContact, a8 as PhoneShareInitiateResult, a9 as PhoneShareApproveInput, aa as PhoneShareApproveResult, ab as PhoneShareStatusResult } from './types-DMNXAGiw.js';
2
+ export { ac as CurrencyBalance, h as DestinationGame, ad as FundingSource, ae as InboundPendingItem, i as InvoErrorInfo, j as InvoHooks, k as InvoRequestInfo, l as InvoResponseInfo, af as LinkedIdentityEmail, ag as PlatformPurchaseStatus, n as Rail, V as VerificationMethod } from './types-DMNXAGiw.js';
3
3
 
4
4
  interface VerifyWebhookOptions {
5
5
  /** Max age of the signed timestamp, in seconds. Default 300 (5 min). */
@@ -222,19 +222,19 @@ declare class PlatformCommerceServer {
222
222
  *
223
223
  * - `fundingSource: "balance"` → settles synchronously; result `status:"success"` with
224
224
  * `newBalance`/`financialBreakdown`. `totalPrice` is the tenant's network-currency amount.
225
- * - `fundingSource: "card"` → result `status:"requires_payment"` + `clientSecret`; hand
226
- * that to the browser `platformCommerce.confirmCardPayment`. `totalPrice` is USD and a
227
- * `billingAddress` is REQUIRED. The sale is real only on the `platform_commerce.purchased`
228
- * webhook — never on the client confirmation.
225
+ * - `fundingSource: "card"` → result `status:"requires_payment"` + `checkoutUrl`/`sessionId`.
226
+ * Send the buyer to `checkoutUrl` — INVO's hosted page owns the card form, wallets,
227
+ * billing address, and 3-D Secure (there is NO billing address in this request, and no
228
+ * client payment code to write; optionally embed via
229
+ * `InvoClient.platformCommerce.mountCheckout`). `totalPrice` is USD ($0.50–$999.99).
230
+ * The sale is real only on the `platform_commerce.purchased` webhook — never on the
231
+ * client return.
229
232
  *
230
- * Idempotent on `clientRequestId` (a duplicate throws a 409 `err.isDuplicateRequest`).
231
- * A non-platform tenant throws `err.isNotPlatformTenant` (403).
232
- *
233
- * ⚠ Card-leg caveat: if the RESPONSE to a card purchase is lost (timeout after the
234
- * backend created the order), re-sending the same `clientRequestId` returns the duplicate
235
- * 409 and the `clientSecret` cannot be re-fetched — reconcile that order via the
236
- * `platform_commerce.purchased` webhook / `getStatus`, and use a NEW `clientRequestId`
237
- * for a fresh attempt. The balance leg has no such gap.
233
+ * Idempotency on `clientRequestId`: the balance leg throws a 409
234
+ * (`err.isDuplicateRequest`) on a duplicate; the card leg REPLAYS the same checkout
235
+ * session (`idempotentReplay: true`) — a lost response is safely recovered by retrying
236
+ * with the SAME `clientRequestId`. A non-platform tenant throws
237
+ * `err.isNotPlatformTenant` (403).
238
238
  */
239
239
  purchase(input: PlatformPurchaseInput, opts?: CallOptions): Promise<PlatformPurchaseResult>;
240
240
  /** Poll an order's status: `completed` (balance immediately; card after the webhook),
package/dist/server.js CHANGED
@@ -1,5 +1,5 @@
1
- import { InvoError, assertSecureBaseUrl, Http, toDestinationsResult } from './chunk-5X3ESHJR.js';
2
- export { InvoError } from './chunk-5X3ESHJR.js';
1
+ import { InvoError, assertSecureBaseUrl, Http, toDestinationsResult } from './chunk-SPTYWJDN.js';
2
+ export { InvoError } from './chunk-SPTYWJDN.js';
3
3
  import { createHmac, timingSafeEqual } from 'crypto';
4
4
 
5
5
  var DEFAULT_TOLERANCE_SEC = 300;
@@ -167,7 +167,7 @@ async function hmacHexSubtle(secret, message) {
167
167
  }
168
168
 
169
169
  // src/server.ts
170
- var DEFAULT_UA = "invonetwork-web-sdk/2.5.1 (+https://invo.network)";
170
+ var DEFAULT_UA = "invonetwork-web-sdk/3.0.0 (+https://invo.network)";
171
171
  var MAX_USD_AMOUNT = 999.99;
172
172
  var MAX_ITEM_PRICE = 999999.99;
173
173
  function invalidInput(label, value, why) {
@@ -329,48 +329,8 @@ function requireField(value, field, raw) {
329
329
  return s;
330
330
  }
331
331
  var FUNDING_SOURCES = /* @__PURE__ */ new Set(["balance", "card"]);
332
- function invalidInputNoEcho(label, why) {
333
- return new InvoError({ message: `${label} ${why}.`, code: "INVALID_INPUT", status: 0 });
334
- }
335
- function assertBillingAddress(addr, label) {
336
- if (!addr || typeof addr !== "object") {
337
- throw invalidInputNoEcho(label, 'is required for the "card" funding source and must be an object');
338
- }
339
- const required = [
340
- [`${label}.line1`, addr.line1],
341
- [`${label}.city`, addr.city],
342
- [`${label}.postalCode`, addr.postalCode],
343
- [`${label}.country`, addr.country]
344
- ];
345
- for (const [k, v] of required) {
346
- if (typeof v !== "string" || !v.trim()) throw invalidInputNoEcho(k, "is required");
347
- }
348
- if (!/^[A-Za-z]{2}$/.test(addr.country)) {
349
- throw invalidInputNoEcho(`${label}.country`, "must be a 2-letter ISO country code");
350
- }
351
- const optional = [
352
- [`${label}.name`, addr.name],
353
- [`${label}.line2`, addr.line2],
354
- [`${label}.state`, addr.state]
355
- ];
356
- for (const [k, v] of optional) {
357
- if (v !== void 0 && typeof v !== "string") {
358
- throw invalidInputNoEcho(k, "must be a string when provided");
359
- }
360
- }
361
- }
362
- function toBillingAddressBody(addr) {
363
- const body = {
364
- line1: addr.line1,
365
- city: addr.city,
366
- postal_code: addr.postalCode,
367
- country: addr.country
368
- };
369
- if (addr.name) body["name"] = addr.name;
370
- if (addr.line2) body["line2"] = addr.line2;
371
- if (addr.state) body["state"] = addr.state;
372
- return body;
373
- }
332
+ var CARD_MIN_USD = 0.5;
333
+ var CARD_MAX_USD = 999.99;
374
334
  var PlatformCommerceServer = class {
375
335
  constructor(http, auth) {
376
336
  this.http = http;
@@ -383,19 +343,19 @@ var PlatformCommerceServer = class {
383
343
  *
384
344
  * - `fundingSource: "balance"` → settles synchronously; result `status:"success"` with
385
345
  * `newBalance`/`financialBreakdown`. `totalPrice` is the tenant's network-currency amount.
386
- * - `fundingSource: "card"` → result `status:"requires_payment"` + `clientSecret`; hand
387
- * that to the browser `platformCommerce.confirmCardPayment`. `totalPrice` is USD and a
388
- * `billingAddress` is REQUIRED. The sale is real only on the `platform_commerce.purchased`
389
- * webhook — never on the client confirmation.
390
- *
391
- * Idempotent on `clientRequestId` (a duplicate throws a 409 `err.isDuplicateRequest`).
392
- * A non-platform tenant throws `err.isNotPlatformTenant` (403).
346
+ * - `fundingSource: "card"` → result `status:"requires_payment"` + `checkoutUrl`/`sessionId`.
347
+ * Send the buyer to `checkoutUrl` — INVO's hosted page owns the card form, wallets,
348
+ * billing address, and 3-D Secure (there is NO billing address in this request, and no
349
+ * client payment code to write; optionally embed via
350
+ * `InvoClient.platformCommerce.mountCheckout`). `totalPrice` is USD ($0.50–$999.99).
351
+ * The sale is real only on the `platform_commerce.purchased` webhook — never on the
352
+ * client return.
393
353
  *
394
- * ⚠ Card-leg caveat: if the RESPONSE to a card purchase is lost (timeout after the
395
- * backend created the order), re-sending the same `clientRequestId` returns the duplicate
396
- * 409 and the `clientSecret` cannot be re-fetched — reconcile that order via the
397
- * `platform_commerce.purchased` webhook / `getStatus`, and use a NEW `clientRequestId`
398
- * for a fresh attempt. The balance leg has no such gap.
354
+ * Idempotency on `clientRequestId`: the balance leg throws a 409
355
+ * (`err.isDuplicateRequest`) on a duplicate; the card leg REPLAYS the same checkout
356
+ * session (`idempotentReplay: true`) — a lost response is safely recovered by retrying
357
+ * with the SAME `clientRequestId`. A non-platform tenant throws
358
+ * `err.isNotPlatformTenant` (403).
399
359
  */
400
360
  async purchase(input, opts) {
401
361
  const required = [
@@ -426,7 +386,20 @@ var PlatformCommerceServer = class {
426
386
  );
427
387
  }
428
388
  if (input.fundingSource === "card") {
429
- assertBillingAddress(input.billingAddress, "billingAddress");
389
+ if (total < CARD_MIN_USD) {
390
+ throw new InvoError({
391
+ message: `Card purchases must be at least $${CARD_MIN_USD.toFixed(2)}.`,
392
+ code: "BELOW_STRIPE_MINIMUM",
393
+ status: 0
394
+ });
395
+ }
396
+ if (total > CARD_MAX_USD) {
397
+ throw new InvoError({
398
+ message: `Card purchases must be $${CARD_MAX_USD} or less.`,
399
+ code: "ABOVE_CARD_MAXIMUM",
400
+ status: 0
401
+ });
402
+ }
430
403
  }
431
404
  if (input.playerPhone !== void 0) assertE164(input.playerPhone, "playerPhone");
432
405
  const body = {
@@ -443,31 +416,37 @@ var PlatformCommerceServer = class {
443
416
  if (input.playerPhone) body["player_phone"] = input.playerPhone;
444
417
  if (input.itemDescription) body["item_description"] = input.itemDescription;
445
418
  if (input.itemCategory) body["item_category"] = input.itemCategory;
446
- if (input.billingAddress) body["billing_address"] = toBillingAddressBody(input.billingAddress);
419
+ if (input.successUrl) body["success_url"] = input.successUrl;
420
+ if (input.cancelUrl) body["cancel_url"] = input.cancelUrl;
421
+ if (input.metadata) body["metadata"] = input.metadata;
447
422
  const raw = await this.http.post(
448
423
  "/api/platform-commerce/purchase",
449
424
  body,
450
425
  this.auth,
426
+ // Safe to retry: balance dedupes (dup → 409); card REPLAYS the same session.
451
427
  { idempotent: true, signal: opts?.signal }
452
- // client_request_id makes this safe to retry (dup → 409)
453
428
  );
454
- const orderIdRaw = raw["order_id"];
455
- requireField(orderIdRaw, "order_id", raw);
456
429
  const status = String(raw["status"] ?? "");
457
- if (status === "requires_payment" && !raw["client_secret"]) {
458
- requireField(raw["client_secret"], "client_secret", raw);
430
+ if (status === "requires_payment") {
431
+ requireField(raw["checkout_url"], "checkout_url", raw);
432
+ } else {
433
+ requireField(raw["order_id"], "order_id", raw);
459
434
  }
435
+ const expiresAtRaw = raw["expires_at"];
460
436
  return {
461
437
  status,
462
438
  fundingSource: String(raw["funding_source"] ?? input.fundingSource),
463
- orderId: orderIdRaw,
439
+ orderId: raw["order_id"] ?? void 0,
464
440
  transactionId: raw["transaction_id"],
465
441
  newBalance: raw["new_balance"] ?? null,
466
442
  previousBalance: raw["previous_balance"] ?? null,
467
443
  currencyName: raw["currency_name"],
468
444
  financialBreakdown: raw["financial_breakdown"],
469
- clientSecret: raw["client_secret"],
445
+ sessionId: raw["session_id"],
446
+ checkoutUrl: raw["checkout_url"],
447
+ expiresAt: typeof expiresAtRaw === "number" ? expiresAtRaw : void 0,
470
448
  amountUsd: raw["amount_usd"] ?? null,
449
+ idempotentReplay: raw["idempotent_replay"] === true,
471
450
  raw
472
451
  };
473
452
  }
@@ -117,6 +117,9 @@ declare class InvoError extends Error {
117
117
  /** True if a Platform Commerce CARD purchase was below the processor's floor of $0.50
118
118
  * (backend code `BELOW_STRIPE_MINIMUM`, 400). Neutral name; matches the wire code. */
119
119
  get isBelowCardMinimum(): boolean;
120
+ /** True if a Platform Commerce CARD purchase exceeded the hosted checkout's single-charge
121
+ * cap of $999.99 (`ABOVE_CARD_MAXIMUM`, 400) — split the sale or lower the amount. */
122
+ get isAboveCardMaximum(): boolean;
120
123
  /**
121
124
  * True if a Platform Commerce refund targeted an order that was already refunded
122
125
  * (409). Idempotent outcome — the original refund did happen, so treat this as
@@ -254,13 +257,6 @@ interface ClientConfig extends InvoConfig {
254
257
  * is retried once with the new token, and the client keeps using it thereafter.
255
258
  */
256
259
  refreshToken?: () => Promise<string> | string;
257
- /**
258
- * Optional. The card processor's PUBLISHABLE key (public — safe in the browser),
259
- * used as the default for `platformCommerce.confirmCardPayment` /
260
- * `mountCardPayment` when a per-call `publishableKey` isn't given. This is the
261
- * Platform Commerce CARD leg only; the passkey/token flows never use it.
262
- */
263
- commercePublishableKey?: string;
264
260
  }
265
261
  interface PlayerToken {
266
262
  token: string;
@@ -411,19 +407,9 @@ interface ItemOrderQuery {
411
407
  /** How a Platform Commerce purchase is funded. Server-resolved under lock — the client
412
408
  * can request it, but the backend verifies the actual balance before value moves. */
413
409
  type FundingSource = "balance" | "card";
414
- /** Billing address — REQUIRED on the card leg (AVS / fraud / merchant-of-record records). */
415
- interface BillingAddress {
416
- line1: string;
417
- city: string;
418
- postalCode: string;
419
- /** 2-letter ISO country code, e.g. "US". */
420
- country: string;
421
- name?: string;
422
- line2?: string;
423
- state?: string;
424
- }
425
410
  interface PlatformPurchaseInput {
426
- /** Idempotency key, unique per tenant. Required. A duplicate returns 409. */
411
+ /** Idempotency key, unique per tenant. Required. Balance leg: a duplicate returns 409.
412
+ * Card leg: a duplicate REPLAYS the same checkout session (`idempotentReplay: true`). */
427
413
  clientRequestId: string;
428
414
  /** "balance" (spend held INVO currency) or "card" (pay by card — new money). Required;
429
415
  * server-validated. */
@@ -437,23 +423,29 @@ interface PlatformPurchaseInput {
437
423
  /** Price PER UNIT. > 0. On the CARD leg this is USD; on the BALANCE leg it is the
438
424
  * tenant's network-currency amount. */
439
425
  unitPrice: string | number;
440
- /** Must equal unitPrice × itemQuantity (±0.01). USD on the card leg; network currency
441
- * on the balance leg. */
426
+ /** Must equal unitPrice × itemQuantity (±0.01). USD on the card leg (min $0.50,
427
+ * max $999.99); network currency on the balance leg. */
442
428
  totalPrice: string | number;
443
429
  playerPhone?: string;
444
430
  itemDescription?: string;
445
431
  itemCategory?: string;
446
- /** REQUIRED when `fundingSource` is "card"; ignored on the balance leg. */
447
- billingAddress?: BillingAddress;
432
+ /** Card leg only: where INVO's hosted checkout sends the buyer after payment. */
433
+ successUrl?: string;
434
+ /** Card leg only: where the hosted checkout sends the buyer on cancel. */
435
+ cancelUrl?: string;
436
+ /** Card leg only: your correlation object, echoed back on the webhook. */
437
+ metadata?: Record<string, unknown>;
448
438
  }
449
- /** "success" → BALANCE leg settled synchronously. "requires_payment" → CARD leg: hand
450
- * `clientSecret` to the browser `platformCommerce.confirmCardPayment`. */
439
+ /** "success" → BALANCE leg settled synchronously. "requires_payment" → CARD leg: send
440
+ * the buyer to `checkoutUrl` (INVO's hosted checkout page). */
451
441
  type PlatformPurchaseStatus = "success" | "requires_payment";
452
442
  interface PlatformPurchaseResult {
453
- /** "success" (balance settled) | "requires_payment" (card — confirm in the browser). */
443
+ /** "success" (balance settled) | "requires_payment" (card — send the buyer to `checkoutUrl`). */
454
444
  status: string;
455
445
  fundingSource: string;
456
- orderId: string | number;
446
+ /** Balance leg only — the card leg creates the order lazily on the verified payment,
447
+ * so `requires_payment` responses carry a `sessionId` instead. */
448
+ orderId?: string | number;
457
449
  transactionId?: string;
458
450
  /** Canonical balance AFTER the debit (balance leg). */
459
451
  newBalance?: string | number | null;
@@ -461,9 +453,17 @@ interface PlatformPurchaseResult {
461
453
  currencyName?: string;
462
454
  /** { total_paid, developer_revenue, platform_fee } when present. */
463
455
  financialBreakdown?: Record<string, unknown>;
464
- /** Hand to the browser `platformCommerce.confirmCardPayment`. Present on the card leg. */
465
- clientSecret?: string;
456
+ /** The hosted-checkout session id. Present on the card leg. */
457
+ sessionId?: string;
458
+ /** Send the buyer here (redirect, or `InvoClient.platformCommerce.mountCheckout`).
459
+ * INVO's hosted page owns the card form, wallets, billing address, and 3-D Secure. */
460
+ checkoutUrl?: string;
461
+ /** Unix seconds when the checkout session expires. Present on the card leg. */
462
+ expiresAt?: number;
466
463
  amountUsd?: string | number | null;
464
+ /** True when this response REPLAYED an existing session for the same
465
+ * `clientRequestId` (safe retry — same URL, never a second charge). */
466
+ idempotentReplay?: boolean;
467
467
  raw: Record<string, unknown>;
468
468
  }
469
469
  interface PlatformOrderStatusResult {
@@ -505,92 +505,21 @@ interface PlatformRefundResult {
505
505
  feeRetained?: boolean;
506
506
  raw: Record<string, unknown>;
507
507
  }
508
- /**
509
- * Minimal structural shape of the card processor's browser object (Stripe.js `Stripe`),
510
- * kept neutral so the public surface never names the processor. The default loader wraps
511
- * `window.Stripe(publishableKey)` — which already satisfies this shape.
512
- */
513
- interface InvoCardProcessor {
514
- elements(opts: {
515
- clientSecret: string;
516
- appearance?: Record<string, unknown>;
517
- }): InvoCardElements;
518
- confirmPayment(args: {
519
- elements: InvoCardElements;
520
- clientSecret?: string;
521
- confirmParams?: {
522
- return_url?: string;
523
- };
524
- /** "if_required" keeps the flow in-page unless the bank forces a redirect. */
525
- redirect?: "if_required" | "always";
526
- }): Promise<InvoCardConfirmResponse>;
527
- }
528
- interface InvoCardElements {
529
- create(type: string, opts?: Record<string, unknown>): InvoCardElement;
530
- }
531
- interface InvoCardElement {
532
- mount(target: string | HTMLElement): void;
533
- unmount?(): void;
534
- }
535
- interface InvoCardConfirmResponse {
536
- error?: {
537
- message?: string;
538
- code?: string;
539
- [k: string]: unknown;
540
- };
541
- paymentIntent?: {
542
- id?: string;
543
- status?: string;
544
- [k: string]: unknown;
545
- };
546
- [k: string]: unknown;
547
- }
548
- interface MountCardPaymentOptions {
549
- /** Where the Payment Element renders: a CSS selector or an HTMLElement. */
550
- mount: string | HTMLElement;
551
- /** The card processor PUBLISHABLE key (public). Falls back to
552
- * `ClientConfig.commercePublishableKey`. */
553
- publishableKey?: string;
554
- /** URL the processor returns to after any off-site step (e.g. 3-D Secure). */
555
- returnUrl?: string;
556
- /** Payment Element appearance/config, passed straight to the processor. */
557
- appearance?: Record<string, unknown>;
558
- /** Advanced/testing: inject the processor instead of loading it from the CDN. */
559
- loadProcessor?: (publishableKey: string) => Promise<InvoCardProcessor>;
560
- }
561
- interface ConfirmCardPaymentOptions extends MountCardPaymentOptions {
562
- /** Your existing "Pay" button (selector or element). If omitted, the SDK renders a
563
- * minimal button inside `mount` (requires a DOM `document`). */
564
- submit?: string | HTMLElement;
565
- /** Label for the auto-rendered button when `submit` is omitted. Default "Pay". */
566
- submitLabel?: string;
567
- }
568
- type CardPaymentStatus = "succeeded" | "requires_action" | "processing" | "failed";
569
- interface CardPaymentResult {
570
- /**
571
- * "succeeded" — the processor captured/authorized (still fulfill on the
572
- * `platform_commerce.purchased` webhook, never on this alone). "requires_action" — the
573
- * bank needs a step (e.g. redirect). "processing" — async settlement in flight.
574
- * "failed" — declined/errored (`error` carries the message).
575
- */
576
- status: CardPaymentStatus;
577
- paymentIntentId?: string;
578
- /** Present on "failed": the processor's error message. */
579
- error?: string;
580
- /** The processor's full confirm response. NOTE: includes the PaymentIntent, whose
581
- * `client_secret` is semi-public but still shouldn't be written to logs — redact
582
- * `raw` if you log these results. */
583
- raw: Record<string, unknown>;
584
- }
585
- /** Handle returned by `mountCardPayment`: confirm on your own button, then tear down. */
586
- interface CardPaymentSession {
587
- /** The mounted Payment Element (processor-native object). */
588
- element: InvoCardElement;
589
- /** Confirm the payment (call from your Pay button's click handler). */
590
- confirm(opts?: {
591
- returnUrl?: string;
592
- }): Promise<CardPaymentResult>;
593
- /** Unmount the Payment Element. */
508
+ interface MountCheckoutOptions {
509
+ /** Called when INVO's page posts `INVO_CHECKOUT_COMPLETE` (payment finished in-frame).
510
+ * Show "processing" and reconcile server-side — the sale is REAL only on the
511
+ * `platform_commerce.purchased` webhook, never on this client signal. */
512
+ onComplete?: (data: Record<string, unknown>) => void;
513
+ /** Extra CSS class for the iframe. The SDK sets width:100%/border:0 by default. */
514
+ className?: string;
515
+ /** iframe `title` for accessibility. Default "INVO checkout". */
516
+ title?: string;
517
+ }
518
+ /** Handle returned by `mountCheckout`. */
519
+ interface CheckoutMountHandle {
520
+ /** The mounted iframe element. */
521
+ iframe: HTMLIFrameElement;
522
+ /** Remove the iframe and stop listening for checkout messages. */
594
523
  destroy(): void;
595
524
  }
596
525
  interface PlayerBalanceQuery {
@@ -946,4 +875,4 @@ interface PhoneShareStatusResult {
946
875
  raw: Record<string, unknown>;
947
876
  }
948
877
 
949
- export { type ItemHistoryResult as $, type ApproveResult as A, type BalanceResult as B, type CardPaymentSession as C, type DestinationsQuery as D, type EnrollmentBeginResult as E, type PlatformRefundResult as F, type PlayerToken as G, Http as H, type InvoCardConfirmResponse as I, type InitiateSendInput as J, type InitiateResult as K, type LinkDeviceResult as L, type MountCardPaymentOptions as M, type InitiateTransferInput as N, type CreateCheckoutInput as O, type PendingCollectResult as P, type CreateCheckoutResult as Q, type RecoveryBeginResult as R, type ServerConfig as S, type PurchaseInput as T, type PurchaseResult as U, type VerificationMethod as V, type ConfirmPaymentResult as W, type OrderDetailsResult as X, type PurchaseItemInput as Y, type PurchaseItemResult as Z, type ItemHistoryQuery as _, type ConfirmCardPaymentOptions as a, type ItemOrderQuery as a0, type PlayerBalanceQuery as a1, type PlayerBalanceResult as a2, type InboundPendingQuery as a3, type InboundPendingResult as a4, type LinkedIdentitiesQuery as a5, type LinkedIdentitiesResult as a6, type SmsVerifyResult as a7, type ClaimTransferInput as a8, type ClaimResult as a9, type ClaimCurrencyInput as aa, type TransactionStatusResult as ab, type GuardianApprovalStatusResult as ac, type ServerDestinationsQuery as ad, type PhoneShareContact as ae, type PhoneShareInitiateResult as af, type PhoneShareApproveInput as ag, type PhoneShareApproveResult as ah, type PhoneShareStatusResult as ai, type BillingAddress as aj, type CurrencyBalance as ak, type FundingSource as al, type InboundPendingItem as am, type LinkedIdentityEmail as an, type PlatformPurchaseStatus as ao, type CardPaymentResult as b, type ClientConfig as c, type CallOptions as d, type ConfirmReceiptResult as e, type DestinationsResult as f, type EnrollmentVerifyResult as g, type RecoveryCompleteResult as h, type BalanceRow as i, type CardPaymentStatus as j, type DestinationGame as k, type InvoCardElement as l, type InvoCardElements as m, type InvoCardProcessor as n, InvoError as o, type InvoErrorInfo as p, type InvoHooks as q, type InvoRequestInfo as r, type InvoResponseInfo as s, type PendingCollectItem as t, type Rail as u, type AuthHeader as v, type PlatformPurchaseInput as w, type PlatformPurchaseResult as x, type PlatformOrderStatusResult as y, type PlatformRefundInput as z };
878
+ export { type LinkedIdentitiesResult as $, type ApproveResult as A, type BalanceResult as B, type CheckoutMountHandle as C, type DestinationsQuery as D, type EnrollmentBeginResult as E, type PurchaseInput as F, type PurchaseResult as G, Http as H, InvoError as I, type ConfirmPaymentResult as J, type PurchaseItemInput as K, type LinkDeviceResult as L, type MountCheckoutOptions as M, type PurchaseItemResult as N, type OrderDetailsResult as O, type PendingCollectResult as P, type ItemHistoryQuery as Q, type RecoveryBeginResult as R, type ServerConfig as S, type ItemHistoryResult as T, type ItemOrderQuery as U, type VerificationMethod as V, type PlayerBalanceQuery as W, type PlayerBalanceResult as X, type InboundPendingQuery as Y, type InboundPendingResult as Z, type LinkedIdentitiesQuery as _, type ClientConfig as a, type SmsVerifyResult as a0, type ClaimTransferInput as a1, type ClaimResult as a2, type ClaimCurrencyInput as a3, type TransactionStatusResult as a4, type GuardianApprovalStatusResult as a5, type ServerDestinationsQuery as a6, type PhoneShareContact as a7, type PhoneShareInitiateResult as a8, type PhoneShareApproveInput as a9, type PhoneShareApproveResult as aa, type PhoneShareStatusResult as ab, type CurrencyBalance as ac, type FundingSource as ad, type InboundPendingItem as ae, type LinkedIdentityEmail as af, type PlatformPurchaseStatus as ag, type CallOptions as b, type ConfirmReceiptResult as c, type DestinationsResult as d, type EnrollmentVerifyResult as e, type RecoveryCompleteResult as f, type BalanceRow as g, type DestinationGame as h, type InvoErrorInfo as i, type InvoHooks as j, type InvoRequestInfo as k, type InvoResponseInfo as l, type PendingCollectItem as m, type Rail as n, type AuthHeader as o, type PlatformPurchaseInput as p, type PlatformPurchaseResult as q, type PlatformOrderStatusResult as r, type PlatformRefundInput as s, type PlatformRefundResult as t, type PlayerToken as u, type InitiateSendInput as v, type InitiateResult as w, type InitiateTransferInput as x, type CreateCheckoutInput as y, type CreateCheckoutResult as z };