@invonetwork/web-sdk 3.34.1 → 3.36.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 +20 -0
- package/README.md +115 -4
- package/dist/chunk-B75DBT53.js +6 -0
- package/dist/{chunk-3BR7URPM.js → chunk-BGCSSWVL.js} +104 -2
- package/dist/{chunk-MJXQ3Q7C.js → chunk-J4IQ3ANY.js} +240 -70
- package/dist/{chunk-PEYWNML4.js → chunk-SCFK6IVH.js} +3 -3
- package/dist/game-server.cjs +302 -73
- package/dist/game-server.d.cts +4 -4
- package/dist/game-server.d.ts +4 -4
- package/dist/game-server.js +5 -5
- package/dist/game.cjs +103 -1
- package/dist/game.d.cts +3 -3
- package/dist/game.d.ts +3 -3
- package/dist/game.js +3 -3
- package/dist/{hosted-approval-B6yY7ExK.d.cts → hosted-approval-BKI9oHwf.d.cts} +1 -1
- package/dist/{hosted-approval-CZ5EYFlM.d.ts → hosted-approval-fgVkugRU.d.ts} +1 -1
- package/dist/index.cjs +102 -0
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/{server-A1s7zqzG.d.cts → server-BMY3q2Bn.d.cts} +122 -7
- package/dist/{server-JARGQrat.d.ts → server-CSRCWgrK.d.ts} +122 -7
- package/dist/server.cjs +341 -66
- package/dist/server.d.cts +3 -3
- package/dist/server.d.ts +3 -3
- package/dist/server.js +3 -3
- package/dist/{types-B4J9Ifd2.d.ts → types-BcdXf2S5.d.cts} +173 -1
- package/dist/{types-B4J9Ifd2.d.cts → types-BcdXf2S5.d.ts} +173 -1
- package/dist/{version-DB2wgiPY.d.cts → version-QIFHOifq.d.cts} +1 -1
- package/dist/{version-DB2wgiPY.d.ts → version-QIFHOifq.d.ts} +1 -1
- package/docs/apple-in-app-purchases.md +425 -0
- package/package.json +2 -1
- package/dist/chunk-6763YM7P.js +0 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { I as InvoError, H as Http, $ as AuthHeader, g as CallOptions, a0 as
|
|
1
|
+
import { I as InvoError, H as Http, $ as AuthHeader, g as CallOptions, a0 as ApplePurchaseResult, a1 as PlatformPurchaseInput, a2 as PlatformPurchaseResult, a3 as PlatformApprovalResult, a4 as PlatformOrderStatusResult, a5 as PlatformPurchaseHistoryQuery, a6 as PlatformPurchaseHistoryResult, a7 as PlatformRefundInput, a8 as PlatformRefundResult, a9 as CreateSubscriptionInput, aa as SubscriptionResult, ab as GetSubscriptionOptions, ac as GetSubscriptionResult, ad as ListSubscriptionsOptions, ae as SubscriptionListResult, af as CancelSubscriptionOptions, ag as CancelResult, ah as ChangeAmountResult, ai as SetPaymentMethodInput, aj as SetPaymentMethodResult, ak as RefundSubscriptionInput, al as RefundResult, am as SteamSubscriptionInitInput, an as SteamInitResult, ao as SteamFinalizeSubscriptionResult, ap as CardSetupSessionInput, aq as CardSetupSessionResult, ar as CardSetupInput, as as CardSetupResult, at as CardSetupConfirmInput, au as CardSetupConfirmResult, av as PlayerCardsResult, aw as SandboxClockResult, ax as SandboxFailureOutcome, ay as SandboxForceFailureOptions, az as SandboxForceAuthChallengeOptions, aA as ServerConfig, aB as MintPlayerTokenInput, aC as PlayerToken, aD as RegisterPlayerInput, aE as RegisterPlayerResult, aF as UpdatePlayerPhoneInput, aG as UpdatePlayerPhoneResult, aH as RequestPhoneChangeInput, aI as RequestPhoneChangeResult, aJ as PhoneChangeRequest, aK as InitiateSendInput, aL as InitiateResult, aM as InitiateTransferInput, aN as CreateCheckoutInput, aO as CreateCheckoutResult, a as PurchaseStatusResult, aP as PurchaseInput, aQ as PurchaseResult, aR as CurrencyPurchaseQuoteInput, aS as CurrencyPurchaseQuote, aT as ConfirmPaymentResult, aU as OrderDetailsResult, aV as SteamPacksQuery, aW as SteamPacksResult, aX as SteamInitPurchaseInput, aY as SteamInitPurchaseResult, aZ as SteamFinalizeInput, a_ as SteamFinalizeResult, a$ as AppleProductsResult, b0 as VerifyApplePurchaseInput, b1 as PurchaseItemInput, b2 as PurchaseItemResult, b3 as ItemHistoryQuery, b4 as ItemHistoryResult, b5 as ItemOrderQuery, b6 as PlayerActivityQuery, b7 as PlayerActivityResult, b8 as PlayerActivityEntry, b9 as PlayerBalanceQuery, ba as PlayerBalanceResult, q as LoyaltyCardsResult, bb as InboundPendingQuery, bc as InboundPendingResult, bd as LinkedIdentitiesQuery, be as LinkedIdentitiesResult, bf as SmsVerifyResult, bg as ClaimTransferInput, bh as ClaimResult, bi as ClaimCurrencyInput, bj as TransactionStatusResult, bk as GuardianApprovalStatusResult, bl as ServerDestinationsQuery, p as DestinationsResult, bm as PhoneShareContact, bn as PhoneShareInitiateResult, bo as PhoneShareApproveInput, bp as PhoneShareApproveResult, bq as PhoneShareStatusResult, br as BeginDeviceApprovalInput, bs as DeviceApprovalGrant, bt as PollDeviceApprovalInput, bu as DeviceApprovalPollResult, bv as ConfirmDeviceEnrollmentInput, bw as ConfirmDeviceEnrollmentResult, bx as ApproveWithDeviceCodeInput, by as DeviceApprovalSettleResult, bz as CompleteDeviceApprovalInput, bA as CompleteDeviceApprovalResult } from './types-BcdXf2S5.js';
|
|
2
2
|
import { b as ReportServerGameEventInput, a as ReportGameEventResult } from './loyalty-events-CmDw2ZoR.js';
|
|
3
|
-
import './version-
|
|
3
|
+
import './version-QIFHOifq.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Pick the INVO environment from the game secret alone (3.28.0).
|
|
@@ -81,6 +81,33 @@ interface WebhookBase {
|
|
|
81
81
|
/** Your game_id. */
|
|
82
82
|
tenant_id: string;
|
|
83
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* The verified App Store transaction behind an Apple-rail purchase (additive, 3.35.0). Sent
|
|
86
|
+
* as `data.apple` on `purchase.completed` and `purchase.refunded` when `rail` is `"apple"`;
|
|
87
|
+
* absent on every other rail.
|
|
88
|
+
*/
|
|
89
|
+
interface AppleWebhookDetails {
|
|
90
|
+
/** Apple's `transactionId`. */
|
|
91
|
+
transaction_id: string;
|
|
92
|
+
original_transaction_id: string;
|
|
93
|
+
/** The App Store product id. */
|
|
94
|
+
product_id: string;
|
|
95
|
+
/** `"Production"` or `"Sandbox"`. */
|
|
96
|
+
environment: string;
|
|
97
|
+
/** The App Store storefront (for example `"USA"`), or `null` when Apple sent none. */
|
|
98
|
+
storefront: string | null;
|
|
99
|
+
/** Per-unit price in the storefront's currency, decimal string, or `null`. */
|
|
100
|
+
price: string | null;
|
|
101
|
+
/** ISO 4217 code of `price`, or `null`. */
|
|
102
|
+
currency: string | null;
|
|
103
|
+
/**
|
|
104
|
+
* `false` when `usd_amount` is exactly what the player paid (a USD storefront). `true` when
|
|
105
|
+
* the storefront is not in USD and `usd_amount` is the product's registered US price.
|
|
106
|
+
*/
|
|
107
|
+
charged_usd_estimated: boolean;
|
|
108
|
+
/** `true` for an App Review (Sandbox) purchase accepted on INVO production. */
|
|
109
|
+
test_mode: boolean;
|
|
110
|
+
}
|
|
84
111
|
interface PurchaseCompletedData {
|
|
85
112
|
transaction_id: string;
|
|
86
113
|
order_id: string;
|
|
@@ -90,7 +117,8 @@ interface PurchaseCompletedData {
|
|
|
90
117
|
currency_amount: string;
|
|
91
118
|
currency_name: string;
|
|
92
119
|
new_balance: string;
|
|
93
|
-
/** Which settlement rail carried the money. Provider-neutral
|
|
120
|
+
/** Which settlement rail carried the money. Provider-neutral: `"platform"`, `"game"`,
|
|
121
|
+
* `"steam"`, `"apple"` (3.35.0). Treat an unknown value as a new rail. */
|
|
94
122
|
rail: string;
|
|
95
123
|
/**
|
|
96
124
|
* Which STOREFRONT the purchase came from — "steam" / "ios" / "android" /
|
|
@@ -100,8 +128,8 @@ interface PurchaseCompletedData {
|
|
|
100
128
|
*/
|
|
101
129
|
channel?: string | null;
|
|
102
130
|
/**
|
|
103
|
-
* The metadata you passed to createCheckout/purchaseCurrency/steamInitPurchase
|
|
104
|
-
* (all rails).
|
|
131
|
+
* The metadata you passed to createCheckout/purchaseCurrency/steamInitPurchase/
|
|
132
|
+
* verifyApplePurchase, echoed back (all rails).
|
|
105
133
|
*
|
|
106
134
|
* **Subscription renewals also emit `purchase.completed`** (every paid card renewal, for the
|
|
107
135
|
* coins its charge minted). Those carry `metadata.source === "subscription_renewal"` and
|
|
@@ -141,6 +169,12 @@ interface PurchaseCompletedData {
|
|
|
141
169
|
* Card purchases only; absent and `null` on the same terms as `partner_fee_usd`.
|
|
142
170
|
*/
|
|
143
171
|
international_card_fee_usd?: string | null;
|
|
172
|
+
/**
|
|
173
|
+
* Additive (3.35.0), Apple rail only (`rail: "apple"`, `channel: "ios"`): the verified App
|
|
174
|
+
* Store transaction. `usd_amount` is what the player paid in USD (exact on a USD storefront;
|
|
175
|
+
* otherwise the registered US price, with `apple.charged_usd_estimated: true`).
|
|
176
|
+
*/
|
|
177
|
+
apple?: AppleWebhookDetails;
|
|
144
178
|
[key: string]: unknown;
|
|
145
179
|
}
|
|
146
180
|
interface PurchaseEventData {
|
|
@@ -231,13 +265,21 @@ interface PurchaseEventData {
|
|
|
231
265
|
dispute_id?: string | null;
|
|
232
266
|
/**
|
|
233
267
|
* The rail the purchase was paid on, where the event carries it: `"steam"` on a Steam
|
|
234
|
-
* `purchase.refunded` or `purchase.disputed`.
|
|
268
|
+
* `purchase.refunded` or `purchase.disputed`, `"apple"` on an Apple `purchase.refunded`.
|
|
235
269
|
*/
|
|
236
270
|
rail?: string;
|
|
237
271
|
/** The Steam transaction id, on a Steam `purchase.refunded` or `purchase.disputed`. */
|
|
238
272
|
steam_transid?: string;
|
|
239
273
|
/** On purchase.refunded: `false` for a partial refund (a Steam partial refund included). */
|
|
240
274
|
fully_refunded?: boolean;
|
|
275
|
+
/**
|
|
276
|
+
* Additive (3.35.0), on an Apple `purchase.refunded` (Apple refunded or revoked the
|
|
277
|
+
* transaction): the verified App Store transaction. Only coins the player still holds from
|
|
278
|
+
* the purchase are taken back, never below zero.
|
|
279
|
+
*/
|
|
280
|
+
apple?: AppleWebhookDetails;
|
|
281
|
+
/** On an Apple `purchase.refunded`: the metadata you passed to `verifyApplePurchase`. */
|
|
282
|
+
metadata?: Record<string, unknown>;
|
|
241
283
|
/** Coins taken back by this event, or `null` when the player has no balance row. */
|
|
242
284
|
currency_debited?: string | null;
|
|
243
285
|
/** The player's balance after this event. Never below zero. */
|
|
@@ -1190,6 +1232,36 @@ declare class PayoutsServer {
|
|
|
1190
1232
|
cancelPayout(payoutIdValue: number, opts?: CallOptions): Promise<Payout>;
|
|
1191
1233
|
}
|
|
1192
1234
|
|
|
1235
|
+
/**
|
|
1236
|
+
* The refusals after which the transaction is finished, because nothing can ever be delivered
|
|
1237
|
+
* for it: Apple refunded or revoked it, it was credited in another INVO game, or it was bought
|
|
1238
|
+
* before the game sold through INVO. Used only when a response carries no `finish` flag.
|
|
1239
|
+
*/
|
|
1240
|
+
declare const APPLE_FINISH_ERROR_CODES: readonly string[];
|
|
1241
|
+
/**
|
|
1242
|
+
* Should the game call StoreKit's `Transaction.finish()` after this outcome of
|
|
1243
|
+
* `verifyApplePurchase`? Pass either the result or the thrown error.
|
|
1244
|
+
*
|
|
1245
|
+
* INVO decides: every verify-purchase answer, success or error, carries a boolean `finish`,
|
|
1246
|
+
* and this returns it. When an answer carries none (an older backend, or a refusal from
|
|
1247
|
+
* outside the Apple route such as an unknown key), it falls back to the same rule INVO
|
|
1248
|
+
* applies: `true` for a result with `status` `"credited"` or `"already_credited"`, and for
|
|
1249
|
+
* the errors `APPLE_TRANSACTION_REVOKED`, `APPLE_TRANSACTION_ALREADY_USED` and
|
|
1250
|
+
* `APPLE_TRANSACTION_TOO_OLD` (nothing can ever be delivered for those).
|
|
1251
|
+
*
|
|
1252
|
+
* `false` for everything else, including `APPLE_CREDIT_PENDING`, every other refusal, a
|
|
1253
|
+
* network error or timeout, and anything unrecognised. Leave the transaction unfinished:
|
|
1254
|
+
* StoreKit redelivers it and your server retries `verifyApplePurchase` with the same
|
|
1255
|
+
* signed transaction, which never credits twice.
|
|
1256
|
+
*/
|
|
1257
|
+
declare function shouldFinishAppleTransaction(outcome: ApplePurchaseResult | unknown): boolean;
|
|
1258
|
+
/**
|
|
1259
|
+
* `true` when `verifyApplePurchase` threw `APPLE_CREDIT_PENDING` (503): the purchase is
|
|
1260
|
+
* verified and held, and will credit on a later retry. Keep the transaction unfinished and
|
|
1261
|
+
* retry; never ask the player to pay again.
|
|
1262
|
+
*/
|
|
1263
|
+
declare function isAppleCreditPending(err: unknown): boolean;
|
|
1264
|
+
|
|
1193
1265
|
/**
|
|
1194
1266
|
* @invonetwork/web-sdk/server — NODE entry.
|
|
1195
1267
|
*
|
|
@@ -1882,6 +1954,10 @@ declare class InvoServer {
|
|
|
1882
1954
|
* answer for all players. Without `steamid` the quote assumes no VAT — the
|
|
1883
1955
|
* most any pack yields; the purchase itself always re-derives.
|
|
1884
1956
|
*
|
|
1957
|
+
* Availability (3.36.0): `canSell` / `unavailableReason` for the title, and
|
|
1958
|
+
* per pack `available` / `unavailableReason`. Call this before showing the
|
|
1959
|
+
* store and hide packs with `available: false`; init still decides.
|
|
1960
|
+
*
|
|
1885
1961
|
* Refusals: `err.isSteamRailNotEntitled` (403). A missing Steam
|
|
1886
1962
|
* registration does NOT refuse here — packs deliberately answers with the
|
|
1887
1963
|
* no-VAT catalogue and lets the PURCHASE be what refuses; the only 503 is
|
|
@@ -1931,6 +2007,45 @@ declare class InvoServer {
|
|
|
1931
2007
|
* detects the authorized transaction and credits, on a delay.
|
|
1932
2008
|
*/
|
|
1933
2009
|
steamFinalizePurchase(input: SteamFinalizeInput, opts?: CallOptions): Promise<SteamFinalizeResult>;
|
|
2010
|
+
/**
|
|
2011
|
+
* The App Store products registered for this game, and whether INVO will sell each one
|
|
2012
|
+
* right now. Call it with the game's iOS key **before every purchase** and offer only
|
|
2013
|
+
* products with `available: true`: Apple charges the player before INVO sees the
|
|
2014
|
+
* purchase, so this is the only point where INVO can say no. Ask StoreKit for exactly the
|
|
2015
|
+
* `productId`s listed.
|
|
2016
|
+
*
|
|
2017
|
+
* `unavailableReason` (per product, and for the whole game when `canSell` is `false`):
|
|
2018
|
+
* `APPLE_NOT_VERIFIED`, `PARTNER_BILLING_NOT_SET_UP`, `PARTNER_RAIL_SUSPENDED`,
|
|
2019
|
+
* `PARTNER_CREDIT_UNAVAILABLE`.
|
|
2020
|
+
*
|
|
2021
|
+
* Refusals: `err.isAppleNotConfigured` (409, no Apple configuration or turned off),
|
|
2022
|
+
* `err.isRailChannelMismatch` (409, the key is not an iOS key on the Apple rail).
|
|
2023
|
+
*/
|
|
2024
|
+
appleProducts(opts?: CallOptions): Promise<AppleProductsResult>;
|
|
2025
|
+
/**
|
|
2026
|
+
* Verify a StoreKit 2 transaction and credit its coins, once. Call it from your game
|
|
2027
|
+
* SERVER, never the device, after StoreKit returns a verified transaction, with the
|
|
2028
|
+
* game's iOS key. Send `Transaction.jwsRepresentation` unchanged as `signedTransaction`.
|
|
2029
|
+
*
|
|
2030
|
+
* Then decide `Transaction.finish()` with {@link shouldFinishAppleTransaction}, passing
|
|
2031
|
+
* the result or the thrown error. It reads INVO's `finish` flag, which every answer carries
|
|
2032
|
+
* (`result.finish`, `err.finish`): `true` for `credited`, `already_credited` and the terminal
|
|
2033
|
+
* errors `isAppleTransactionRevoked`, `isAppleTransactionAlreadyUsed` and
|
|
2034
|
+
* `isAppleTransactionTooOld`. On anything else leave the transaction unfinished and
|
|
2035
|
+
* retry: StoreKit redelivers it, and a retry with the same signed transaction never credits
|
|
2036
|
+
* twice (a replay answers `already_credited`, with `balance` `null` unless you name the
|
|
2037
|
+
* same player). Safe to auto-retry for the same reason.
|
|
2038
|
+
*
|
|
2039
|
+
* Refusals: `isAppleSignatureInvalid`, `isAppleBundleMismatch`,
|
|
2040
|
+
* `isAppleEnvironmentNotAllowed`, `isAppleProductTypeUnsupported`, `isAppleProductUnknown`,
|
|
2041
|
+
* `isInvalidMetadata` / `isInvalidInput` (400); `isAppleReviewAccountRequired` (403);
|
|
2042
|
+
* `isAppleTransactionRevoked`, `isAppleTransactionAlreadyUsed`, `isAppleTransactionTooOld`,
|
|
2043
|
+
* `isAppleValueExceedsPrice`, `isAppleAccountTokenMismatch`, `isAppleNotConfigured`,
|
|
2044
|
+
* `isAppleNotVerified`, `isRailChannelMismatch` (409); `isAppleReviewPurchaseLimit` (429);
|
|
2045
|
+
* `isAppleCreditPending` (503, verified and held: retry; also while payments are paused);
|
|
2046
|
+
* and the usual game-key refusals, which carry no `finish` (treated as not finished).
|
|
2047
|
+
*/
|
|
2048
|
+
verifyApplePurchase(input: VerifyApplePurchaseInput, opts?: CallOptions): Promise<ApplePurchaseResult>;
|
|
1934
2049
|
/**
|
|
1935
2050
|
* Buy an in-game item by SPENDING the player's existing game currency (§4.8).
|
|
1936
2051
|
* No real money, no payment rail, no passkey — it's a balance debit, authenticated
|
|
@@ -2248,4 +2363,4 @@ declare class InvoServer {
|
|
|
2248
2363
|
private toInitiateResult;
|
|
2249
2364
|
}
|
|
2250
2365
|
|
|
2251
|
-
export { type
|
|
2366
|
+
export { type SubscriptionRefundApprovedData as $, APPLE_FINISH_ERROR_CODES as A, PlatformCommerceServer as B, CardsServer as C, DEMO_KEY_PREFIX as D, EnvironmentUnknownError as E, type PlayerPhoneChangedData as F, type PurchaseCompletedData as G, type PurchaseEventData as H, InvoServer as I, type RegisterPayeeResult as J, KeyEnvironmentMismatchError as K, LIVE_KEY_PREFIX as L, type RequestPayoutInput as M, type RequestPayoutResult as N, type ReturnReasonCode as O, PRODUCTION_BASE_URL as P, SandboxServer as Q, type RegisterPayeeInput as R, SANDBOX_BASE_URL as S, TEST_KEY_PREFIX as T, SandboxSubscriptionsServer as U, type SubscriptionAuthenticationRequiredData as V, type SubscriptionCanceledData as W, type SubscriptionEventCommon as X, type SubscriptionExpiredData as Y, type SubscriptionPastDueData as Z, type SubscriptionPaymentFailedData as _, type InvoEnvironment as a, type SubscriptionRefundDetail as a0, type SubscriptionRefundRejectedData as a1, type SubscriptionRefundRequestData as a2, type SubscriptionRefundedData as a3, type SubscriptionRenewalFunding as a4, type SubscriptionRenewalSplit as a5, type SubscriptionRenewedData as a6, type SubscriptionRevenueShareAttribution as a7, type SubscriptionTrialEventFields as a8, SubscriptionsServer as a9, type TransferEventData as aa, type VerifyWebhookOptions as ab, type WebhookHandlerOptions as ac, createWebhookHandler as ad, isAppleCreditPending as ae, shouldFinishAppleTransaction as af, verifyWebhook as ag, verifyWebhookAsync as ah, baseUrlForKey as b, environmentFromKeyPrefix as c, type AppleWebhookDetails as d, environmentForBaseUrl as e, type IdentityPasskeyResetData as f, type InvoWebhookEvent as g, type ItemPurchasedData as h, isDemoKey as i, type ListPayeesQuery as j, type ListPayeesResult as k, type ListPayoutsQuery as l, type ListPayoutsResult as m, type PayableBlocker as n, type Payee as o, type PayeeInvite as p, type PayeeStatus as q, resolveEnvironment as r, type PayeeStatusChangedData as s, type Payout as t, type PayoutStatus as u, verifyInvoSignature as v, type PayoutStatusChangedData as w, PayoutsServer as x, type PlatformCommercePurchasedData as y, type PlatformCommerceRefundedData as z };
|