@invonetwork/web-sdk 3.10.1 → 3.11.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.cts CHANGED
@@ -1,12 +1,12 @@
1
- import { I as InvoError, H as Http, o as AuthHeader, p as CardSetupSessionInput, c as CallOptions, q as CardSetupSessionResult, r as CardSetupInput, s as CardSetupResult, t as CardSetupConfirmInput, u as CardSetupConfirmResult, v as PlayerCardsResult, w as PlatformPurchaseInput, x as PlatformPurchaseResult, y as PlatformOrderStatusResult, z as PlatformRefundInput, F as PlatformRefundResult, G as CreateSubscriptionInput, S as SubscriptionResult, J as GetSubscriptionOptions, K as GetSubscriptionResult, N as ListSubscriptionsOptions, O as SubscriptionListResult, Q as CancelSubscriptionOptions, T as CancelResult, U as ChangeAmountResult, W as SetPaymentMethodInput, X as SetPaymentMethodResult, Y as RefundSubscriptionInput, Z as RefundResult, _ as SteamSubscriptionInitInput, $ as SteamInitResult, a0 as SteamFinalizeSubscriptionResult, a1 as SandboxClockResult, a2 as SandboxFailureOutcome, a3 as SandboxForceFailureOptions, a4 as SandboxForceAuthChallengeOptions, a5 as ServerConfig, a6 as PlayerToken, a7 as InitiateSendInput, a8 as InitiateResult, a9 as InitiateTransferInput, aa as CreateCheckoutInput, ab as CreateCheckoutResult, ac as PurchaseInput, ad as PurchaseResult, ae as ConfirmPaymentResult, af as OrderDetailsResult, ag as SteamPacksQuery, ah as SteamPacksResult, ai as SteamInitPurchaseInput, aj as SteamInitPurchaseResult, ak as SteamFinalizeInput, al as SteamFinalizeResult, am as PurchaseItemInput, an as PurchaseItemResult, ao as ItemHistoryQuery, ap as ItemHistoryResult, aq as ItemOrderQuery, ar as PlayerBalanceQuery, as as PlayerBalanceResult, at as InboundPendingQuery, au as InboundPendingResult, av as LinkedIdentitiesQuery, aw as LinkedIdentitiesResult, ax as SmsVerifyResult, ay as ClaimTransferInput, az as ClaimResult, aA as ClaimCurrencyInput, aB as TransactionStatusResult, aC as GuardianApprovalStatusResult, aD as ServerDestinationsQuery, d as DestinationsResult, aE as PhoneShareContact, aF as PhoneShareInitiateResult, aG as PhoneShareApproveInput, aH as PhoneShareApproveResult, aI as PhoneShareStatusResult, aJ as BeginDeviceApprovalInput, aK as DeviceApprovalGrant, aL as PollDeviceApprovalInput, aM as DeviceApprovalPollResult, aN as ConfirmDeviceEnrollmentInput, aO as ConfirmDeviceEnrollmentResult, aP as ApproveWithDeviceCodeInput, aQ as DeviceApprovalSettleResult, aR as CompleteDeviceApprovalInput, aS as CompleteDeviceApprovalResult } from './types-CBxpXgAM.cjs';
2
- export { aT as CardSetupStatus, aU as CurrencyBalance, h as DestinationGame, aV as DeviceApprovalChannel, aW as DeviceApprovalEnrollment, aX as DeviceApprovalFlow, aY as DeviceApprovalPollStatus, aZ as DeviceEnrollmentDecision, a_ as DeviceEnrollmentRespond, a$ as FirstCharge, b0 as FirstChargeStatus, b1 as FundingSource, b2 as InboundPendingItem, i as InvoErrorInfo, j as InvoHooks, k as InvoRequestInfo, l as InvoResponseInfo, b3 as LinkedIdentityEmail, b4 as PlatformPurchaseStatus, n as Rail, b5 as RefundInitiation, b6 as RefundPendingApproval, b7 as RefundProcessingFeeBasis, b8 as RefundReceipt, b9 as RefundRevenueShareAttribution, ba as RefundWarning, bb as SandboxClockState, bc as SavedCard, bd as SteamPack, be as SteamUserSession, bf as Subscription, bg as SubscriptionBaseInput, bh as SubscriptionConsent, bi as SubscriptionConsentInput, bj as SubscriptionFundingRail, bk as SubscriptionInterval, bl as SubscriptionRevenueShare, bm as SubscriptionRevenueShareInput, bn as SubscriptionStatus, V as VerificationMethod, bo as isRefundPendingApproval } from './types-CBxpXgAM.cjs';
1
+ import { I as InvoError, H as Http, x as AuthHeader, y as CardSetupSessionInput, g as CallOptions, z as CardSetupSessionResult, F as CardSetupInput, G as CardSetupResult, J as CardSetupConfirmInput, K as CardSetupConfirmResult, N as PlayerCardsResult, O as PlatformPurchaseInput, Q as PlatformPurchaseResult, S as PlatformOrderStatusResult, T as PlatformRefundInput, U as PlatformRefundResult, X as CreateSubscriptionInput, Y as SubscriptionResult, Z as GetSubscriptionOptions, _ as GetSubscriptionResult, $ as ListSubscriptionsOptions, a0 as SubscriptionListResult, a1 as CancelSubscriptionOptions, a2 as CancelResult, a3 as ChangeAmountResult, a4 as SetPaymentMethodInput, a5 as SetPaymentMethodResult, a6 as RefundSubscriptionInput, a7 as RefundResult, a8 as SteamSubscriptionInitInput, a9 as SteamInitResult, aa as SteamFinalizeSubscriptionResult, ab as SandboxClockResult, ac as SandboxFailureOutcome, ad as SandboxForceFailureOptions, ae as SandboxForceAuthChallengeOptions, af as ServerConfig, ag as PlayerToken, ah as InitiateSendInput, ai as InitiateResult, aj as InitiateTransferInput, ak as CreateCheckoutInput, al as CreateCheckoutResult, am as PurchaseInput, an as PurchaseResult, ao as ConfirmPaymentResult, ap as OrderDetailsResult, aq as SteamPacksQuery, ar as SteamPacksResult, as as SteamInitPurchaseInput, at as SteamInitPurchaseResult, au as SteamFinalizeInput, av as SteamFinalizeResult, aw as PurchaseItemInput, ax as PurchaseItemResult, ay as ItemHistoryQuery, az as ItemHistoryResult, aA as ItemOrderQuery, aB as PlayerBalanceQuery, aC as PlayerBalanceResult, aD as InboundPendingQuery, aE as InboundPendingResult, aF as LinkedIdentitiesQuery, aG as LinkedIdentitiesResult, aH as SmsVerifyResult, aI as ClaimTransferInput, aJ as ClaimResult, aK as ClaimCurrencyInput, aL as TransactionStatusResult, aM as GuardianApprovalStatusResult, aN as ServerDestinationsQuery, k as DestinationsResult, aO as PhoneShareContact, aP as PhoneShareInitiateResult, aQ as PhoneShareApproveInput, aR as PhoneShareApproveResult, aS as PhoneShareStatusResult, aT as BeginDeviceApprovalInput, aU as DeviceApprovalGrant, aV as PollDeviceApprovalInput, aW as DeviceApprovalPollResult, aX as ConfirmDeviceEnrollmentInput, aY as ConfirmDeviceEnrollmentResult, aZ as ApproveWithDeviceCodeInput, a_ as DeviceApprovalSettleResult, a$ as CompleteDeviceApprovalInput, b0 as CompleteDeviceApprovalResult } from './types-DSLGe_0Z.cjs';
2
+ export { b1 as CardSetupStatus, b2 as CurrencyBalance, p as DestinationGame, b3 as DeviceApprovalChannel, b4 as DeviceApprovalEnrollment, b5 as DeviceApprovalFlow, b6 as DeviceApprovalPollStatus, b7 as DeviceEnrollmentDecision, b8 as DeviceEnrollmentRespond, b9 as FirstCharge, ba as FirstChargeStatus, bb as FundingSource, bc as InboundPendingItem, q as InvoErrorInfo, r as InvoHooks, s as InvoRequestInfo, t as InvoResponseInfo, bd as LinkedIdentityEmail, be as PlatformPurchaseStatus, w as Rail, bf as RefundInitiation, bg as RefundPendingApproval, bh as RefundProcessingFeeBasis, bi as RefundReceipt, bj as RefundRevenueShareAttribution, bk as RefundWarning, bl as SandboxClockState, bm as SavedCard, bn as SteamPack, bo as SteamUserSession, bp as Subscription, bq as SubscriptionBaseInput, br as SubscriptionConsent, bs as SubscriptionConsentInput, bt as SubscriptionFundingRail, bu as SubscriptionInterval, bv as SubscriptionRevenueShare, bw as SubscriptionRevenueShareInput, bx as SubscriptionStatus, V as VerificationMethod, by as isRefundPendingApproval } from './types-DSLGe_0Z.cjs';
3
3
 
