@invonetwork/web-sdk 3.14.2 → 3.16.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/CHANGELOG.md +12 -0
- package/README.md +52 -14
- package/dist/{chunk-BLY4NUMG.js → chunk-JGDNPNQX.js} +49 -11
- package/dist/index.cjs +47 -9
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/server.cjs +83 -17
- package/dist/server.d.cts +20 -10
- package/dist/server.d.ts +20 -10
- package/dist/server.js +38 -10
- package/dist/{types-CD83iV3D.d.cts → types-CjJARoLk.d.cts} +73 -10
- package/dist/{types-CD83iV3D.d.ts → types-CjJARoLk.d.ts} +73 -10
- package/package.json +1 -1
package/dist/server.cjs
CHANGED
|
@@ -200,9 +200,19 @@ var InvoError = class _InvoError extends Error {
|
|
|
200
200
|
get isPhoneShareAlreadyApproved() {
|
|
201
201
|
return this.code === "PHONE_SHARE_ALREADY_APPROVED";
|
|
202
202
|
}
|
|
203
|
-
/** True if an idempotency-keyed request was a duplicate (item / platform purchase → 409).
|
|
203
|
+
/** True if an idempotency-keyed request was a duplicate (item / platform purchase → 409).
|
|
204
|
+
* Also true for {@link isDuplicateClientRequestId}. */
|
|
204
205
|
get isDuplicateRequest() {
|
|
205
|
-
return this.code === "DUPLICATE_REQUEST" || this.status === 409 && /duplicate/i.test(this.message);
|
|
206
|
+
return this.code === "DUPLICATE_REQUEST" || this.code === "DUPLICATE_CLIENT_REQUEST_ID" || this.status === 409 && /duplicate/i.test(this.message);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* True when a Platform Commerce CARD purchase reused a `clientRequestId` that already has a
|
|
210
|
+
* payment in progress or done (`DUPLICATE_CLIENT_REQUEST_ID`, 409). The body carries
|
|
211
|
+
* `order_id` and `order_status` for that order. Read it with `platformCommerce.getStatus`
|
|
212
|
+
* rather than starting a second payment.
|
|
213
|
+
*/
|
|
214
|
+
get isDuplicateClientRequestId() {
|
|
215
|
+
return this.code === "DUPLICATE_CLIENT_REQUEST_ID";
|
|
206
216
|
}
|
|
207
217
|
/**
|
|
208
218
|
* True if a Platform Commerce call was rejected because the tenant isn't a platform
|
|
@@ -213,8 +223,9 @@ var InvoError = class _InvoError extends Error {
|
|
|
213
223
|
get isNotPlatformTenant() {
|
|
214
224
|
return this.code === "NOT_A_PLATFORM_TENANT";
|
|
215
225
|
}
|
|
216
|
-
/** True if a Platform Commerce purchase was too small for the
|
|
217
|
-
* (`AMOUNT_BELOW_MINIMUM`, 400) — raise the amount.
|
|
226
|
+
/** True if a Platform Commerce purchase, or a `purchaseItem` spend, was too small for the
|
|
227
|
+
* fee to round above zero (`AMOUNT_BELOW_MINIMUM`, 400) — raise the amount. `purchaseItem`
|
|
228
|
+
* rounds `totalPrice` to cents before this check. */
|
|
218
229
|
get isAmountBelowMinimum() {
|
|
219
230
|
return this.code === "AMOUNT_BELOW_MINIMUM";
|
|
220
231
|
}
|
|
@@ -585,6 +596,15 @@ var InvoError = class _InvoError extends Error {
|
|
|
585
596
|
get isTrialAmountInvalid() {
|
|
586
597
|
return this.code === "TRIAL_AMOUNT_INVALID";
|
|
587
598
|
}
|
|
599
|
+
/**
|
|
600
|
+
* True when a paid trial's `trialAmountUsd` would leave you nothing after INVO's card fee
|
|
601
|
+
* (`TRIAL_AMOUNT_BELOW_FEE_FLOOR`, 400). Nothing was created. The message names the smallest
|
|
602
|
+
* trial price accepted for your account. A subscription already created is not affected: a
|
|
603
|
+
* replay of its `clientRequestId` answers as before.
|
|
604
|
+
*/
|
|
605
|
+
get isTrialAmountBelowFeeFloor() {
|
|
606
|
+
return this.code === "TRIAL_AMOUNT_BELOW_FEE_FLOOR";
|
|
607
|
+
}
|
|
588
608
|
/** True when `trialAmountUsd` was sent without `trialDays` or `trialEnd` (`TRIAL_AMOUNT_REQUIRES_TRIAL`, 400). */
|
|
589
609
|
get isTrialAmountRequiresTrial() {
|
|
590
610
|
return this.code === "TRIAL_AMOUNT_REQUIRES_TRIAL";
|
|
@@ -748,14 +768,23 @@ var InvoError = class _InvoError extends Error {
|
|
|
748
768
|
// ---- Card setup session (the INVO-hosted card page) ----
|
|
749
769
|
/**
|
|
750
770
|
* True when `cards.createSetupSession` was refused because the member does not exist
|
|
751
|
-
* in this game yet (`PLAYER_NOT_FOUND`, 404)
|
|
752
|
-
*
|
|
753
|
-
*
|
|
754
|
-
*
|
|
771
|
+
* in this game yet (`PLAYER_NOT_FOUND`, 404) and no `playerName` was sent. Send
|
|
772
|
+
* `playerName` (and optionally `playerPhone`) to create the member with their card.
|
|
773
|
+
* The same code comes back from `cards.beginSetup` and from `mintPlayerToken` for the
|
|
774
|
+
* same reason; those two never create players, so create the member first (for
|
|
775
|
+
* example with `createSetupSession` and a `playerName`, or a currency purchase).
|
|
755
776
|
*/
|
|
756
777
|
get isPlayerNotFound() {
|
|
757
778
|
return this.code === "PLAYER_NOT_FOUND";
|
|
758
779
|
}
|
|
780
|
+
/**
|
|
781
|
+
* True when `cards.createSetupSession` was asked to create a new member (`playerName`
|
|
782
|
+
* sent) and INVO could not create them (`PLAYER_CREATE_FAILED`, 503). Nothing was
|
|
783
|
+
* created and no link was minted; call again.
|
|
784
|
+
*/
|
|
785
|
+
get isPlayerCreateFailed() {
|
|
786
|
+
return this.code === "PLAYER_CREATE_FAILED";
|
|
787
|
+
}
|
|
759
788
|
/**
|
|
760
789
|
* True when `cards.createSetupSession` was refused because `playerEmail` was missing or
|
|
761
790
|
* is not an email address (`INVALID_PLAYER_EMAIL`, 400).
|
|
@@ -768,7 +797,8 @@ var InvoError = class _InvoError extends Error {
|
|
|
768
797
|
* `status === 0` is this SDK refusing a value before the network (every client-side
|
|
769
798
|
* guard uses this code); `status === 400` is INVO refusing one, on
|
|
770
799
|
* `cards.createSetupSession` a `successUrl` / `cancelUrl` that uses a script scheme
|
|
771
|
-
* (`javascript:`, `data:`, `vbscript
|
|
800
|
+
* (`javascript:`, `data:`, `vbscript:`; http(s) and app deep-link schemes are fine), or,
|
|
801
|
+
* when the member is new, a `playerName` over 255 characters or a `playerPhone` over 30.
|
|
772
802
|
*/
|
|
773
803
|
get isInvalidInput() {
|
|
774
804
|
return this.code === "INVALID_INPUT";
|
|
@@ -800,6 +830,14 @@ var InvoError = class _InvoError extends Error {
|
|
|
800
830
|
get isCheckoutSessionExpired() {
|
|
801
831
|
return this.code === "SESSION_EXPIRED";
|
|
802
832
|
}
|
|
833
|
+
/**
|
|
834
|
+
* True when a claim or a confirm-receipt could not be checked just now
|
|
835
|
+
* (`IDENTITY_CHECK_UNAVAILABLE`, 503). Nothing was moved. Retry after a few seconds. Distinct
|
|
836
|
+
* from `CONFIRMATION_SEND_FAILED`, which means a confirmation text could not be sent.
|
|
837
|
+
*/
|
|
838
|
+
get isIdentityCheckUnavailable() {
|
|
839
|
+
return this.code === "IDENTITY_CHECK_UNAVAILABLE";
|
|
840
|
+
}
|
|
803
841
|
/** Seconds to wait before retrying, when the backend throttled the call (429 `retry_after`). */
|
|
804
842
|
get retryAfter() {
|
|
805
843
|
const v = this.bodyObject()["retry_after"];
|
|
@@ -1100,7 +1138,7 @@ function receiptFields(raw) {
|
|
|
1100
1138
|
}
|
|
1101
1139
|
|
|
1102
1140
|
// src/version.ts
|
|
1103
|
-
var SDK_VERSION = "3.
|
|
1141
|
+
var SDK_VERSION = "3.16.0";
|
|
1104
1142
|
|
|
1105
1143
|
// src/shared/types.ts
|
|
1106
1144
|
function isRefundPendingApproval(r) {
|
|
@@ -1859,6 +1897,14 @@ function nullableString(v) {
|
|
|
1859
1897
|
function optionalString(r, key) {
|
|
1860
1898
|
return key in r ? nullableString(r[key]) : void 0;
|
|
1861
1899
|
}
|
|
1900
|
+
function toCheckoutWarnings(v) {
|
|
1901
|
+
if (!Array.isArray(v)) return void 0;
|
|
1902
|
+
return v.filter((w) => !!w && typeof w === "object").map((w) => {
|
|
1903
|
+
const out = { code: String(w["code"] ?? ""), message: String(w["message"] ?? "") };
|
|
1904
|
+
if (Array.isArray(w["fields"])) out.fields = w["fields"].map(String);
|
|
1905
|
+
return out;
|
|
1906
|
+
});
|
|
1907
|
+
}
|
|
1862
1908
|
function toRefundWarnings(v) {
|
|
1863
1909
|
if (!Array.isArray(v)) return void 0;
|
|
1864
1910
|
return v.filter((w) => !!w && typeof w === "object").map((w) => ({ code: String(w["code"] ?? ""), message: String(w["message"] ?? "") }));
|
|
@@ -2609,9 +2655,14 @@ var CardsServer = class {
|
|
|
2609
2655
|
* one, then `cards.list`) and one redirect. No browser code, no processor script, no
|
|
2610
2656
|
* client secret; INVO can change card processor without you changing anything.
|
|
2611
2657
|
*
|
|
2612
|
-
*
|
|
2613
|
-
*
|
|
2614
|
-
*
|
|
2658
|
+
* A member this game already knows needs only `playerEmail`. A BRAND-NEW member (a
|
|
2659
|
+
* first-time signup, for example before a paid trial) is created here when you also
|
|
2660
|
+
* send `playerName` (and optionally `playerPhone`), exactly as `subscriptions.create`
|
|
2661
|
+
* creates one: same phone-share gate, same wallet binding. Without `playerName` an
|
|
2662
|
+
* unknown member is `err.isPlayerNotFound` (404) and nothing is created. A known member
|
|
2663
|
+
* is never re-created or renamed by this call; `playerName` / `playerPhone` are used
|
|
2664
|
+
* only when the member is new. Send the member to `result.cardSetupUrl` top-level (do
|
|
2665
|
+
* not frame it). The page says in words that no money moves, saves the card, and then
|
|
2615
2666
|
* redirects to `successUrl` (or shows "Card saved" when you gave none). The saved card
|
|
2616
2667
|
* appears in {@link list} immediately, carries the off-session consent a subscription
|
|
2617
2668
|
* needs, and is indistinguishable from one saved any other way. There is no event for
|
|
@@ -2626,10 +2677,15 @@ var CardsServer = class {
|
|
|
2626
2677
|
*
|
|
2627
2678
|
* Refusals: `err.isInvalidPlayerEmail` (400, a non-email string; a missing or blank
|
|
2628
2679
|
* `playerEmail` is refused here first with `status: 0`), `err.isPlayerNotFound` (404),
|
|
2629
|
-
* `err.isInvalidInput` (400: a script-scheme `successUrl` / `cancelUrl
|
|
2630
|
-
*
|
|
2631
|
-
*
|
|
2632
|
-
*
|
|
2680
|
+
* `err.isInvalidInput` (400: a script-scheme `successUrl` / `cancelUrl`, or, when the
|
|
2681
|
+
* member is new, a `playerName` over 255 characters or a `playerPhone` over 30; the SDK
|
|
2682
|
+
* refuses script schemes, a blank or over-long `playerName` and a non-E.164
|
|
2683
|
+
* `playerPhone` first with `status: 0`), `err.isPhoneShareApprovalRequired` (409, creating the member needs the
|
|
2684
|
+
* existing phone owner's approval; same body as `subscriptions.create`),
|
|
2685
|
+
* `err.isPlayerCreateFailed` (503, the member could not be created; call again),
|
|
2686
|
+
* 401 / 403 on the key or the game (body `{ message }`, no code), 503 when card setup
|
|
2687
|
+
* is not available right now. Never auto-retried: each call mints a fresh link, so on a
|
|
2688
|
+
* timeout call it again.
|
|
2633
2689
|
*/
|
|
2634
2690
|
async createSetupSession(input, opts) {
|
|
2635
2691
|
if (typeof input.playerEmail !== "string" || !input.playerEmail.trim()) {
|
|
@@ -2646,7 +2702,16 @@ var CardsServer = class {
|
|
|
2646
2702
|
if (input.metadata !== void 0 && (input.metadata === null || typeof input.metadata !== "object" || Array.isArray(input.metadata))) {
|
|
2647
2703
|
throw invalidInput("metadata", input.metadata, "must be a plain object");
|
|
2648
2704
|
}
|
|
2705
|
+
if (input.playerName !== void 0) {
|
|
2706
|
+
if (typeof input.playerName !== "string" || !input.playerName.trim()) {
|
|
2707
|
+
throw invalidInput("playerName", input.playerName, "must be a non-empty string");
|
|
2708
|
+
}
|
|
2709
|
+
if (input.playerName.trim().length > 255) throw invalidInput("playerName", input.playerName, "must be at most 255 characters");
|
|
2710
|
+
}
|
|
2711
|
+
if (input.playerPhone !== void 0) assertE164(input.playerPhone, "playerPhone");
|
|
2649
2712
|
const body = { player_email: input.playerEmail };
|
|
2713
|
+
if (input.playerName) body["player_name"] = input.playerName;
|
|
2714
|
+
if (input.playerPhone) body["player_phone"] = input.playerPhone;
|
|
2650
2715
|
if (input.successUrl) body["success_url"] = input.successUrl;
|
|
2651
2716
|
if (input.cancelUrl) body["cancel_url"] = input.cancelUrl;
|
|
2652
2717
|
if (input.metadata) body["metadata"] = input.metadata;
|
|
@@ -2988,6 +3053,7 @@ var InvoServer = class {
|
|
|
2988
3053
|
// for a backend older than commit 856fa266. Either way a server that wants to read
|
|
2989
3054
|
// the purchase status later does not have to parse a URL itself.
|
|
2990
3055
|
sessionToken: sessionTokenFromCreateCheckout(raw, checkoutUrl),
|
|
3056
|
+
warnings: toCheckoutWarnings(raw["warnings"]),
|
|
2991
3057
|
raw
|
|
2992
3058
|
};
|
|
2993
3059
|
}
|
package/dist/server.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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 CurrencyPurchaseQuoteInput, ap as CurrencyPurchaseQuote, aq as ConfirmPaymentResult, ar as OrderDetailsResult, as as SteamPacksQuery, at as SteamPacksResult, au as SteamInitPurchaseInput, av as SteamInitPurchaseResult, aw as SteamFinalizeInput, ax as SteamFinalizeResult, ay as PurchaseItemInput, az as PurchaseItemResult, aA as ItemHistoryQuery, aB as ItemHistoryResult, aC as ItemOrderQuery, aD as PlayerBalanceQuery, aE as PlayerBalanceResult, aF as InboundPendingQuery, aG as InboundPendingResult, aH as LinkedIdentitiesQuery, aI as LinkedIdentitiesResult, aJ as SmsVerifyResult, aK as ClaimTransferInput, aL as ClaimResult, aM as ClaimCurrencyInput, aN as TransactionStatusResult, aO as GuardianApprovalStatusResult, aP as ServerDestinationsQuery, k as DestinationsResult, aQ as PhoneShareContact, aR as PhoneShareInitiateResult, aS as PhoneShareApproveInput, aT as PhoneShareApproveResult, aU as PhoneShareStatusResult, aV as BeginDeviceApprovalInput, aW as DeviceApprovalGrant, aX as PollDeviceApprovalInput, aY as DeviceApprovalPollResult, aZ as ConfirmDeviceEnrollmentInput, a_ as ConfirmDeviceEnrollmentResult, a$ as ApproveWithDeviceCodeInput, b0 as DeviceApprovalSettleResult, b1 as CompleteDeviceApprovalInput, b2 as CompleteDeviceApprovalResult } from './types-
|
|
2
|
-
export { b3 as CardSetupStatus, b4 as
|
|
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 CurrencyPurchaseQuoteInput, ap as CurrencyPurchaseQuote, aq as ConfirmPaymentResult, ar as OrderDetailsResult, as as SteamPacksQuery, at as SteamPacksResult, au as SteamInitPurchaseInput, av as SteamInitPurchaseResult, aw as SteamFinalizeInput, ax as SteamFinalizeResult, ay as PurchaseItemInput, az as PurchaseItemResult, aA as ItemHistoryQuery, aB as ItemHistoryResult, aC as ItemOrderQuery, aD as PlayerBalanceQuery, aE as PlayerBalanceResult, aF as InboundPendingQuery, aG as InboundPendingResult, aH as LinkedIdentitiesQuery, aI as LinkedIdentitiesResult, aJ as SmsVerifyResult, aK as ClaimTransferInput, aL as ClaimResult, aM as ClaimCurrencyInput, aN as TransactionStatusResult, aO as GuardianApprovalStatusResult, aP as ServerDestinationsQuery, k as DestinationsResult, aQ as PhoneShareContact, aR as PhoneShareInitiateResult, aS as PhoneShareApproveInput, aT as PhoneShareApproveResult, aU as PhoneShareStatusResult, aV as BeginDeviceApprovalInput, aW as DeviceApprovalGrant, aX as PollDeviceApprovalInput, aY as DeviceApprovalPollResult, aZ as ConfirmDeviceEnrollmentInput, a_ as ConfirmDeviceEnrollmentResult, a$ as ApproveWithDeviceCodeInput, b0 as DeviceApprovalSettleResult, b1 as CompleteDeviceApprovalInput, b2 as CompleteDeviceApprovalResult } from './types-CjJARoLk.cjs';
|
|
2
|
+
export { b3 as CardSetupStatus, b4 as CheckoutWarning, b5 as CurrencyBalance, b6 as CurrencyPurchaseQuoteBreakdown, p as DestinationGame, b7 as DeviceApprovalChannel, b8 as DeviceApprovalEnrollment, b9 as DeviceApprovalFlow, ba as DeviceApprovalPollStatus, bb as DeviceEnrollmentDecision, bc as DeviceEnrollmentRespond, bd as FeeTakenFrom, be as FirstCharge, bf as FirstChargeStatus, bg as FundingSource, bh as InboundPendingItem, q as InvoErrorInfo, r as InvoHooks, s as InvoRequestInfo, t as InvoResponseInfo, bi as LinkedIdentityEmail, bj as PlatformPurchaseStatus, w as Rail, bk as RefundInitiation, bl as RefundPendingApproval, bm as RefundProcessingFeeBasis, bn as RefundReceipt, bo as RefundRevenueShareAttribution, bp as RefundWarning, bq as SandboxClockState, br as SavedCard, bs as SteamPack, bt as SteamUserSession, bu as Subscription, bv as SubscriptionBaseInput, bw as SubscriptionConsent, bx as SubscriptionConsentInput, by as SubscriptionFundingRail, bz as SubscriptionInterval, bA as SubscriptionRevenueShare, bB as SubscriptionRevenueShareInput, bC as SubscriptionStatus, bD as UnacknowledgedPurchaseOutcome, V as VerificationMethod, bE as isRefundPendingApproval } from './types-CjJARoLk.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.
|
|
9
|
+
declare const SDK_VERSION = "3.16.0";
|
|
10
10
|
|
|
11
11
|
interface VerifyWebhookOptions {
|
|
12
12
|
/** Max age of the signed timestamp, in seconds. Default 300 (5 min). */
|
|
@@ -884,9 +884,14 @@ declare class CardsServer {
|
|
|
884
884
|
* one, then `cards.list`) and one redirect. No browser code, no processor script, no
|
|
885
885
|
* client secret; INVO can change card processor without you changing anything.
|
|
886
886
|
*
|
|
887
|
-
*
|
|
888
|
-
*
|
|
889
|
-
*
|
|
887
|
+
* A member this game already knows needs only `playerEmail`. A BRAND-NEW member (a
|
|
888
|
+
* first-time signup, for example before a paid trial) is created here when you also
|
|
889
|
+
* send `playerName` (and optionally `playerPhone`), exactly as `subscriptions.create`
|
|
890
|
+
* creates one: same phone-share gate, same wallet binding. Without `playerName` an
|
|
891
|
+
* unknown member is `err.isPlayerNotFound` (404) and nothing is created. A known member
|
|
892
|
+
* is never re-created or renamed by this call; `playerName` / `playerPhone` are used
|
|
893
|
+
* only when the member is new. Send the member to `result.cardSetupUrl` top-level (do
|
|
894
|
+
* not frame it). The page says in words that no money moves, saves the card, and then
|
|
890
895
|
* redirects to `successUrl` (or shows "Card saved" when you gave none). The saved card
|
|
891
896
|
* appears in {@link list} immediately, carries the off-session consent a subscription
|
|
892
897
|
* needs, and is indistinguishable from one saved any other way. There is no event for
|
|
@@ -901,10 +906,15 @@ declare class CardsServer {
|
|
|
901
906
|
*
|
|
902
907
|
* Refusals: `err.isInvalidPlayerEmail` (400, a non-email string; a missing or blank
|
|
903
908
|
* `playerEmail` is refused here first with `status: 0`), `err.isPlayerNotFound` (404),
|
|
904
|
-
* `err.isInvalidInput` (400: a script-scheme `successUrl` / `cancelUrl
|
|
905
|
-
*
|
|
906
|
-
*
|
|
907
|
-
*
|
|
909
|
+
* `err.isInvalidInput` (400: a script-scheme `successUrl` / `cancelUrl`, or, when the
|
|
910
|
+
* member is new, a `playerName` over 255 characters or a `playerPhone` over 30; the SDK
|
|
911
|
+
* refuses script schemes, a blank or over-long `playerName` and a non-E.164
|
|
912
|
+
* `playerPhone` first with `status: 0`), `err.isPhoneShareApprovalRequired` (409, creating the member needs the
|
|
913
|
+
* existing phone owner's approval; same body as `subscriptions.create`),
|
|
914
|
+
* `err.isPlayerCreateFailed` (503, the member could not be created; call again),
|
|
915
|
+
* 401 / 403 on the key or the game (body `{ message }`, no code), 503 when card setup
|
|
916
|
+
* is not available right now. Never auto-retried: each call mints a fresh link, so on a
|
|
917
|
+
* timeout call it again.
|
|
908
918
|
*/
|
|
909
919
|
createSetupSession(input: CardSetupSessionInput, opts?: CallOptions): Promise<CardSetupSessionResult>;
|
|
910
920
|
/**
|
package/dist/server.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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 CurrencyPurchaseQuoteInput, ap as CurrencyPurchaseQuote, aq as ConfirmPaymentResult, ar as OrderDetailsResult, as as SteamPacksQuery, at as SteamPacksResult, au as SteamInitPurchaseInput, av as SteamInitPurchaseResult, aw as SteamFinalizeInput, ax as SteamFinalizeResult, ay as PurchaseItemInput, az as PurchaseItemResult, aA as ItemHistoryQuery, aB as ItemHistoryResult, aC as ItemOrderQuery, aD as PlayerBalanceQuery, aE as PlayerBalanceResult, aF as InboundPendingQuery, aG as InboundPendingResult, aH as LinkedIdentitiesQuery, aI as LinkedIdentitiesResult, aJ as SmsVerifyResult, aK as ClaimTransferInput, aL as ClaimResult, aM as ClaimCurrencyInput, aN as TransactionStatusResult, aO as GuardianApprovalStatusResult, aP as ServerDestinationsQuery, k as DestinationsResult, aQ as PhoneShareContact, aR as PhoneShareInitiateResult, aS as PhoneShareApproveInput, aT as PhoneShareApproveResult, aU as PhoneShareStatusResult, aV as BeginDeviceApprovalInput, aW as DeviceApprovalGrant, aX as PollDeviceApprovalInput, aY as DeviceApprovalPollResult, aZ as ConfirmDeviceEnrollmentInput, a_ as ConfirmDeviceEnrollmentResult, a$ as ApproveWithDeviceCodeInput, b0 as DeviceApprovalSettleResult, b1 as CompleteDeviceApprovalInput, b2 as CompleteDeviceApprovalResult } from './types-
|
|
2
|
-
export { b3 as CardSetupStatus, b4 as
|
|
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 CurrencyPurchaseQuoteInput, ap as CurrencyPurchaseQuote, aq as ConfirmPaymentResult, ar as OrderDetailsResult, as as SteamPacksQuery, at as SteamPacksResult, au as SteamInitPurchaseInput, av as SteamInitPurchaseResult, aw as SteamFinalizeInput, ax as SteamFinalizeResult, ay as PurchaseItemInput, az as PurchaseItemResult, aA as ItemHistoryQuery, aB as ItemHistoryResult, aC as ItemOrderQuery, aD as PlayerBalanceQuery, aE as PlayerBalanceResult, aF as InboundPendingQuery, aG as InboundPendingResult, aH as LinkedIdentitiesQuery, aI as LinkedIdentitiesResult, aJ as SmsVerifyResult, aK as ClaimTransferInput, aL as ClaimResult, aM as ClaimCurrencyInput, aN as TransactionStatusResult, aO as GuardianApprovalStatusResult, aP as ServerDestinationsQuery, k as DestinationsResult, aQ as PhoneShareContact, aR as PhoneShareInitiateResult, aS as PhoneShareApproveInput, aT as PhoneShareApproveResult, aU as PhoneShareStatusResult, aV as BeginDeviceApprovalInput, aW as DeviceApprovalGrant, aX as PollDeviceApprovalInput, aY as DeviceApprovalPollResult, aZ as ConfirmDeviceEnrollmentInput, a_ as ConfirmDeviceEnrollmentResult, a$ as ApproveWithDeviceCodeInput, b0 as DeviceApprovalSettleResult, b1 as CompleteDeviceApprovalInput, b2 as CompleteDeviceApprovalResult } from './types-CjJARoLk.js';
|
|
2
|
+
export { b3 as CardSetupStatus, b4 as CheckoutWarning, b5 as CurrencyBalance, b6 as CurrencyPurchaseQuoteBreakdown, p as DestinationGame, b7 as DeviceApprovalChannel, b8 as DeviceApprovalEnrollment, b9 as DeviceApprovalFlow, ba as DeviceApprovalPollStatus, bb as DeviceEnrollmentDecision, bc as DeviceEnrollmentRespond, bd as FeeTakenFrom, be as FirstCharge, bf as FirstChargeStatus, bg as FundingSource, bh as InboundPendingItem, q as InvoErrorInfo, r as InvoHooks, s as InvoRequestInfo, t as InvoResponseInfo, bi as LinkedIdentityEmail, bj as PlatformPurchaseStatus, w as Rail, bk as RefundInitiation, bl as RefundPendingApproval, bm as RefundProcessingFeeBasis, bn as RefundReceipt, bo as RefundRevenueShareAttribution, bp as RefundWarning, bq as SandboxClockState, br as SavedCard, bs as SteamPack, bt as SteamUserSession, bu as Subscription, bv as SubscriptionBaseInput, bw as SubscriptionConsent, bx as SubscriptionConsentInput, by as SubscriptionFundingRail, bz as SubscriptionInterval, bA as SubscriptionRevenueShare, bB as SubscriptionRevenueShareInput, bC as SubscriptionStatus, bD as UnacknowledgedPurchaseOutcome, V as VerificationMethod, bE as isRefundPendingApproval } from './types-CjJARoLk.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.
|
|
9
|
+
declare const SDK_VERSION = "3.16.0";
|
|
10
10
|
|
|
11
11
|
interface VerifyWebhookOptions {
|
|
12
12
|
/** Max age of the signed timestamp, in seconds. Default 300 (5 min). */
|
|
@@ -884,9 +884,14 @@ declare class CardsServer {
|
|
|
884
884
|
* one, then `cards.list`) and one redirect. No browser code, no processor script, no
|
|
885
885
|
* client secret; INVO can change card processor without you changing anything.
|
|
886
886
|
*
|
|
887
|
-
*
|
|
888
|
-
*
|
|
889
|
-
*
|
|
887
|
+
* A member this game already knows needs only `playerEmail`. A BRAND-NEW member (a
|
|
888
|
+
* first-time signup, for example before a paid trial) is created here when you also
|
|
889
|
+
* send `playerName` (and optionally `playerPhone`), exactly as `subscriptions.create`
|
|
890
|
+
* creates one: same phone-share gate, same wallet binding. Without `playerName` an
|
|
891
|
+
* unknown member is `err.isPlayerNotFound` (404) and nothing is created. A known member
|
|
892
|
+
* is never re-created or renamed by this call; `playerName` / `playerPhone` are used
|
|
893
|
+
* only when the member is new. Send the member to `result.cardSetupUrl` top-level (do
|
|
894
|
+
* not frame it). The page says in words that no money moves, saves the card, and then
|
|
890
895
|
* redirects to `successUrl` (or shows "Card saved" when you gave none). The saved card
|
|
891
896
|
* appears in {@link list} immediately, carries the off-session consent a subscription
|
|
892
897
|
* needs, and is indistinguishable from one saved any other way. There is no event for
|
|
@@ -901,10 +906,15 @@ declare class CardsServer {
|
|
|
901
906
|
*
|
|
902
907
|
* Refusals: `err.isInvalidPlayerEmail` (400, a non-email string; a missing or blank
|
|
903
908
|
* `playerEmail` is refused here first with `status: 0`), `err.isPlayerNotFound` (404),
|
|
904
|
-
* `err.isInvalidInput` (400: a script-scheme `successUrl` / `cancelUrl
|
|
905
|
-
*
|
|
906
|
-
*
|
|
907
|
-
*
|
|
909
|
+
* `err.isInvalidInput` (400: a script-scheme `successUrl` / `cancelUrl`, or, when the
|
|
910
|
+
* member is new, a `playerName` over 255 characters or a `playerPhone` over 30; the SDK
|
|
911
|
+
* refuses script schemes, a blank or over-long `playerName` and a non-E.164
|
|
912
|
+
* `playerPhone` first with `status: 0`), `err.isPhoneShareApprovalRequired` (409, creating the member needs the
|
|
913
|
+
* existing phone owner's approval; same body as `subscriptions.create`),
|
|
914
|
+
* `err.isPlayerCreateFailed` (503, the member could not be created; call again),
|
|
915
|
+
* 401 / 403 on the key or the game (body `{ message }`, no code), 503 when card setup
|
|
916
|
+
* is not available right now. Never auto-retried: each call mints a fresh link, so on a
|
|
917
|
+
* timeout call it again.
|
|
908
918
|
*/
|
|
909
919
|
createSetupSession(input: CardSetupSessionInput, opts?: CallOptions): Promise<CardSetupSessionResult>;
|
|
910
920
|
/**
|
package/dist/server.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { InvoError, receiptFields, assertSecureBaseUrl, Http, creditFields, toDestinationsResult } from './chunk-
|
|
2
|
-
export { InvoError } from './chunk-
|
|
1
|
+
import { InvoError, receiptFields, assertSecureBaseUrl, Http, creditFields, toDestinationsResult } from './chunk-JGDNPNQX.js';
|
|
2
|
+
export { InvoError } from './chunk-JGDNPNQX.js';
|
|
3
3
|
import { createHmac, timingSafeEqual } from 'crypto';
|
|
4
4
|
|
|
5
5
|
// src/version.ts
|
|
6
|
-
var SDK_VERSION = "3.
|
|
6
|
+
var SDK_VERSION = "3.16.0";
|
|
7
7
|
|
|
8
8
|
// src/shared/types.ts
|
|
9
9
|
function isRefundPendingApproval(r) {
|
|
@@ -762,6 +762,14 @@ function nullableString(v) {
|
|
|
762
762
|
function optionalString(r, key) {
|
|
763
763
|
return key in r ? nullableString(r[key]) : void 0;
|
|
764
764
|
}
|
|
765
|
+
function toCheckoutWarnings(v) {
|
|
766
|
+
if (!Array.isArray(v)) return void 0;
|
|
767
|
+
return v.filter((w) => !!w && typeof w === "object").map((w) => {
|
|
768
|
+
const out = { code: String(w["code"] ?? ""), message: String(w["message"] ?? "") };
|
|
769
|
+
if (Array.isArray(w["fields"])) out.fields = w["fields"].map(String);
|
|
770
|
+
return out;
|
|
771
|
+
});
|
|
772
|
+
}
|
|
765
773
|
function toRefundWarnings(v) {
|
|
766
774
|
if (!Array.isArray(v)) return void 0;
|
|
767
775
|
return v.filter((w) => !!w && typeof w === "object").map((w) => ({ code: String(w["code"] ?? ""), message: String(w["message"] ?? "") }));
|
|
@@ -1512,9 +1520,14 @@ var CardsServer = class {
|
|
|
1512
1520
|
* one, then `cards.list`) and one redirect. No browser code, no processor script, no
|
|
1513
1521
|
* client secret; INVO can change card processor without you changing anything.
|
|
1514
1522
|
*
|
|
1515
|
-
*
|
|
1516
|
-
*
|
|
1517
|
-
*
|
|
1523
|
+
* A member this game already knows needs only `playerEmail`. A BRAND-NEW member (a
|
|
1524
|
+
* first-time signup, for example before a paid trial) is created here when you also
|
|
1525
|
+
* send `playerName` (and optionally `playerPhone`), exactly as `subscriptions.create`
|
|
1526
|
+
* creates one: same phone-share gate, same wallet binding. Without `playerName` an
|
|
1527
|
+
* unknown member is `err.isPlayerNotFound` (404) and nothing is created. A known member
|
|
1528
|
+
* is never re-created or renamed by this call; `playerName` / `playerPhone` are used
|
|
1529
|
+
* only when the member is new. Send the member to `result.cardSetupUrl` top-level (do
|
|
1530
|
+
* not frame it). The page says in words that no money moves, saves the card, and then
|
|
1518
1531
|
* redirects to `successUrl` (or shows "Card saved" when you gave none). The saved card
|
|
1519
1532
|
* appears in {@link list} immediately, carries the off-session consent a subscription
|
|
1520
1533
|
* needs, and is indistinguishable from one saved any other way. There is no event for
|
|
@@ -1529,10 +1542,15 @@ var CardsServer = class {
|
|
|
1529
1542
|
*
|
|
1530
1543
|
* Refusals: `err.isInvalidPlayerEmail` (400, a non-email string; a missing or blank
|
|
1531
1544
|
* `playerEmail` is refused here first with `status: 0`), `err.isPlayerNotFound` (404),
|
|
1532
|
-
* `err.isInvalidInput` (400: a script-scheme `successUrl` / `cancelUrl
|
|
1533
|
-
*
|
|
1534
|
-
*
|
|
1535
|
-
*
|
|
1545
|
+
* `err.isInvalidInput` (400: a script-scheme `successUrl` / `cancelUrl`, or, when the
|
|
1546
|
+
* member is new, a `playerName` over 255 characters or a `playerPhone` over 30; the SDK
|
|
1547
|
+
* refuses script schemes, a blank or over-long `playerName` and a non-E.164
|
|
1548
|
+
* `playerPhone` first with `status: 0`), `err.isPhoneShareApprovalRequired` (409, creating the member needs the
|
|
1549
|
+
* existing phone owner's approval; same body as `subscriptions.create`),
|
|
1550
|
+
* `err.isPlayerCreateFailed` (503, the member could not be created; call again),
|
|
1551
|
+
* 401 / 403 on the key or the game (body `{ message }`, no code), 503 when card setup
|
|
1552
|
+
* is not available right now. Never auto-retried: each call mints a fresh link, so on a
|
|
1553
|
+
* timeout call it again.
|
|
1536
1554
|
*/
|
|
1537
1555
|
async createSetupSession(input, opts) {
|
|
1538
1556
|
if (typeof input.playerEmail !== "string" || !input.playerEmail.trim()) {
|
|
@@ -1549,7 +1567,16 @@ var CardsServer = class {
|
|
|
1549
1567
|
if (input.metadata !== void 0 && (input.metadata === null || typeof input.metadata !== "object" || Array.isArray(input.metadata))) {
|
|
1550
1568
|
throw invalidInput("metadata", input.metadata, "must be a plain object");
|
|
1551
1569
|
}
|
|
1570
|
+
if (input.playerName !== void 0) {
|
|
1571
|
+
if (typeof input.playerName !== "string" || !input.playerName.trim()) {
|
|
1572
|
+
throw invalidInput("playerName", input.playerName, "must be a non-empty string");
|
|
1573
|
+
}
|
|
1574
|
+
if (input.playerName.trim().length > 255) throw invalidInput("playerName", input.playerName, "must be at most 255 characters");
|
|
1575
|
+
}
|
|
1576
|
+
if (input.playerPhone !== void 0) assertE164(input.playerPhone, "playerPhone");
|
|
1552
1577
|
const body = { player_email: input.playerEmail };
|
|
1578
|
+
if (input.playerName) body["player_name"] = input.playerName;
|
|
1579
|
+
if (input.playerPhone) body["player_phone"] = input.playerPhone;
|
|
1553
1580
|
if (input.successUrl) body["success_url"] = input.successUrl;
|
|
1554
1581
|
if (input.cancelUrl) body["cancel_url"] = input.cancelUrl;
|
|
1555
1582
|
if (input.metadata) body["metadata"] = input.metadata;
|
|
@@ -1891,6 +1918,7 @@ var InvoServer = class {
|
|
|
1891
1918
|
// for a backend older than commit 856fa266. Either way a server that wants to read
|
|
1892
1919
|
// the purchase status later does not have to parse a URL itself.
|
|
1893
1920
|
sessionToken: sessionTokenFromCreateCheckout(raw, checkoutUrl),
|
|
1921
|
+
warnings: toCheckoutWarnings(raw["warnings"]),
|
|
1894
1922
|
raw
|
|
1895
1923
|
};
|
|
1896
1924
|
}
|
|
@@ -164,8 +164,16 @@ declare class InvoError extends Error {
|
|
|
164
164
|
get isWebauthnNotEnabledForTenant(): boolean;
|
|
165
165
|
/** True if the phone-share (phone, requesting_email) pair was already approved. */
|
|
166
166
|
get isPhoneShareAlreadyApproved(): boolean;
|
|
167
|
-
/** True if an idempotency-keyed request was a duplicate (item / platform purchase → 409).
|
|
167
|
+
/** True if an idempotency-keyed request was a duplicate (item / platform purchase → 409).
|
|
168
|
+
* Also true for {@link isDuplicateClientRequestId}. */
|
|
168
169
|
get isDuplicateRequest(): boolean;
|
|
170
|
+
/**
|
|
171
|
+
* True when a Platform Commerce CARD purchase reused a `clientRequestId` that already has a
|
|
172
|
+
* payment in progress or done (`DUPLICATE_CLIENT_REQUEST_ID`, 409). The body carries
|
|
173
|
+
* `order_id` and `order_status` for that order. Read it with `platformCommerce.getStatus`
|
|
174
|
+
* rather than starting a second payment.
|
|
175
|
+
*/
|
|
176
|
+
get isDuplicateClientRequestId(): boolean;
|
|
169
177
|
/**
|
|
170
178
|
* True if a Platform Commerce call was rejected because the tenant isn't a platform
|
|
171
179
|
* tenant (`NOT_A_PLATFORM_TENANT`, 403). Platform Commerce (`invo.platformCommerce.*`)
|
|
@@ -173,8 +181,9 @@ declare class InvoError extends Error {
|
|
|
173
181
|
* (spend game currency) or `createCheckout`/`purchaseCurrency` (buy currency) instead.
|
|
174
182
|
*/
|
|
175
183
|
get isNotPlatformTenant(): boolean;
|
|
176
|
-
/** True if a Platform Commerce purchase was too small for the
|
|
177
|
-
* (`AMOUNT_BELOW_MINIMUM`, 400) — raise the amount.
|
|
184
|
+
/** True if a Platform Commerce purchase, or a `purchaseItem` spend, was too small for the
|
|
185
|
+
* fee to round above zero (`AMOUNT_BELOW_MINIMUM`, 400) — raise the amount. `purchaseItem`
|
|
186
|
+
* rounds `totalPrice` to cents before this check. */
|
|
178
187
|
get isAmountBelowMinimum(): boolean;
|
|
179
188
|
/**
|
|
180
189
|
* True if the `rail` you sent disagrees with the storefront key you
|
|
@@ -449,6 +458,13 @@ declare class InvoError extends Error {
|
|
|
449
458
|
* message names the rule.
|
|
450
459
|
*/
|
|
451
460
|
get isTrialAmountInvalid(): boolean;
|
|
461
|
+
/**
|
|
462
|
+
* True when a paid trial's `trialAmountUsd` would leave you nothing after INVO's card fee
|
|
463
|
+
* (`TRIAL_AMOUNT_BELOW_FEE_FLOOR`, 400). Nothing was created. The message names the smallest
|
|
464
|
+
* trial price accepted for your account. A subscription already created is not affected: a
|
|
465
|
+
* replay of its `clientRequestId` answers as before.
|
|
466
|
+
*/
|
|
467
|
+
get isTrialAmountBelowFeeFloor(): boolean;
|
|
452
468
|
/** True when `trialAmountUsd` was sent without `trialDays` or `trialEnd` (`TRIAL_AMOUNT_REQUIRES_TRIAL`, 400). */
|
|
453
469
|
get isTrialAmountRequiresTrial(): boolean;
|
|
454
470
|
/**
|
|
@@ -560,12 +576,19 @@ declare class InvoError extends Error {
|
|
|
560
576
|
get isGameNotLive(): boolean;
|
|
561
577
|
/**
|
|
562
578
|
* True when `cards.createSetupSession` was refused because the member does not exist
|
|
563
|
-
* in this game yet (`PLAYER_NOT_FOUND`, 404)
|
|
564
|
-
*
|
|
565
|
-
*
|
|
566
|
-
*
|
|
579
|
+
* in this game yet (`PLAYER_NOT_FOUND`, 404) and no `playerName` was sent. Send
|
|
580
|
+
* `playerName` (and optionally `playerPhone`) to create the member with their card.
|
|
581
|
+
* The same code comes back from `cards.beginSetup` and from `mintPlayerToken` for the
|
|
582
|
+
* same reason; those two never create players, so create the member first (for
|
|
583
|
+
* example with `createSetupSession` and a `playerName`, or a currency purchase).
|
|
567
584
|
*/
|
|
568
585
|
get isPlayerNotFound(): boolean;
|
|
586
|
+
/**
|
|
587
|
+
* True when `cards.createSetupSession` was asked to create a new member (`playerName`
|
|
588
|
+
* sent) and INVO could not create them (`PLAYER_CREATE_FAILED`, 503). Nothing was
|
|
589
|
+
* created and no link was minted; call again.
|
|
590
|
+
*/
|
|
591
|
+
get isPlayerCreateFailed(): boolean;
|
|
569
592
|
/**
|
|
570
593
|
* True when `cards.createSetupSession` was refused because `playerEmail` was missing or
|
|
571
594
|
* is not an email address (`INVALID_PLAYER_EMAIL`, 400).
|
|
@@ -576,7 +599,8 @@ declare class InvoError extends Error {
|
|
|
576
599
|
* `status === 0` is this SDK refusing a value before the network (every client-side
|
|
577
600
|
* guard uses this code); `status === 400` is INVO refusing one, on
|
|
578
601
|
* `cards.createSetupSession` a `successUrl` / `cancelUrl` that uses a script scheme
|
|
579
|
-
* (`javascript:`, `data:`, `vbscript
|
|
602
|
+
* (`javascript:`, `data:`, `vbscript:`; http(s) and app deep-link schemes are fine), or,
|
|
603
|
+
* when the member is new, a `playerName` over 255 characters or a `playerPhone` over 30.
|
|
580
604
|
*/
|
|
581
605
|
get isInvalidInput(): boolean;
|
|
582
606
|
/**
|
|
@@ -599,6 +623,12 @@ declare class InvoError extends Error {
|
|
|
599
623
|
* order id you already hold and a Contact support link rather than a blank screen.
|
|
600
624
|
*/
|
|
601
625
|
get isCheckoutSessionExpired(): boolean;
|
|
626
|
+
/**
|
|
627
|
+
* True when a claim or a confirm-receipt could not be checked just now
|
|
628
|
+
* (`IDENTITY_CHECK_UNAVAILABLE`, 503). Nothing was moved. Retry after a few seconds. Distinct
|
|
629
|
+
* from `CONFIRMATION_SEND_FAILED`, which means a confirmation text could not be sent.
|
|
630
|
+
*/
|
|
631
|
+
get isIdentityCheckUnavailable(): boolean;
|
|
602
632
|
/** Seconds to wait before retrying, when the backend throttled the call (429 `retry_after`). */
|
|
603
633
|
get retryAfter(): number | undefined;
|
|
604
634
|
/** `body` as a plain object, or `{}` if it's a string/number/null (non-JSON responses).
|
|
@@ -824,8 +854,23 @@ interface CreateCheckoutResult {
|
|
|
824
854
|
* only to the buyer whose purchase it is.
|
|
825
855
|
*/
|
|
826
856
|
sessionToken?: string;
|
|
857
|
+
/**
|
|
858
|
+
* Non-fatal notes on the mint, when INVO has any. Absent otherwise. Today the one code is
|
|
859
|
+
* `ITEM_METADATA_ON_CURRENCY_SESSION`: `metadata` carried `item_id` / `item_name`, but a
|
|
860
|
+
* checkout session sells game currency, so the buyer receives coins and the metadata is only
|
|
861
|
+
* echoed back. To sell an item, use `platformCommerce.purchase`
|
|
862
|
+
* (`POST /api/platform-commerce/purchase`). Treat unknown codes as informational.
|
|
863
|
+
*/
|
|
864
|
+
warnings?: CheckoutWarning[];
|
|
827
865
|
raw: Record<string, unknown>;
|
|
828
866
|
}
|
|
867
|
+
/** A non-fatal note on a checkout session mint (see {@link CreateCheckoutResult.warnings}). */
|
|
868
|
+
interface CheckoutWarning {
|
|
869
|
+
code: string;
|
|
870
|
+
message: string;
|
|
871
|
+
/** The request fields the note is about, e.g. `["item_id"]`. */
|
|
872
|
+
fields?: string[];
|
|
873
|
+
}
|
|
829
874
|
interface PurchaseInput {
|
|
830
875
|
playerEmail: string;
|
|
831
876
|
/**
|
|
@@ -2576,8 +2621,26 @@ interface PlayerCardsResult {
|
|
|
2576
2621
|
}
|
|
2577
2622
|
/** Input for `cards.createSetupSession`. */
|
|
2578
2623
|
interface CardSetupSessionInput {
|
|
2579
|
-
/**
|
|
2624
|
+
/**
|
|
2625
|
+
* The member's email. A member this game already knows needs nothing else. An unknown
|
|
2626
|
+
* member is `404 PLAYER_NOT_FOUND` unless `playerName` is sent, in which case INVO
|
|
2627
|
+
* creates them.
|
|
2628
|
+
*/
|
|
2580
2629
|
playerEmail: string;
|
|
2630
|
+
/**
|
|
2631
|
+
* Creates the member when they are new to this game (as `subscriptions.create` does),
|
|
2632
|
+
* so a first-time signup can save a card before a paid trial. Max 255 characters. Used
|
|
2633
|
+
* only when the member is new: a known member is never renamed by this call. Omit it to
|
|
2634
|
+
* keep the old behaviour (an unknown member is refused with `404 PLAYER_NOT_FOUND`).
|
|
2635
|
+
*/
|
|
2636
|
+
playerName?: string;
|
|
2637
|
+
/**
|
|
2638
|
+
* E.164 (for example `"+15555550100"`); the SDK refuses any other form before the
|
|
2639
|
+
* network. Used only when `playerName` creates a new member; ignored for a known member.
|
|
2640
|
+
* A phone already on another member can answer `409 PHONE_SHARE_APPROVAL_REQUIRED`
|
|
2641
|
+
* (`err.isPhoneShareApprovalRequired`).
|
|
2642
|
+
*/
|
|
2643
|
+
playerPhone?: string;
|
|
2581
2644
|
/**
|
|
2582
2645
|
* Where the page sends the member after the card is saved. Absent: the page shows
|
|
2583
2646
|
* "Card saved, you can close this window". http(s) and app deep-link schemes only; a
|
|
@@ -2841,4 +2904,4 @@ interface CheckoutClientConfig {
|
|
|
2841
2904
|
hooks?: InvoHooks;
|
|
2842
2905
|
}
|
|
2843
2906
|
|
|
2844
|
-
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 ApproveWithDeviceCodeInput 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 ItemHistoryQuery as aA, type ItemHistoryResult as aB, type ItemOrderQuery as aC, type PlayerBalanceQuery as aD, type PlayerBalanceResult as aE, type InboundPendingQuery as aF, type InboundPendingResult as aG, type LinkedIdentitiesQuery as aH, type LinkedIdentitiesResult as aI, type SmsVerifyResult as aJ, type ClaimTransferInput as aK, type ClaimResult as aL, type ClaimCurrencyInput as aM, type TransactionStatusResult as aN, type GuardianApprovalStatusResult as aO, type ServerDestinationsQuery as aP, type PhoneShareContact as aQ, type PhoneShareInitiateResult as aR, type PhoneShareApproveInput as aS, type PhoneShareApproveResult as aT, type PhoneShareStatusResult as aU, type BeginDeviceApprovalInput as aV, type DeviceApprovalGrant as aW, type PollDeviceApprovalInput as aX, type DeviceApprovalPollResult as aY, type ConfirmDeviceEnrollmentInput as aZ, type ConfirmDeviceEnrollmentResult 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 CurrencyPurchaseQuoteInput as ao, type CurrencyPurchaseQuote as ap, type ConfirmPaymentResult as aq, type OrderDetailsResult as ar, type SteamPacksQuery as as, type SteamPacksResult as at, type SteamInitPurchaseInput as au, type SteamInitPurchaseResult as av, type SteamFinalizeInput as aw, type SteamFinalizeResult as ax, type PurchaseItemInput as ay, type PurchaseItemResult as az, type PurchaseExpired as b, type DeviceApprovalSettleResult as b0, type CompleteDeviceApprovalInput as b1, type CompleteDeviceApprovalResult as b2, type CardSetupStatus as b3, type
|
|
2907
|
+
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 ApproveWithDeviceCodeInput 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 ItemHistoryQuery as aA, type ItemHistoryResult as aB, type ItemOrderQuery as aC, type PlayerBalanceQuery as aD, type PlayerBalanceResult as aE, type InboundPendingQuery as aF, type InboundPendingResult as aG, type LinkedIdentitiesQuery as aH, type LinkedIdentitiesResult as aI, type SmsVerifyResult as aJ, type ClaimTransferInput as aK, type ClaimResult as aL, type ClaimCurrencyInput as aM, type TransactionStatusResult as aN, type GuardianApprovalStatusResult as aO, type ServerDestinationsQuery as aP, type PhoneShareContact as aQ, type PhoneShareInitiateResult as aR, type PhoneShareApproveInput as aS, type PhoneShareApproveResult as aT, type PhoneShareStatusResult as aU, type BeginDeviceApprovalInput as aV, type DeviceApprovalGrant as aW, type PollDeviceApprovalInput as aX, type DeviceApprovalPollResult as aY, type ConfirmDeviceEnrollmentInput as aZ, type ConfirmDeviceEnrollmentResult 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 CurrencyPurchaseQuoteInput as ao, type CurrencyPurchaseQuote as ap, type ConfirmPaymentResult as aq, type OrderDetailsResult as ar, type SteamPacksQuery as as, type SteamPacksResult as at, type SteamInitPurchaseInput as au, type SteamInitPurchaseResult as av, type SteamFinalizeInput as aw, type SteamFinalizeResult as ax, type PurchaseItemInput as ay, type PurchaseItemResult as az, type PurchaseExpired as b, type DeviceApprovalSettleResult as b0, type CompleteDeviceApprovalInput as b1, type CompleteDeviceApprovalResult as b2, type CardSetupStatus as b3, type CheckoutWarning as b4, type CurrencyBalance as b5, type CurrencyPurchaseQuoteBreakdown as b6, type DeviceApprovalChannel as b7, type DeviceApprovalEnrollment as b8, type DeviceApprovalFlow as b9, type SubscriptionRevenueShare as bA, type SubscriptionRevenueShareInput as bB, type SubscriptionStatus as bC, type UnacknowledgedPurchaseOutcome as bD, isRefundPendingApproval as bE, type DeviceApprovalPollStatus as ba, type DeviceEnrollmentDecision as bb, type DeviceEnrollmentRespond as bc, type FeeTakenFrom as bd, type FirstCharge as be, type FirstChargeStatus as bf, type FundingSource as bg, type InboundPendingItem as bh, type LinkedIdentityEmail as bi, type PlatformPurchaseStatus as bj, type RefundInitiation as bk, type RefundPendingApproval as bl, type RefundProcessingFeeBasis as bm, type RefundReceipt as bn, type RefundRevenueShareAttribution as bo, type RefundWarning as bp, type SandboxClockState as bq, type SavedCard as br, type SteamPack as bs, type SteamUserSession as bt, type Subscription as bu, type SubscriptionBaseInput as bv, type SubscriptionConsent as bw, type SubscriptionConsentInput as bx, type SubscriptionFundingRail as by, type SubscriptionInterval as bz, 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 };
|