4
4
  /**
5
5
  * The package version, as sent in the server User-Agent. A test pins this to
6
6
  * `package.json` so it cannot drift silently (it did: the UA read 3.0.0 through 3.7.0).
7
7
  * Bump it with the changeset flow.
8
8
  */
9
- declare const SDK_VERSION = "3.10.0";
9
+ declare const SDK_VERSION = "3.11.0";
10
10
 
11
11
  interface VerifyWebhookOptions {
12
12
  /** Max age of the signed timestamp, in seconds. Default 300 (5 min). */
package/dist/server.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { I as InvoError, H as Http, o as AuthHeader, p as CardSetupSessionInput, c as CallOptions, q as CardSetupSessionResult, r as CardSetupInput, s as CardSetupResult, t as CardSetupConfirmInput, u as CardSetupConfirmResult, v as PlayerCardsResult, w as PlatformPurchaseInput, x as PlatformPurchaseResult, y as PlatformOrderStatusResult, z as PlatformRefundInput, F as PlatformRefundResult, G as CreateSubscriptionInput, S as SubscriptionResult, J as GetSubscriptionOptions, K as GetSubscriptionResult, N as ListSubscriptionsOptions, O as SubscriptionListResult, Q as CancelSubscriptionOptions, T as CancelResult, U as ChangeAmountResult, W as SetPaymentMethodInput, X as SetPaymentMethodResult, Y as RefundSubscriptionInput, Z as RefundResult, _ as SteamSubscriptionInitInput, $ as SteamInitResult, a0 as SteamFinalizeSubscriptionResult, a1 as SandboxClockResult, a2 as SandboxFailureOutcome, a3 as SandboxForceFailureOptions, a4 as SandboxForceAuthChallengeOptions, a5 as ServerConfig, a6 as PlayerToken, a7 as InitiateSendInput, a8 as InitiateResult, a9 as InitiateTransferInput, aa as CreateCheckoutInput, ab as CreateCheckoutResult, ac as PurchaseInput, ad as PurchaseResult, ae as ConfirmPaymentResult, af as OrderDetailsResult, ag as SteamPacksQuery, ah as SteamPacksResult, ai as SteamInitPurchaseInput, aj as SteamInitPurchaseResult, ak as SteamFinalizeInput, al as SteamFinalizeResult, am as PurchaseItemInput, an as PurchaseItemResult, ao as ItemHistoryQuery, ap as ItemHistoryResult, aq as ItemOrderQuery, ar as PlayerBalanceQuery, as as PlayerBalanceResult, at as InboundPendingQuery, au as InboundPendingResult, av as LinkedIdentitiesQuery, aw as LinkedIdentitiesResult, ax as SmsVerifyResult, ay as ClaimTransferInput, az as ClaimResult, aA as ClaimCurrencyInput, aB as TransactionStatusResult, aC as GuardianApprovalStatusResult, aD as ServerDestinationsQuery, d as DestinationsResult, aE as PhoneShareContact, aF as PhoneShareInitiateResult, aG as PhoneShareApproveInput, aH as PhoneShareApproveResult, aI as PhoneShareStatusResult, aJ as BeginDeviceApprovalInput, aK as DeviceApprovalGrant, aL as PollDeviceApprovalInput, aM as DeviceApprovalPollResult, aN as ConfirmDeviceEnrollmentInput, aO as ConfirmDeviceEnrollmentResult, aP as ApproveWithDeviceCodeInput, aQ as DeviceApprovalSettleResult, aR as CompleteDeviceApprovalInput, aS as CompleteDeviceApprovalResult } from './types-CBxpXgAM.js';
2
- export { aT as CardSetupStatus, aU as CurrencyBalance, h as DestinationGame, aV as DeviceApprovalChannel, aW as DeviceApprovalEnrollment, aX as DeviceApprovalFlow, aY as DeviceApprovalPollStatus, aZ as DeviceEnrollmentDecision, a_ as DeviceEnrollmentRespond, a$ as FirstCharge, b0 as FirstChargeStatus, b1 as FundingSource, b2 as InboundPendingItem, i as InvoErrorInfo, j as InvoHooks, k as InvoRequestInfo, l as InvoResponseInfo, b3 as LinkedIdentityEmail, b4 as PlatformPurchaseStatus, n as Rail, b5 as RefundInitiation, b6 as RefundPendingApproval, b7 as RefundProcessingFeeBasis, b8 as RefundReceipt, b9 as RefundRevenueShareAttribution, ba as RefundWarning, bb as SandboxClockState, bc as SavedCard, bd as SteamPack, be as SteamUserSession, bf as Subscription, bg as SubscriptionBaseInput, bh as SubscriptionConsent, bi as SubscriptionConsentInput, bj as SubscriptionFundingRail, bk as SubscriptionInterval, bl as SubscriptionRevenueShare, bm as SubscriptionRevenueShareInput, bn as SubscriptionStatus, V as VerificationMethod, bo as isRefundPendingApproval } from './types-CBxpXgAM.js';
1
+ import { I as InvoError, H as Http, x as AuthHeader, y as CardSetupSessionInput, g as CallOptions, z as CardSetupSessionResult, F as CardSetupInput, G as CardSetupResult, J as CardSetupConfirmInput, K as CardSetupConfirmResult, N as PlayerCardsResult, O as PlatformPurchaseInput, Q as PlatformPurchaseResult, S as PlatformOrderStatusResult, T as PlatformRefundInput, U as PlatformRefundResult, X as CreateSubscriptionInput, Y as SubscriptionResult, Z as GetSubscriptionOptions, _ as GetSubscriptionResult, $ as ListSubscriptionsOptions, a0 as SubscriptionListResult, a1 as CancelSubscriptionOptions, a2 as CancelResult, a3 as ChangeAmountResult, a4 as SetPaymentMethodInput, a5 as SetPaymentMethodResult, a6 as RefundSubscriptionInput, a7 as RefundResult, a8 as SteamSubscriptionInitInput, a9 as SteamInitResult, aa as SteamFinalizeSubscriptionResult, ab as SandboxClockResult, ac as SandboxFailureOutcome, ad as SandboxForceFailureOptions, ae as SandboxForceAuthChallengeOptions, af as ServerConfig, ag as PlayerToken, ah as InitiateSendInput, ai as InitiateResult, aj as InitiateTransferInput, ak as CreateCheckoutInput, al as CreateCheckoutResult, am as PurchaseInput, an as PurchaseResult, ao as ConfirmPaymentResult, ap as OrderDetailsResult, aq as SteamPacksQuery, ar as SteamPacksResult, as as SteamInitPurchaseInput, at as SteamInitPurchaseResult, au as SteamFinalizeInput, av as SteamFinalizeResult, aw as PurchaseItemInput, ax as PurchaseItemResult, ay as ItemHistoryQuery, az as ItemHistoryResult, aA as ItemOrderQuery, aB as PlayerBalanceQuery, aC as PlayerBalanceResult, aD as InboundPendingQuery, aE as InboundPendingResult, aF as LinkedIdentitiesQuery, aG as LinkedIdentitiesResult, aH as SmsVerifyResult, aI as ClaimTransferInput, aJ as ClaimResult, aK as ClaimCurrencyInput, aL as TransactionStatusResult, aM as GuardianApprovalStatusResult, aN as ServerDestinationsQuery, k as DestinationsResult, aO as PhoneShareContact, aP as PhoneShareInitiateResult, aQ as PhoneShareApproveInput, aR as PhoneShareApproveResult, aS as PhoneShareStatusResult, aT as BeginDeviceApprovalInput, aU as DeviceApprovalGrant, aV as PollDeviceApprovalInput, aW as DeviceApprovalPollResult, aX as ConfirmDeviceEnrollmentInput, aY as ConfirmDeviceEnrollmentResult, aZ as ApproveWithDeviceCodeInput, a_ as DeviceApprovalSettleResult, a$ as CompleteDeviceApprovalInput, b0 as CompleteDeviceApprovalResult } from './types-DSLGe_0Z.js';
2
+ export { b1 as CardSetupStatus, b2 as CurrencyBalance, p as DestinationGame, b3 as DeviceApprovalChannel, b4 as DeviceApprovalEnrollment, b5 as DeviceApprovalFlow, b6 as DeviceApprovalPollStatus, b7 as DeviceEnrollmentDecision, b8 as DeviceEnrollmentRespond, b9 as FirstCharge, ba as FirstChargeStatus, bb as FundingSource, bc as InboundPendingItem, q as InvoErrorInfo, r as InvoHooks, s as InvoRequestInfo, t as InvoResponseInfo, bd as LinkedIdentityEmail, be as PlatformPurchaseStatus, w as Rail, bf as RefundInitiation, bg as RefundPendingApproval, bh as RefundProcessingFeeBasis, bi as RefundReceipt, bj as RefundRevenueShareAttribution, bk as RefundWarning, bl as SandboxClockState, bm as SavedCard, bn as SteamPack, bo as SteamUserSession, bp as Subscription, bq as SubscriptionBaseInput, br as SubscriptionConsent, bs as SubscriptionConsentInput, bt as SubscriptionFundingRail, bu as SubscriptionInterval, bv as SubscriptionRevenueShare, bw as SubscriptionRevenueShareInput, bx as SubscriptionStatus, V as VerificationMethod, by as isRefundPendingApproval } from './types-DSLGe_0Z.js';
3
3
 
4
4
  /**
5
5
  * The package version, as sent in the server User-Agent. A test pins this to
6
6
  * `package.json` so it cannot drift silently (it did: the UA read 3.0.0 through 3.7.0).
7
7
  * Bump it with the changeset flow.
8
8
  */
9
- declare const SDK_VERSION = "3.10.0";
9
+ declare const SDK_VERSION = "3.11.0";
10
10
 
11
11
  interface VerifyWebhookOptions {
12
12
  /** Max age of the signed timestamp, in seconds. Default 300 (5 min). */
package/dist/server.js CHANGED
@@ -1,9 +1,9 @@
1
- import { InvoError, assertSecureBaseUrl, Http, toDestinationsResult } from './chunk-L4A6OV54.js';
2
- export { InvoError } from './chunk-L4A6OV54.js';
1
+ import { InvoError, assertSecureBaseUrl, Http, toDestinationsResult } from './chunk-ZDBU3L4T.js';
2
+ export { InvoError } from './chunk-ZDBU3L4T.js';
3
3
  import { createHmac, timingSafeEqual } from 'crypto';
4
4
 
5
5
  // src/version.ts
6
- var SDK_VERSION = "3.10.0";
6
+ var SDK_VERSION = "3.11.0";
7
7
 
8
8
  // src/shared/types.ts
9
9
  function isRefundPendingApproval(r) {
@@ -212,6 +212,19 @@ function assertE164(value, label) {
212
212
  throw invalidInput(label, value, 'must be an E.164 phone number, e.g. "+15555550100"');
213
213
  }
214
214
  }
215
+ function sessionTokenFromCreateCheckout(raw, checkoutUrl) {
216
+ const field = raw["session_token"];
217
+ if (typeof field === "string" && field.trim()) return field;
218
+ return sessionTokenFromCheckoutUrl(checkoutUrl);
219
+ }
220
+ function sessionTokenFromCheckoutUrl(checkoutUrl) {
221
+ try {
222
+ const value = new URL(checkoutUrl).searchParams.get("session");
223
+ return value && value.trim() ? value : void 0;
224
+ } catch {
225
+ return void 0;
226
+ }
227
+ }
215
228
  function toOrderDetails(raw) {
216
229
  return {
217
230
  order: raw["order"] ?? {},
@@ -1769,11 +1782,16 @@ var InvoServer = class {
1769
1782
  { signal: opts?.signal }
1770
1783
  // not idempotent — never auto-retried
1771
1784
  );
1785
+ const checkoutUrl = requireField(raw["checkout_url"], "checkout_url", raw);
1772
1786
  return {
1773
1787
  sessionId: String(raw["session_id"] ?? ""),
1774
- checkoutUrl: requireField(raw["checkout_url"], "checkout_url", raw),
1788
+ checkoutUrl,
1775
1789
  expiresAt: String(raw["expires_at"] ?? ""),
1776
1790
  expiresInSeconds: Number(raw["expires_in_seconds"] ?? 0),
1791
+ // INVO's own `session_token` field, falling back to the `checkout_url` query string
1792
+ // for a backend older than commit 856fa266. Either way a server that wants to read
1793
+ // the purchase status later does not have to parse a URL itself.
1794
+ sessionToken: sessionTokenFromCreateCheckout(raw, checkoutUrl),
1777
1795
  raw
1778
1796
  };
1779
1797
  }
@@ -506,6 +506,26 @@ declare class InvoError extends Error {
506
506
  * (`javascript:`, `data:`, `vbscript:`). http(s) and app deep-link schemes are fine.
507
507
  */
508
508
  get isInvalidInput(): boolean;
509
+ /**
510
+ * True when a session token was refused because it belongs to a DIFFERENT checkout
511
+ * session than the id in the path (`SESSION_MISMATCH`, 403). The token is the
512
+ * credential and the id is only a label, so the two have to agree; pair a `sessionId`
513
+ * with the `sessionToken` minted for it.
514
+ */
515
+ get isCheckoutSessionMismatch(): boolean;
516
+ /**
517
+ * True when a token minted to SAVE A CARD was used where a purchase token belongs
518
+ * (`WRONG_SESSION_PURPOSE`, 401). A card setup session settles nothing and has no
519
+ * purchase to report on.
520
+ */
521
+ get isWrongSessionPurpose(): boolean;
522
+ /**
523
+ * True when a checkout session token is too far past its expiry to answer with
524
+ * (`SESSION_EXPIRED`, 410). A lapsed token still reads its own purchase for a bounded
525
+ * window, because a charge outlives a 15 minute link; past that, show the buyer the
526
+ * order id you already hold and a Contact support link rather than a blank screen.
527
+ */
528
+ get isCheckoutSessionExpired(): boolean;
509
529
  /** Seconds to wait before retrying, when the backend throttled the call (429 `retry_after`). */
510
530
  get retryAfter(): number | undefined;
511
531
  /** `body` as a plain object, or `{}` if it's a string/number/null (non-JSON responses).
@@ -717,6 +737,16 @@ interface CreateCheckoutResult {
717
737
  expiresAt: string;
718
738
  /** The `checkout_url` token TTL in seconds (e.g. 900 = 15 min). 0 if the backend omits it. */
719
739
  expiresInSeconds: number;
740
+ /**
741
+ * The session token that authenticates {@link CheckoutClient.getPurchaseStatus}. Taken
742
+ * from INVO's `session_token` field, and only from `checkoutUrl`'s `session` parameter
743
+ * when talking to a backend that predates that field. `undefined` if neither carries one.
744
+ *
745
+ * IT IS A CREDENTIAL. It authorises reading this one purchase's status and nothing else,
746
+ * but it is still the thing that opens the checkout, so keep it server-side or hand it
747
+ * only to the buyer whose purchase it is.
748
+ */
749
+ sessionToken?: string;
720
750
  raw: Record<string, unknown>;
721
751
  }
722
752
  interface PurchaseInput {
@@ -2288,5 +2318,165 @@ interface SandboxClockResult {
2288
2318
  note?: string;
2289
2319
  raw: Record<string, unknown>;
2290
2320
  }
2321
+ /**
2322
+ * What a checkout purchase is DOING, in the six words INVO answers with.
2323
+ *
2324
+ * NAMED `Checkout…` BECAUSE `PurchaseStatus` WAS ALREADY TAKEN, by the direct
2325
+ * `purchaseCurrency` result (`success` | `requires_action` | `pending_payment`). That one
2326
+ * is unchanged and is a different question: it reports how a single call ended, while this
2327
+ * reports what happened to the buyer's money afterwards.
2328
+ *
2329
+ * | value | meaning |
2330
+ * |---|---|
2331
+ * | `pending` | No payment has been seen for this checkout yet. |
2332
+ * | `paid_pending_credit` | A charge is open and the coins are not in the balance yet. Normally seconds. |
2333
+ * | `credited` | Charged and credited. |
2334
+ * | `refused` | This purchase will not credit; `reasonCode` says why. |
2335
+ * | `refunded` | The money went back to the buyer. |
2336
+ * | `expired` | Never paid, can no longer be paid. |
2337
+ *
2338
+ * WIDENED ON PURPOSE. `(string & {})` keeps the six literals in autocomplete while
2339
+ * letting any string assign and compare, so a value INVO adds later cannot break a
2340
+ * build pinned to this release. `RefundResult.status` learned this in 3.10.0.
2341
+ *
2342
+ * **Never decide when to stop polling from this field.** Use
2343
+ * {@link PurchaseStatusResult.terminal}, which INVO sends.
2344
+ */
2345
+ type CheckoutPurchaseStatus = "pending" | "paid_pending_credit" | "credited" | "refused" | "refunded" | "expired" | (string & {});
2346
+ /**
2347
+ * Why a purchase was refused or refunded. Pinned vocabulary; an unrecognised code is a
2348
+ * generic refusal and {@link PurchaseStatusResult.message} is still the thing to render.
2349
+ *
2350
+ * **Money was taken and the coins were withheld** (show `message`, show `orderId`, offer
2351
+ * Contact support, never a Try again): `CREDIT_REFUSED_MINT_CEILING`,
2352
+ * `CREDIT_REFUSED_UNKNOWN_RAIL`, `CREDIT_REFUSED_WRONG_ORDER_TYPE`,
2353
+ * `CREDIT_REFUSED_RATE_UNAVAILABLE`, `CREDIT_REFUSED_NO_PEG_BASIS`,
2354
+ * `CREDIT_REFUSED_NO_PAYMENT_REFERENCE`. They read identically to the buyer, because from
2355
+ * where they are standing they are identical; the code is for support to quote. INVO raises
2356
+ * a critical alert on every one of them.
2357
+ *
2358
+ * **Nothing was charged** (offer Try again beside Contact support): `PAYMENT_DECLINED`,
2359
+ * `PAYMENT_CANCELLED`. See {@link nothingWasCharged}.
2360
+ *
2361
+ * **The money went back**: `REFUNDED`, `CHARGEBACK_LOST`.
2362
+ */
2363
+ type PurchaseRefusalReason = "PAYMENT_DECLINED" | "PAYMENT_CANCELLED" | "CREDIT_REFUSED_MINT_CEILING" | "CREDIT_REFUSED_UNKNOWN_RAIL" | "CREDIT_REFUSED_RATE_UNAVAILABLE" | "CREDIT_REFUSED_NO_PEG_BASIS" | "CREDIT_REFUSED_NO_PAYMENT_REFERENCE" | "CREDIT_REFUSED_WRONG_ORDER_TYPE" | "REFUNDED" | "CHARGEBACK_LOST" | (string & {});
2364
+ /** Identifies the checkout session to read. Both come from `createCheckout`. */
2365
+ interface PurchaseStatusInput {
2366
+ /** `createCheckout().sessionId`. It is an identifier, not a credential. */
2367
+ sessionId: string;
2368
+ /**
2369
+ * The session token. It is the credential, and it must be the token minted for
2370
+ * `sessionId` (a token for another session is refused `403 SESSION_MISMATCH`).
2371
+ * `createCheckout().sessionToken` carries it, and the hosted page reads it from
2372
+ * its own `?session=` parameter.
2373
+ */
2374
+ sessionToken: string;
2375
+ }
2376
+ /** Options for `checkout.waitForPurchase`. */
2377
+ interface WaitForPurchaseInput extends PurchaseStatusInput {
2378
+ /**
2379
+ * Spacing between reads, in ms. Default 1500. INVO allows 600 reads per minute per
2380
+ * IP, so one every second or two is well inside the limit and no backoff is needed.
2381
+ */
2382
+ intervalMs?: number;
2383
+ /**
2384
+ * The cap: stop waiting after this long, in ms. Default 180000 (3 minutes). On the cap
2385
+ * the LAST result is returned with its own `terminal` (false), never a thrown error and
2386
+ * never a guessed outcome, so keep showing the buyer what it says.
2387
+ *
2388
+ * A checkout that is never paid only turns `expired` about 45 minutes after it was
2389
+ * created, because a payment made in the last minutes of a link can still be found
2390
+ * afterwards. Raise the cap if you want to poll a page all the way to that.
2391
+ */
2392
+ timeoutMs?: number;
2393
+ /** A second cap, on reads rather than time. Unlimited by default. */
2394
+ maxAttempts?: number;
2395
+ /** Cancels the wait. The rejection is an `InvoError` with `code: "ABORTED"`. */
2396
+ signal?: AbortSignal;
2397
+ /** Called with every result, terminal or not. Render the buyer's screen from it. */
2398
+ onUpdate?: (result: PurchaseStatusResult) => void;
2399
+ }
2400
+ /**
2401
+ * What happened to one checkout purchase, in fields a page can render. Every field is
2402
+ * exactly what INVO answered with; nothing here is inferred.
2403
+ */
2404
+ interface PurchaseStatusResult {
2405
+ /** One of six words. See {@link CheckoutPurchaseStatus}. Do not stop polling on it. */
2406
+ status: CheckoutPurchaseStatus;
2407
+ /**
2408
+ * **INVO's answer to "is anything else going to happen".** `true` for `credited`,
2409
+ * `refused`, `refunded` and `expired`. Stop polling on it and on nothing else: it is
2410
+ * read straight off the response and is never re-derived from `status`, so a status
2411
+ * this build has never heard of cannot be mistaken for a finished purchase. A response
2412
+ * that omits it reads `false`, which keeps a poll going rather than ending it on a guess.
2413
+ */
2414
+ terminal: boolean;
2415
+ /** The order. `null` until one exists. Always show it on a refusal. */
2416
+ orderId: string | null;
2417
+ /** Echo of the session read. */
2418
+ sessionId: string;
2419
+ /** Decimal string. Non-null only on `credited`. */
2420
+ coinsCredited: string | null;
2421
+ /** Non-null only on `credited`. */
2422
+ transactionId: string | null;
2423
+ /**
2424
+ * The player's balance after the credit, when it could be read cheaply. `null`
2425
+ * otherwise, never a guess, and always `null` once the session has passed its expiry
2426
+ * (the token rides in the checkout URL, so a stale link must not serve a live wallet).
2427
+ */
2428
+ newBalance: string | null;
2429
+ /** Non-null on `refused` and `refunded`. See {@link PurchaseRefusalReason}. */
2430
+ reasonCode: PurchaseRefusalReason | null;
2431
+ /**
2432
+ * One player-safe sentence, present on `refused`, `refunded` and `expired`.
2433
+ * **Render it verbatim.** Do not paraphrase it, and do not show `reasonCode` on its own.
2434
+ */
2435
+ message: string | null;
2436
+ /**
2437
+ * What the card is charged. Before payment it is what this checkout WILL charge.
2438
+ * `amountChargedUsd` minus `listedUsd` is the processing fee the buyer pays on the card
2439
+ * rail, which is the question a buyer billed 206.29 for a 200 pack will ask.
2440
+ */
2441
+ amountChargedUsd: string | null;
2442
+ /** The listed pack price. */
2443
+ listedUsd: string | null;
2444
+ /** What the coins are called in this game, for your own copy. */
2445
+ currencyName: string | null;
2446
+ raw: Record<string, unknown>;
2447
+ }
2448
+ /** A {@link PurchaseStatusResult} narrowed by {@link isPurchaseCredited}. */
2449
+ interface PurchaseCredited extends PurchaseStatusResult {
2450
+ status: "credited";
2451
+ coinsCredited: string;
2452
+ transactionId: string;
2453
+ }
2454
+ /** A {@link PurchaseStatusResult} narrowed by {@link isPurchaseRefused}. */
2455
+ interface PurchaseRefused extends PurchaseStatusResult {
2456
+ status: "refused";
2457
+ reasonCode: PurchaseRefusalReason;
2458
+ message: string;
2459
+ }
2460
+ /** A {@link PurchaseStatusResult} narrowed by {@link isPurchaseRefunded}. */
2461
+ interface PurchaseRefunded extends PurchaseStatusResult {
2462
+ status: "refunded";
2463
+ reasonCode: PurchaseRefusalReason;
2464
+ message: string;
2465
+ }
2466
+ /** A {@link PurchaseStatusResult} narrowed by {@link isPurchaseExpired}. */
2467
+ interface PurchaseExpired extends PurchaseStatusResult {
2468
+ status: "expired";
2469
+ message: string;
2470
+ }
2471
+ /** Config for a standalone {@link CheckoutClient} (a page with no player token). */
2472
+ interface CheckoutClientConfig {
2473
+ /** e.g. `https://invo.network` or `https://sandbox.invo.network/sandbox`. */
2474
+ baseUrl: string;
2475
+ timeoutMs?: number;
2476
+ fetch?: typeof fetch;
2477
+ maxRetries?: number;
2478
+ retryBaseDelayMs?: number;
2479
+ hooks?: InvoHooks;
2480
+ }
2291
2481
 
2292
- export { type SteamInitResult as $, type ApproveResult as A, type BalanceResult as B, type ConfirmReceiptResult as C, type DestinationsQuery as D, type EnrollmentBeginResult as E, type PlatformRefundResult as F, type CreateSubscriptionInput as G, Http as H, InvoError as I, type GetSubscriptionOptions as J, type GetSubscriptionResult as K, type LinkDeviceResult as L, type MountCheckoutOptions as M, type ListSubscriptionsOptions as N, type SubscriptionListResult as O, type PendingCollectResult as P, type CancelSubscriptionOptions as Q, type RecoveryBeginResult as R, type SubscriptionResult as S, type CancelResult as T, type ChangeAmountResult as U, type VerificationMethod as V, type SetPaymentMethodInput as W, type SetPaymentMethodResult as X, type RefundSubscriptionInput as Y, type RefundResult as Z, type SteamSubscriptionInitInput as _, type CheckoutMountHandle as a, type FirstCharge as a$, type SteamFinalizeSubscriptionResult as a0, type SandboxClockResult as a1, type SandboxFailureOutcome as a2, type SandboxForceFailureOptions as a3, type SandboxForceAuthChallengeOptions as a4, type ServerConfig as a5, type PlayerToken as a6, type InitiateSendInput as a7, type InitiateResult as a8, type InitiateTransferInput 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 BeginDeviceApprovalInput as aJ, type DeviceApprovalGrant as aK, type PollDeviceApprovalInput as aL, type DeviceApprovalPollResult as aM, type ConfirmDeviceEnrollmentInput as aN, type ConfirmDeviceEnrollmentResult as aO, type ApproveWithDeviceCodeInput as aP, type DeviceApprovalSettleResult as aQ, type CompleteDeviceApprovalInput as aR, type CompleteDeviceApprovalResult as aS, type CardSetupStatus as aT, type CurrencyBalance as aU, type DeviceApprovalChannel as aV, type DeviceApprovalEnrollment as aW, type DeviceApprovalFlow as aX, type DeviceApprovalPollStatus as aY, type DeviceEnrollmentDecision as aZ, type DeviceEnrollmentRespond as a_, type CreateCheckoutInput as aa, type CreateCheckoutResult as ab, type PurchaseInput as ac, type PurchaseResult as ad, type ConfirmPaymentResult as ae, type OrderDetailsResult as af, type SteamPacksQuery as ag, type SteamPacksResult as ah, type SteamInitPurchaseInput as ai, type SteamInitPurchaseResult as aj, type SteamFinalizeInput as ak, type SteamFinalizeResult as al, type PurchaseItemInput as am, type PurchaseItemResult as an, type ItemHistoryQuery as ao, type ItemHistoryResult as ap, type ItemOrderQuery as aq, type PlayerBalanceQuery as ar, type PlayerBalanceResult as as, type InboundPendingQuery as at, type InboundPendingResult as au, type LinkedIdentitiesQuery as av, type LinkedIdentitiesResult as aw, type SmsVerifyResult as ax, type ClaimTransferInput as ay, type ClaimResult as az, type ClientConfig as b, type FirstChargeStatus as b0, type FundingSource as b1, type InboundPendingItem as b2, type LinkedIdentityEmail as b3, type PlatformPurchaseStatus as b4, type RefundInitiation as b5, type RefundPendingApproval as b6, type RefundProcessingFeeBasis as b7, type RefundReceipt as b8, type RefundRevenueShareAttribution as b9, type RefundWarning as ba, type SandboxClockState as bb, type SavedCard as bc, type SteamPack as bd, type SteamUserSession as be, type Subscription as bf, type SubscriptionBaseInput as bg, type SubscriptionConsent as bh, type SubscriptionConsentInput as bi, type SubscriptionFundingRail as bj, type SubscriptionInterval as bk, type SubscriptionRevenueShare as bl, type SubscriptionRevenueShareInput as bm, type SubscriptionStatus as bn, isRefundPendingApproval as bo, type CallOptions 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 CardSetupSessionInput as p, type CardSetupSessionResult as q, type CardSetupInput as r, type CardSetupResult as s, type CardSetupConfirmInput as t, type CardSetupConfirmResult as u, type PlayerCardsResult as v, type PlatformPurchaseInput as w, type PlatformPurchaseResult as x, type PlatformOrderStatusResult as y, type PlatformRefundInput as z };
2482
+ export { type ListSubscriptionsOptions as $, type ApproveResult as A, type BalanceResult as B, type ConfirmReceiptResult as C, type DestinationsQuery as D, type EnrollmentBeginResult as E, type CardSetupInput as F, type CardSetupResult as G, Http as H, InvoError as I, type CardSetupConfirmInput as J, type CardSetupConfirmResult as K, type LinkDeviceResult as L, type MountCheckoutOptions as M, type PlayerCardsResult as N, type PlatformPurchaseInput as O, type PurchaseStatusResult as P, type PlatformPurchaseResult as Q, type RecoveryBeginResult as R, type PlatformOrderStatusResult as S, type PlatformRefundInput as T, type PlatformRefundResult as U, type VerificationMethod as V, type WaitForPurchaseInput as W, type CreateSubscriptionInput as X, type SubscriptionResult as Y, type GetSubscriptionOptions as Z, type GetSubscriptionResult as _, type PurchaseCredited as a, type CompleteDeviceApprovalInput as a$, type SubscriptionListResult as a0, type CancelSubscriptionOptions as a1, type CancelResult as a2, type ChangeAmountResult as a3, type SetPaymentMethodInput as a4, type SetPaymentMethodResult as a5, type RefundSubscriptionInput as a6, type RefundResult as a7, type SteamSubscriptionInitInput as a8, type SteamInitResult as a9, type ItemOrderQuery as aA, type PlayerBalanceQuery as aB, type PlayerBalanceResult as aC, type InboundPendingQuery as aD, type InboundPendingResult as aE, type LinkedIdentitiesQuery as aF, type LinkedIdentitiesResult as aG, type SmsVerifyResult as aH, type ClaimTransferInput as aI, type ClaimResult as aJ, type ClaimCurrencyInput as aK, type TransactionStatusResult as aL, type GuardianApprovalStatusResult as aM, type ServerDestinationsQuery as aN, type PhoneShareContact as aO, type PhoneShareInitiateResult as aP, type PhoneShareApproveInput as aQ, type PhoneShareApproveResult as aR, type PhoneShareStatusResult as aS, type BeginDeviceApprovalInput as aT, type DeviceApprovalGrant as aU, type PollDeviceApprovalInput as aV, type DeviceApprovalPollResult as aW, type ConfirmDeviceEnrollmentInput as aX, type ConfirmDeviceEnrollmentResult as aY, type ApproveWithDeviceCodeInput as aZ, type DeviceApprovalSettleResult as a_, type SteamFinalizeSubscriptionResult as aa, type SandboxClockResult as ab, type SandboxFailureOutcome as ac, type SandboxForceFailureOptions as ad, type SandboxForceAuthChallengeOptions as ae, type ServerConfig as af, type PlayerToken as ag, type InitiateSendInput as ah, type InitiateResult as ai, type InitiateTransferInput as aj, type CreateCheckoutInput as ak, type CreateCheckoutResult as al, type PurchaseInput as am, type PurchaseResult as an, type ConfirmPaymentResult as ao, type OrderDetailsResult as ap, type SteamPacksQuery as aq, type SteamPacksResult as ar, type SteamInitPurchaseInput as as, type SteamInitPurchaseResult as at, type SteamFinalizeInput as au, type SteamFinalizeResult as av, type PurchaseItemInput as aw, type PurchaseItemResult as ax, type ItemHistoryQuery as ay, type ItemHistoryResult as az, type PurchaseExpired as b, type CompleteDeviceApprovalResult as b0, type CardSetupStatus as b1, type CurrencyBalance as b2, type DeviceApprovalChannel as b3, type DeviceApprovalEnrollment as b4, type DeviceApprovalFlow as b5, type DeviceApprovalPollStatus as b6, type DeviceEnrollmentDecision as b7, type DeviceEnrollmentRespond as b8, type FirstCharge as b9, type FirstChargeStatus as ba, type FundingSource as bb, type InboundPendingItem as bc, type LinkedIdentityEmail as bd, type PlatformPurchaseStatus as be, type RefundInitiation as bf, type RefundPendingApproval as bg, type RefundProcessingFeeBasis as bh, type RefundReceipt as bi, type RefundRevenueShareAttribution as bj, type RefundWarning as bk, type SandboxClockState as bl, type SavedCard as bm, type SteamPack as bn, type SteamUserSession as bo, type Subscription as bp, type SubscriptionBaseInput as bq, type SubscriptionConsent as br, type SubscriptionConsentInput as bs, type SubscriptionFundingRail as bt, type SubscriptionInterval as bu, type SubscriptionRevenueShare as bv, type SubscriptionRevenueShareInput as bw, type SubscriptionStatus as bx, isRefundPendingApproval as by, type PurchaseRefunded as c, type PurchaseRefused as d, type CheckoutClientConfig as e, type PurchaseStatusInput as f, type CallOptions as g, type CheckoutMountHandle as h, type ClientConfig as i, type PendingCollectResult as j, type DestinationsResult as k, type EnrollmentVerifyResult as l, type RecoveryCompleteResult as m, type BalanceRow as n, type CheckoutPurchaseStatus as o, type DestinationGame as p, type InvoErrorInfo as q, type InvoHooks as r, type InvoRequestInfo as s, type InvoResponseInfo as t, type PendingCollectItem as u, type PurchaseRefusalReason as v, type Rail as w, type AuthHeader as x, type CardSetupSessionInput as y, type CardSetupSessionResult as z };
@@ -506,6 +506,26 @@ declare class InvoError extends Error {
506
506
  * (`javascript:`, `data:`, `vbscript:`). http(s) and app deep-link schemes are fine.
507
507
  */
508
508
  get isInvalidInput(): boolean;
509
+ /**
510
+ * True when a session token was refused because it belongs to a DIFFERENT checkout
511
+ * session than the id in the path (`SESSION_MISMATCH`, 403). The token is the
512
+ * credential and the id is only a label, so the two have to agree; pair a `sessionId`
513
+ * with the `sessionToken` minted for it.
514
+ */
515
+ get isCheckoutSessionMismatch(): boolean;
516
+ /**
517
+ * True when a token minted to SAVE A CARD was used where a purchase token belongs
518
+ * (`WRONG_SESSION_PURPOSE`, 401). A card setup session settles nothing and has no
519
+ * purchase to report on.
520
+ */
521
+ get isWrongSessionPurpose(): boolean;
522
+ /**
523
+ * True when a checkout session token is too far past its expiry to answer with
524
+ * (`SESSION_EXPIRED`, 410). A lapsed token still reads its own purchase for a bounded
525
+ * window, because a charge outlives a 15 minute link; past that, show the buyer the
526
+ * order id you already hold and a Contact support link rather than a blank screen.
527
+ */
528
+ get isCheckoutSessionExpired(): boolean;
509
529
  /** Seconds to wait before retrying, when the backend throttled the call (429 `retry_after`). */
510
530
  get retryAfter(): number | undefined;
511
531
  /** `body` as a plain object, or `{}` if it's a string/number/null (non-JSON responses).
@@ -717,6 +737,16 @@ interface CreateCheckoutResult {
717
737
  expiresAt: string;
718
738
  /** The `checkout_url` token TTL in seconds (e.g. 900 = 15 min). 0 if the backend omits it. */
719
739
  expiresInSeconds: number;
740
+ /**
741
+ * The session token that authenticates {@link CheckoutClient.getPurchaseStatus}. Taken
742
+ * from INVO's `session_token` field, and only from `checkoutUrl`'s `session` parameter
743
+ * when talking to a backend that predates that field. `undefined` if neither carries one.
744
+ *
745
+ * IT IS A CREDENTIAL. It authorises reading this one purchase's status and nothing else,
746
+ * but it is still the thing that opens the checkout, so keep it server-side or hand it
747
+ * only to the buyer whose purchase it is.
748
+ */
749
+ sessionToken?: string;
720
750
  raw: Record<string, unknown>;
721
751
  }
722
752
  interface PurchaseInput {
@@ -2288,5 +2318,165 @@ interface SandboxClockResult {
2288
2318
  note?: string;
2289
2319
  raw: Record<string, unknown>;
2290
2320
  }
2321
+ /**
2322
+ * What a checkout purchase is DOING, in the six words INVO answers with.
2323
+ *
2324
+ * NAMED `Checkout…` BECAUSE `PurchaseStatus` WAS ALREADY TAKEN, by the direct
2325
+ * `purchaseCurrency` result (`success` | `requires_action` | `pending_payment`). That one
2326
+ * is unchanged and is a different question: it reports how a single call ended, while this
2327
+ * reports what happened to the buyer's money afterwards.
2328
+ *
2329
+ * | value | meaning |
2330
+ * |---|---|
2331
+ * | `pending` | No payment has been seen for this checkout yet. |
2332
+ * | `paid_pending_credit` | A charge is open and the coins are not in the balance yet. Normally seconds. |
2333
+ * | `credited` | Charged and credited. |
2334
+ * | `refused` | This purchase will not credit; `reasonCode` says why. |
2335
+ * | `refunded` | The money went back to the buyer. |
2336
+ * | `expired` | Never paid, can no longer be paid. |
2337
+ *
2338
+ * WIDENED ON PURPOSE. `(string & {})` keeps the six literals in autocomplete while
2339
+ * letting any string assign and compare, so a value INVO adds later cannot break a
2340
+ * build pinned to this release. `RefundResult.status` learned this in 3.10.0.
2341
+ *
2342
+ * **Never decide when to stop polling from this field.** Use
2343
+ * {@link PurchaseStatusResult.terminal}, which INVO sends.
2344
+ */
2345
+ type CheckoutPurchaseStatus = "pending" | "paid_pending_credit" | "credited" | "refused" | "refunded" | "expired" | (string & {});
2346
+ /**
2347
+ * Why a purchase was refused or refunded. Pinned vocabulary; an unrecognised code is a
2348
+ * generic refusal and {@link PurchaseStatusResult.message} is still the thing to render.
2349
+ *
2350
+ * **Money was taken and the coins were withheld** (show `message`, show `orderId`, offer
2351
+ * Contact support, never a Try again): `CREDIT_REFUSED_MINT_CEILING`,
2352
+ * `CREDIT_REFUSED_UNKNOWN_RAIL`, `CREDIT_REFUSED_WRONG_ORDER_TYPE`,
2353
+ * `CREDIT_REFUSED_RATE_UNAVAILABLE`, `CREDIT_REFUSED_NO_PEG_BASIS`,
2354
+ * `CREDIT_REFUSED_NO_PAYMENT_REFERENCE`. They read identically to the buyer, because from
2355
+ * where they are standing they are identical; the code is for support to quote. INVO raises
2356
+ * a critical alert on every one of them.
2357
+ *
2358
+ * **Nothing was charged** (offer Try again beside Contact support): `PAYMENT_DECLINED`,
2359
+ * `PAYMENT_CANCELLED`. See {@link nothingWasCharged}.
2360
+ *
2361
+ * **The money went back**: `REFUNDED`, `CHARGEBACK_LOST`.
2362
+ */
2363
+ type PurchaseRefusalReason = "PAYMENT_DECLINED" | "PAYMENT_CANCELLED" | "CREDIT_REFUSED_MINT_CEILING" | "CREDIT_REFUSED_UNKNOWN_RAIL" | "CREDIT_REFUSED_RATE_UNAVAILABLE" | "CREDIT_REFUSED_NO_PEG_BASIS" | "CREDIT_REFUSED_NO_PAYMENT_REFERENCE" | "CREDIT_REFUSED_WRONG_ORDER_TYPE" | "REFUNDED" | "CHARGEBACK_LOST" | (string & {});
2364
+ /** Identifies the checkout session to read. Both come from `createCheckout`. */
2365
+ interface PurchaseStatusInput {
2366
+ /** `createCheckout().sessionId`. It is an identifier, not a credential. */
2367
+ sessionId: string;
2368
+ /**
2369
+ * The session token. It is the credential, and it must be the token minted for
2370
+ * `sessionId` (a token for another session is refused `403 SESSION_MISMATCH`).
2371
+ * `createCheckout().sessionToken` carries it, and the hosted page reads it from
2372
+ * its own `?session=` parameter.
2373
+ */
2374
+ sessionToken: string;
2375
+ }
2376
+ /** Options for `checkout.waitForPurchase`. */
2377
+ interface WaitForPurchaseInput extends PurchaseStatusInput {
2378
+ /**
2379
+ * Spacing between reads, in ms. Default 1500. INVO allows 600 reads per minute per
2380
+ * IP, so one every second or two is well inside the limit and no backoff is needed.
2381
+ */
2382
+ intervalMs?: number;
2383
+ /**
2384
+ * The cap: stop waiting after this long, in ms. Default 180000 (3 minutes). On the cap
2385
+ * the LAST result is returned with its own `terminal` (false), never a thrown error and
2386
+ * never a guessed outcome, so keep showing the buyer what it says.
2387
+ *
2388
+ * A checkout that is never paid only turns `expired` about 45 minutes after it was
2389
+ * created, because a payment made in the last minutes of a link can still be found
2390
+ * afterwards. Raise the cap if you want to poll a page all the way to that.
2391
+ */
2392
+ timeoutMs?: number;
2393
+ /** A second cap, on reads rather than time. Unlimited by default. */
2394
+ maxAttempts?: number;
2395
+ /** Cancels the wait. The rejection is an `InvoError` with `code: "ABORTED"`. */
2396
+ signal?: AbortSignal;
2397
+ /** Called with every result, terminal or not. Render the buyer's screen from it. */
2398
+ onUpdate?: (result: PurchaseStatusResult) => void;
2399
+ }
2400
+ /**
2401
+ * What happened to one checkout purchase, in fields a page can render. Every field is
2402
+ * exactly what INVO answered with; nothing here is inferred.
2403
+ */
2404
+ interface PurchaseStatusResult {
2405
+ /** One of six words. See {@link CheckoutPurchaseStatus}. Do not stop polling on it. */
2406
+ status: CheckoutPurchaseStatus;
2407
+ /**
2408
+ * **INVO's answer to "is anything else going to happen".** `true` for `credited`,
2409
+ * `refused`, `refunded` and `expired`. Stop polling on it and on nothing else: it is
2410
+ * read straight off the response and is never re-derived from `status`, so a status
2411
+ * this build has never heard of cannot be mistaken for a finished purchase. A response
2412
+ * that omits it reads `false`, which keeps a poll going rather than ending it on a guess.
2413
+ */
2414
+ terminal: boolean;
2415
+ /** The order. `null` until one exists. Always show it on a refusal. */
2416
+ orderId: string | null;
2417
+ /** Echo of the session read. */
2418
+ sessionId: string;
2419
+ /** Decimal string. Non-null only on `credited`. */
2420
+ coinsCredited: string | null;
2421
+ /** Non-null only on `credited`. */
2422
+ transactionId: string | null;
2423
+ /**
2424
+ * The player's balance after the credit, when it could be read cheaply. `null`
2425
+ * otherwise, never a guess, and always `null` once the session has passed its expiry
2426
+ * (the token rides in the checkout URL, so a stale link must not serve a live wallet).
2427
+ */
2428
+ newBalance: string | null;
2429
+ /** Non-null on `refused` and `refunded`. See {@link PurchaseRefusalReason}. */
2430
+ reasonCode: PurchaseRefusalReason | null;
2431
+ /**
2432
+ * One player-safe sentence, present on `refused`, `refunded` and `expired`.
2433
+ * **Render it verbatim.** Do not paraphrase it, and do not show `reasonCode` on its own.
2434
+ */
2435
+ message: string | null;
2436
+ /**
2437
+ * What the card is charged. Before payment it is what this checkout WILL charge.
2438
+ * `amountChargedUsd` minus `listedUsd` is the processing fee the buyer pays on the card
2439
+ * rail, which is the question a buyer billed 206.29 for a 200 pack will ask.
2440
+ */
2441
+ amountChargedUsd: string | null;
2442
+ /** The listed pack price. */
2443
+ listedUsd: string | null;
2444
+ /** What the coins are called in this game, for your own copy. */
2445
+ currencyName: string | null;
2446
+ raw: Record<string, unknown>;
2447
+ }
2448
+ /** A {@link PurchaseStatusResult} narrowed by {@link isPurchaseCredited}. */
2449
+ interface PurchaseCredited extends PurchaseStatusResult {
2450
+ status: "credited";
2451
+ coinsCredited: string;
2452
+ transactionId: string;
2453
+ }
2454
+ /** A {@link PurchaseStatusResult} narrowed by {@link isPurchaseRefused}. */
2455
+ interface PurchaseRefused extends PurchaseStatusResult {
2456
+ status: "refused";
2457
+ reasonCode: PurchaseRefusalReason;
2458
+ message: string;
2459
+ }
2460
+ /** A {@link PurchaseStatusResult} narrowed by {@link isPurchaseRefunded}. */
2461
+ interface PurchaseRefunded extends PurchaseStatusResult {
2462
+ status: "refunded";
2463
+ reasonCode: PurchaseRefusalReason;
2464
+ message: string;
2465
+ }
2466
+ /** A {@link PurchaseStatusResult} narrowed by {@link isPurchaseExpired}. */
2467
+ interface PurchaseExpired extends PurchaseStatusResult {
2468
+ status: "expired";
2469
+ message: string;
2470
+ }
2471
+ /** Config for a standalone {@link CheckoutClient} (a page with no player token). */
2472
+ interface CheckoutClientConfig {
2473
+ /** e.g. `https://invo.network` or `https://sandbox.invo.network/sandbox`. */
2474
+ baseUrl: string;
2475
+ timeoutMs?: number;
2476
+ fetch?: typeof fetch;
2477
+ maxRetries?: number;
2478
+ retryBaseDelayMs?: number;
2479
+ hooks?: InvoHooks;
2480
+ }
2291
2481
 
2292
- export { type SteamInitResult as $, type ApproveResult as A, type BalanceResult as B, type ConfirmReceiptResult as C, type DestinationsQuery as D, type EnrollmentBeginResult as E, type PlatformRefundResult as F, type CreateSubscriptionInput as G, Http as H, InvoError as I, type GetSubscriptionOptions as J, type GetSubscriptionResult as K, type LinkDeviceResult as L, type MountCheckoutOptions as M, type ListSubscriptionsOptions as N, type SubscriptionListResult as O, type PendingCollectResult as P, type CancelSubscriptionOptions as Q, type RecoveryBeginResult as R, type SubscriptionResult as S, type CancelResult as T, type ChangeAmountResult as U, type VerificationMethod as V, type SetPaymentMethodInput as W, type SetPaymentMethodResult as X, type RefundSubscriptionInput as Y, type RefundResult as Z, type SteamSubscriptionInitInput as _, type CheckoutMountHandle as a, type FirstCharge as a$, type SteamFinalizeSubscriptionResult as a0, type SandboxClockResult as a1, type SandboxFailureOutcome as a2, type SandboxForceFailureOptions as a3, type SandboxForceAuthChallengeOptions as a4, type ServerConfig as a5, type PlayerToken as a6, type InitiateSendInput as a7, type InitiateResult as a8, type InitiateTransferInput 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 BeginDeviceApprovalInput as aJ, type DeviceApprovalGrant as aK, type PollDeviceApprovalInput as aL, type DeviceApprovalPollResult as aM, type ConfirmDeviceEnrollmentInput as aN, type ConfirmDeviceEnrollmentResult as aO, type ApproveWithDeviceCodeInput as aP, type DeviceApprovalSettleResult as aQ, type CompleteDeviceApprovalInput as aR, type CompleteDeviceApprovalResult as aS, type CardSetupStatus as aT, type CurrencyBalance as aU, type DeviceApprovalChannel as aV, type DeviceApprovalEnrollment as aW, type DeviceApprovalFlow as aX, type DeviceApprovalPollStatus as aY, type DeviceEnrollmentDecision as aZ, type DeviceEnrollmentRespond as a_, type CreateCheckoutInput as aa, type CreateCheckoutResult as ab, type PurchaseInput as ac, type PurchaseResult as ad, type ConfirmPaymentResult as ae, type OrderDetailsResult as af, type SteamPacksQuery as ag, type SteamPacksResult as ah, type SteamInitPurchaseInput as ai, type SteamInitPurchaseResult as aj, type SteamFinalizeInput as ak, type SteamFinalizeResult as al, type PurchaseItemInput as am, type PurchaseItemResult as an, type ItemHistoryQuery as ao, type ItemHistoryResult as ap, type ItemOrderQuery as aq, type PlayerBalanceQuery as ar, type PlayerBalanceResult as as, type InboundPendingQuery as at, type InboundPendingResult as au, type LinkedIdentitiesQuery as av, type LinkedIdentitiesResult as aw, type SmsVerifyResult as ax, type ClaimTransferInput as ay, type ClaimResult as az, type ClientConfig as b, type FirstChargeStatus as b0, type FundingSource as b1, type InboundPendingItem as b2, type LinkedIdentityEmail as b3, type PlatformPurchaseStatus as b4, type RefundInitiation as b5, type RefundPendingApproval as b6, type RefundProcessingFeeBasis as b7, type RefundReceipt as b8, type RefundRevenueShareAttribution as b9, type RefundWarning as ba, type SandboxClockState as bb, type SavedCard as bc, type SteamPack as bd, type SteamUserSession as be, type Subscription as bf, type SubscriptionBaseInput as bg, type SubscriptionConsent as bh, type SubscriptionConsentInput as bi, type SubscriptionFundingRail as bj, type SubscriptionInterval as bk, type SubscriptionRevenueShare as bl, type SubscriptionRevenueShareInput as bm, type SubscriptionStatus as bn, isRefundPendingApproval as bo, type CallOptions 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 CardSetupSessionInput as p, type CardSetupSessionResult as q, type CardSetupInput as r, type CardSetupResult as s, type CardSetupConfirmInput as t, type CardSetupConfirmResult as u, type PlayerCardsResult as v, type PlatformPurchaseInput as w, type PlatformPurchaseResult as x, type PlatformOrderStatusResult as y, type PlatformRefundInput as z };
2482
+ export { type ListSubscriptionsOptions as $, type ApproveResult as A, type BalanceResult as B, type ConfirmReceiptResult as C, type DestinationsQuery as D, type EnrollmentBeginResult as E, type CardSetupInput as F, type CardSetupResult as G, Http as H, InvoError as I, type CardSetupConfirmInput as J, type CardSetupConfirmResult as K, type LinkDeviceResult as L, type MountCheckoutOptions as M, type PlayerCardsResult as N, type PlatformPurchaseInput as O, type PurchaseStatusResult as P, type PlatformPurchaseResult as Q, type RecoveryBeginResult as R, type PlatformOrderStatusResult as S, type PlatformRefundInput as T, type PlatformRefundResult as U, type VerificationMethod as V, type WaitForPurchaseInput as W, type CreateSubscriptionInput as X, type SubscriptionResult as Y, type GetSubscriptionOptions as Z, type GetSubscriptionResult as _, type PurchaseCredited as a, type CompleteDeviceApprovalInput as a$, type SubscriptionListResult as a0, type CancelSubscriptionOptions as a1, type CancelResult as a2, type ChangeAmountResult as a3, type SetPaymentMethodInput as a4, type SetPaymentMethodResult as a5, type RefundSubscriptionInput as a6, type RefundResult as a7, type SteamSubscriptionInitInput as a8, type SteamInitResult as a9, type ItemOrderQuery as aA, type PlayerBalanceQuery as aB, type PlayerBalanceResult as aC, type InboundPendingQuery as aD, type InboundPendingResult as aE, type LinkedIdentitiesQuery as aF, type LinkedIdentitiesResult as aG, type SmsVerifyResult as aH, type ClaimTransferInput as aI, type ClaimResult as aJ, type ClaimCurrencyInput as aK, type TransactionStatusResult as aL, type GuardianApprovalStatusResult as aM, type ServerDestinationsQuery as aN, type PhoneShareContact as aO, type PhoneShareInitiateResult as aP, type PhoneShareApproveInput as aQ, type PhoneShareApproveResult as aR, type PhoneShareStatusResult as aS, type BeginDeviceApprovalInput as aT, type DeviceApprovalGrant as aU, type PollDeviceApprovalInput as aV, type DeviceApprovalPollResult as aW, type ConfirmDeviceEnrollmentInput as aX, type ConfirmDeviceEnrollmentResult as aY, type ApproveWithDeviceCodeInput as aZ, type DeviceApprovalSettleResult as a_, type SteamFinalizeSubscriptionResult as aa, type SandboxClockResult as ab, type SandboxFailureOutcome as ac, type SandboxForceFailureOptions as ad, type SandboxForceAuthChallengeOptions as ae, type ServerConfig as af, type PlayerToken as ag, type InitiateSendInput as ah, type InitiateResult as ai, type InitiateTransferInput as aj, type CreateCheckoutInput as ak, type CreateCheckoutResult as al, type PurchaseInput as am, type PurchaseResult as an, type ConfirmPaymentResult as ao, type OrderDetailsResult as ap, type SteamPacksQuery as aq, type SteamPacksResult as ar, type SteamInitPurchaseInput as as, type SteamInitPurchaseResult as at, type SteamFinalizeInput as au, type SteamFinalizeResult as av, type PurchaseItemInput as aw, type PurchaseItemResult as ax, type ItemHistoryQuery as ay, type ItemHistoryResult as az, type PurchaseExpired as b, type CompleteDeviceApprovalResult as b0, type CardSetupStatus as b1, type CurrencyBalance as b2, type DeviceApprovalChannel as b3, type DeviceApprovalEnrollment as b4, type DeviceApprovalFlow as b5, type DeviceApprovalPollStatus as b6, type DeviceEnrollmentDecision as b7, type DeviceEnrollmentRespond as b8, type FirstCharge as b9, type FirstChargeStatus as ba, type FundingSource as bb, type InboundPendingItem as bc, type LinkedIdentityEmail as bd, type PlatformPurchaseStatus as be, type RefundInitiation as bf, type RefundPendingApproval as bg, type RefundProcessingFeeBasis as bh, type RefundReceipt as bi, type RefundRevenueShareAttribution as bj, type RefundWarning as bk, type SandboxClockState as bl, type SavedCard as bm, type SteamPack as bn, type SteamUserSession as bo, type Subscription as bp, type SubscriptionBaseInput as bq, type SubscriptionConsent as br, type SubscriptionConsentInput as bs, type SubscriptionFundingRail as bt, type SubscriptionInterval as bu, type SubscriptionRevenueShare as bv, type SubscriptionRevenueShareInput as bw, type SubscriptionStatus as bx, isRefundPendingApproval as by, type PurchaseRefunded as c, type PurchaseRefused as d, type CheckoutClientConfig as e, type PurchaseStatusInput as f, type CallOptions as g, type CheckoutMountHandle as h, type ClientConfig as i, type PendingCollectResult as j, type DestinationsResult as k, type EnrollmentVerifyResult as l, type RecoveryCompleteResult as m, type BalanceRow as n, type CheckoutPurchaseStatus as o, type DestinationGame as p, type InvoErrorInfo as q, type InvoHooks as r, type InvoRequestInfo as s, type InvoResponseInfo as t, type PendingCollectItem as u, type PurchaseRefusalReason as v, type Rail as w, type AuthHeader as x, type CardSetupSessionInput as y, type CardSetupSessionResult as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@invonetwork/web-sdk",
3
- "version": "3.10.1",
3
+ "version": "3.11.0",
4
4
  "description": "INVO Web SDK — currency purchase + passkey (WebAuthn) verification for partner web platforms.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "private": false,