@invonetwork/web-sdk 3.34.0 → 3.35.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 +104 -11
- package/dist/chunk-6763YM7P.js +6 -0
- package/dist/{chunk-R65CANFG.js → chunk-BGCSSWVL.js} +105 -3
- package/dist/{chunk-DMTNU5PM.js → chunk-SCFK6IVH.js} +3 -3
- package/dist/{chunk-D2AUZRYS.js → chunk-XN6MCLQV.js} +231 -70
- package/dist/game-server.cjs +294 -74
- 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 +105 -3
- package/dist/game.d.cts +3 -3
- package/dist/game.d.ts +3 -3
- package/dist/game.js +4 -4
- package/dist/{hosted-approval-CFlj4UQE.d.ts → hosted-approval-DIYUGgHi.d.ts} +1 -1
- package/dist/{hosted-approval-C1hQvbu6.d.cts → hosted-approval-VQ3uyeDh.d.cts} +1 -1
- package/dist/index.cjs +103 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/{server-CtXpytKt.d.ts → server-CMJHOmYL.d.ts} +120 -9
- package/dist/{server-ZnCyLWA2.d.cts → server-DF-BZU0B.d.cts} +120 -9
- package/dist/server.cjs +333 -67
- package/dist/server.d.cts +3 -3
- package/dist/server.d.ts +3 -3
- package/dist/server.js +3 -3
- package/dist/{types-Ctn8N2_l.d.ts → types-Dv0UavA9.d.cts} +149 -4
- package/dist/{types-Ctn8N2_l.d.cts → types-Dv0UavA9.d.ts} +149 -4
- package/dist/{version-Ce_pLpJf.d.cts → version-DB2wgiPY.d.cts} +1 -1
- package/dist/{version-Ce_pLpJf.d.ts → version-DB2wgiPY.d.ts} +1 -1
- package/docs/apple-in-app-purchases.md +382 -0
- package/package.json +2 -1
- package/dist/chunk-73ZVDQZV.js +0 -6
package/dist/game.cjs
CHANGED
|
@@ -843,7 +843,7 @@ var InvoError = class _InvoError extends Error {
|
|
|
843
843
|
/**
|
|
844
844
|
* True when a sandbox clock call was refused for a missing, wrong or never-issued
|
|
845
845
|
* `X-Sandbox-Clock-Key` (`SANDBOX_CLOCK_UNAUTHORIZED`, 401). Reveal or rotate the key on
|
|
846
|
-
* the game's Game Settings page in the
|
|
846
|
+
* the game's Game Settings page in the INVO console in test mode (console.invo.network/test).
|
|
847
847
|
*/
|
|
848
848
|
get isSandboxClockUnauthorized() {
|
|
849
849
|
return this.code === "SANDBOX_CLOCK_UNAUTHORIZED";
|
|
@@ -1163,6 +1163,108 @@ var InvoError = class _InvoError extends Error {
|
|
|
1163
1163
|
get isRateLimited() {
|
|
1164
1164
|
return this.code === "RATE_LIMITED" || this.code === "rate_limited" || this.status === 429;
|
|
1165
1165
|
}
|
|
1166
|
+
// ---- Apple In-App Purchase (verifyApplePurchase / appleProducts, 3.35.0) ----
|
|
1167
|
+
//
|
|
1168
|
+
// Apple has already charged the player when verifyApplePurchase runs. Decide whether to
|
|
1169
|
+
// call StoreKit's Transaction.finish() with shouldFinishAppleTransaction() (or `finish`),
|
|
1170
|
+
// not with these: among the errors only APPLE_TRANSACTION_REVOKED,
|
|
1171
|
+
// APPLE_TRANSACTION_ALREADY_USED and APPLE_TRANSACTION_TOO_OLD are finished.
|
|
1172
|
+
/**
|
|
1173
|
+
* The body's boolean `finish` (additive, 3.35.0), sent on every `verifyApplePurchase`
|
|
1174
|
+
* answer: `true` when the game should call StoreKit's `Transaction.finish()` for this
|
|
1175
|
+
* refusal (nothing can ever be delivered), `false` when it should leave the transaction
|
|
1176
|
+
* unfinished and retry. `undefined` when the body carries none (any other endpoint, an
|
|
1177
|
+
* older backend, or a network error); `shouldFinishAppleTransaction(err)` then falls back
|
|
1178
|
+
* to the error code.
|
|
1179
|
+
*/
|
|
1180
|
+
get finish() {
|
|
1181
|
+
const f = this.bodyObject()["finish"];
|
|
1182
|
+
return typeof f === "boolean" ? f : void 0;
|
|
1183
|
+
}
|
|
1184
|
+
/** Not a genuine Apple transaction (`APPLE_SIGNATURE_INVALID`, 400). Leave it unfinished. */
|
|
1185
|
+
get isAppleSignatureInvalid() {
|
|
1186
|
+
return this.code === "APPLE_SIGNATURE_INVALID";
|
|
1187
|
+
}
|
|
1188
|
+
/** Another app's transaction: the bundle id (or Apple ID) is not this game's
|
|
1189
|
+
* (`APPLE_BUNDLE_MISMATCH`, 400). */
|
|
1190
|
+
get isAppleBundleMismatch() {
|
|
1191
|
+
return this.code === "APPLE_BUNDLE_MISMATCH";
|
|
1192
|
+
}
|
|
1193
|
+
/** The transaction's environment is not accepted here (`APPLE_ENVIRONMENT_NOT_ALLOWED`, 400).
|
|
1194
|
+
* The INVO sandbox takes only Sandbox transactions; Xcode StoreKit-testing transactions are
|
|
1195
|
+
* never accepted, because Apple does not sign them. */
|
|
1196
|
+
get isAppleEnvironmentNotAllowed() {
|
|
1197
|
+
return this.code === "APPLE_ENVIRONMENT_NOT_ALLOWED";
|
|
1198
|
+
}
|
|
1199
|
+
/** Only consumable products buy currency (`APPLE_PRODUCT_TYPE_UNSUPPORTED`, 400). */
|
|
1200
|
+
get isAppleProductTypeUnsupported() {
|
|
1201
|
+
return this.code === "APPLE_PRODUCT_TYPE_UNSUPPORTED";
|
|
1202
|
+
}
|
|
1203
|
+
/** The product id is not registered for this game (`APPLE_PRODUCT_UNKNOWN`, 400). Register
|
|
1204
|
+
* it in the INVO console and retry; keep the transaction unfinished meanwhile. */
|
|
1205
|
+
get isAppleProductUnknown() {
|
|
1206
|
+
return this.code === "APPLE_PRODUCT_UNKNOWN";
|
|
1207
|
+
}
|
|
1208
|
+
/** `metadata` was refused (`INVALID_METADATA`, 400). Fix the request and retry. */
|
|
1209
|
+
get isInvalidMetadata() {
|
|
1210
|
+
return this.code === "INVALID_METADATA";
|
|
1211
|
+
}
|
|
1212
|
+
/** A Sandbox purchase on INVO production by an account not on the game's App Review list
|
|
1213
|
+
* (`APPLE_REVIEW_ACCOUNT_REQUIRED`, 403). */
|
|
1214
|
+
get isAppleReviewAccountRequired() {
|
|
1215
|
+
return this.code === "APPLE_REVIEW_ACCOUNT_REQUIRED";
|
|
1216
|
+
}
|
|
1217
|
+
/** Apple refunded or revoked the transaction (`APPLE_TRANSACTION_REVOKED`, 409). Nothing can
|
|
1218
|
+
* ever be delivered for it: **finish it** (`finish: true`). */
|
|
1219
|
+
get isAppleTransactionRevoked() {
|
|
1220
|
+
return this.code === "APPLE_TRANSACTION_REVOKED";
|
|
1221
|
+
}
|
|
1222
|
+
/** The transaction was already credited in another INVO game
|
|
1223
|
+
* (`APPLE_TRANSACTION_ALREADY_USED`, 409). Terminal: **finish it** (`finish: true`). */
|
|
1224
|
+
get isAppleTransactionAlreadyUsed() {
|
|
1225
|
+
return this.code === "APPLE_TRANSACTION_ALREADY_USED";
|
|
1226
|
+
}
|
|
1227
|
+
/** Bought before the game sold through INVO (`APPLE_TRANSACTION_TOO_OLD`, 409). Terminal:
|
|
1228
|
+
* **finish it** (`finish: true`). */
|
|
1229
|
+
get isAppleTransactionTooOld() {
|
|
1230
|
+
return this.code === "APPLE_TRANSACTION_TOO_OLD";
|
|
1231
|
+
}
|
|
1232
|
+
/** The product's coins are out of proportion to its signed price, or over the per-purchase
|
|
1233
|
+
* maximum (`APPLE_VALUE_EXCEEDS_PRICE`, 409). Fix the product mapping and retry. */
|
|
1234
|
+
get isAppleValueExceedsPrice() {
|
|
1235
|
+
return this.code === "APPLE_VALUE_EXCEEDS_PRICE";
|
|
1236
|
+
}
|
|
1237
|
+
/** The transaction's `appAccountToken` is not the one you sent: it was made for a
|
|
1238
|
+
* different player (`APPLE_ACCOUNT_TOKEN_MISMATCH`, 409). */
|
|
1239
|
+
get isAppleAccountTokenMismatch() {
|
|
1240
|
+
return this.code === "APPLE_ACCOUNT_TOKEN_MISMATCH";
|
|
1241
|
+
}
|
|
1242
|
+
/** The game's Apple configuration is missing or turned off (`APPLE_NOT_CONFIGURED`, 409).
|
|
1243
|
+
* Retry once it is set up. */
|
|
1244
|
+
get isAppleNotConfigured() {
|
|
1245
|
+
return this.code === "APPLE_NOT_CONFIGURED";
|
|
1246
|
+
}
|
|
1247
|
+
/** Production has not yet confirmed you own the App Store app (`APPLE_NOT_VERIFIED`, 409).
|
|
1248
|
+
* Point App Store Server Notifications at INVO; retry once verified. */
|
|
1249
|
+
get isAppleNotVerified() {
|
|
1250
|
+
return this.code === "APPLE_NOT_VERIFIED";
|
|
1251
|
+
}
|
|
1252
|
+
/** Today's App Review purchase cap on production is reached (`APPLE_REVIEW_PURCHASE_LIMIT`,
|
|
1253
|
+
* 429). */
|
|
1254
|
+
get isAppleReviewPurchaseLimit() {
|
|
1255
|
+
return this.code === "APPLE_REVIEW_PURCHASE_LIMIT";
|
|
1256
|
+
}
|
|
1257
|
+
/** Verified and held, not refused (`APPLE_CREDIT_PENDING`, 503): the coins will credit on a
|
|
1258
|
+
* later retry. Keep the transaction unfinished and retry; StoreKit also redelivers it. */
|
|
1259
|
+
get isAppleCreditPending() {
|
|
1260
|
+
return this.code === "APPLE_CREDIT_PENDING";
|
|
1261
|
+
}
|
|
1262
|
+
/** A card purchase (`purchaseCurrency`) was made with a key on the Apple rail
|
|
1263
|
+
* (`WRONG_RAIL_ENDPOINT`, 400, `status: "use_apple_endpoint"`). Use
|
|
1264
|
+
* `verifyApplePurchase` for that key. */
|
|
1265
|
+
get isAppleEndpointRequired() {
|
|
1266
|
+
return this.code === "WRONG_RAIL_ENDPOINT" && this.bodyObject()["status"] === "use_apple_endpoint";
|
|
1267
|
+
}
|
|
1166
1268
|
/** `body` as a plain object, or `{}` if it's a string/number/null (non-JSON responses).
|
|
1167
1269
|
* The `in` operator throws on primitives, so callers must go through this. */
|
|
1168
1270
|
bodyObject() {
|
|
@@ -3807,7 +3909,7 @@ function sessionStorageSafe() {
|
|
|
3807
3909
|
|
|
3808
3910
|
// src/game/ui.ts
|
|
3809
3911
|
var STYLE_ID = "invo-ui-styles";
|
|
3810
|
-
var CONSOLE_URL = { sandbox: "https://
|
|
3912
|
+
var CONSOLE_URL = { sandbox: "https://console.invo.network/test", production: "https://console.invo.network" };
|
|
3811
3913
|
var stroke = (d, size = 18) => `<svg viewBox="0 0 24 24" width="${size}" height="${size}" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${d}</svg>`;
|
|
3812
3914
|
var ICONS = {
|
|
3813
3915
|
plus: stroke('<path d="M12 5v14M5 12h14"/>', 14),
|
|
@@ -4894,7 +4996,7 @@ function mountInvoUI(container, economy, options = {}) {
|
|
|
4894
4996
|
}
|
|
4895
4997
|
|
|
4896
4998
|
// src/version.ts
|
|
4897
|
-
var SDK_VERSION = "3.34.
|
|
4999
|
+
var SDK_VERSION = "3.34.1";
|
|
4898
5000
|
|
|
4899
5001
|
exports.InvoGameEconomy = InvoGameEconomy;
|
|
4900
5002
|
exports.InvoGameError = InvoGameError;
|
package/dist/game.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { i as GamePlayer, q as GameWallet, c as GameCatalog, k as GamePurchase, h as GameItemPurchase, n as GameTransferKind, d as GameCatalogItem, f as GameCurrencyBalance, p as GameTransferStatus, m as GameTransferInput, o as GameTransferStart } from './types-jUxfYjiD.cjs';
|
|
2
2
|
export { e as GameCheckout, G as GameCurrencyKind, b as GameEconomyConfig, g as GameErrorBody, j as GamePremiumPack, a as GamePurchaseStatus, l as GameSession } from './types-jUxfYjiD.cjs';
|
|
3
|
-
import { A as ApproveHostedResult } from './hosted-approval-
|
|
4
|
-
import { D as DestinationGame, P as PendingCollectItem } from './types-
|
|
5
|
-
export { S as SDK_VERSION } from './version-
|
|
3
|
+
import { A as ApproveHostedResult } from './hosted-approval-VQ3uyeDh.cjs';
|
|
4
|
+
import { D as DestinationGame, P as PendingCollectItem } from './types-Dv0UavA9.cjs';
|
|
5
|
+
export { S as SDK_VERSION } from './version-DB2wgiPY.cjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* INVO game economy client (3.27.0), the browser half. It talks ONLY to your game server
|
package/dist/game.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { i as GamePlayer, q as GameWallet, c as GameCatalog, k as GamePurchase, h as GameItemPurchase, n as GameTransferKind, d as GameCatalogItem, f as GameCurrencyBalance, p as GameTransferStatus, m as GameTransferInput, o as GameTransferStart } from './types-jUxfYjiD.js';
|
|
2
2
|
export { e as GameCheckout, G as GameCurrencyKind, b as GameEconomyConfig, g as GameErrorBody, j as GamePremiumPack, a as GamePurchaseStatus, l as GameSession } from './types-jUxfYjiD.js';
|
|
3
|
-
import { A as ApproveHostedResult } from './hosted-approval-
|
|
4
|
-
import { D as DestinationGame, P as PendingCollectItem } from './types-
|
|
5
|
-
export { S as SDK_VERSION } from './version-
|
|
3
|
+
import { A as ApproveHostedResult } from './hosted-approval-DIYUGgHi.js';
|
|
4
|
+
import { D as DestinationGame, P as PendingCollectItem } from './types-Dv0UavA9.js';
|
|
5
|
+
export { S as SDK_VERSION } from './version-DB2wgiPY.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* INVO game economy client (3.27.0), the browser half. It talks ONLY to your game server
|
package/dist/game.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { InvoClient } from './chunk-
|
|
2
|
-
export { SDK_VERSION } from './chunk-
|
|
3
|
-
import { newEventId } from './chunk-
|
|
1
|
+
import { InvoClient } from './chunk-SCFK6IVH.js';
|
|
2
|
+
export { SDK_VERSION } from './chunk-6763YM7P.js';
|
|
3
|
+
import { newEventId } from './chunk-BGCSSWVL.js';
|
|
4
4
|
|
|
5
5
|
// src/game/client.ts
|
|
6
6
|
var InvoGameError = class extends Error {
|
|
@@ -501,7 +501,7 @@ function sessionStorageSafe() {
|
|
|
501
501
|
|
|
502
502
|
// src/game/ui.ts
|
|
503
503
|
var STYLE_ID = "invo-ui-styles";
|
|
504
|
-
var CONSOLE_URL = { sandbox: "https://
|
|
504
|
+
var CONSOLE_URL = { sandbox: "https://console.invo.network/test", production: "https://console.invo.network" };
|
|
505
505
|
var stroke = (d, size = 18) => `<svg viewBox="0 0 24 24" width="${size}" height="${size}" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${d}</svg>`;
|
|
506
506
|
var ICONS = {
|
|
507
507
|
plus: stroke('<path d="M12 5v14M5 12h14"/>', 14),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as ApproveResult, j as ConfirmReceiptResult } from './types-
|
|
1
|
+
import { A as ApproveResult, j as ConfirmReceiptResult } from './types-Dv0UavA9.js';
|
|
2
2
|
|
|
3
3
|
/** The four device-approval flows (`begin.flow`). */
|
|
4
4
|
type HostedFlow = "transfer" | "send" | "send_receipt" | "transfer_receipt";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as ApproveResult, j as ConfirmReceiptResult } from './types-
|
|
1
|
+
import { A as ApproveResult, j as ConfirmReceiptResult } from './types-Dv0UavA9.cjs';
|
|
2
2
|
|
|
3
3
|
/** The four device-approval flows (`begin.flow`). */
|
|
4
4
|
type HostedFlow = "transfer" | "send" | "send_receipt" | "transfer_receipt";
|
package/dist/index.cjs
CHANGED
|
@@ -843,7 +843,7 @@ var InvoError = class _InvoError extends Error {
|
|
|
843
843
|
/**
|
|
844
844
|
* True when a sandbox clock call was refused for a missing, wrong or never-issued
|
|
845
845
|
* `X-Sandbox-Clock-Key` (`SANDBOX_CLOCK_UNAUTHORIZED`, 401). Reveal or rotate the key on
|
|
846
|
-
* the game's Game Settings page in the
|
|
846
|
+
* the game's Game Settings page in the INVO console in test mode (console.invo.network/test).
|
|
847
847
|
*/
|
|
848
848
|
get isSandboxClockUnauthorized() {
|
|
849
849
|
return this.code === "SANDBOX_CLOCK_UNAUTHORIZED";
|
|
@@ -1163,6 +1163,108 @@ var InvoError = class _InvoError extends Error {
|
|
|
1163
1163
|
get isRateLimited() {
|
|
1164
1164
|
return this.code === "RATE_LIMITED" || this.code === "rate_limited" || this.status === 429;
|
|
1165
1165
|
}
|
|
1166
|
+
// ---- Apple In-App Purchase (verifyApplePurchase / appleProducts, 3.35.0) ----
|
|
1167
|
+
//
|
|
1168
|
+
// Apple has already charged the player when verifyApplePurchase runs. Decide whether to
|
|
1169
|
+
// call StoreKit's Transaction.finish() with shouldFinishAppleTransaction() (or `finish`),
|
|
1170
|
+
// not with these: among the errors only APPLE_TRANSACTION_REVOKED,
|
|
1171
|
+
// APPLE_TRANSACTION_ALREADY_USED and APPLE_TRANSACTION_TOO_OLD are finished.
|
|
1172
|
+
/**
|
|
1173
|
+
* The body's boolean `finish` (additive, 3.35.0), sent on every `verifyApplePurchase`
|
|
1174
|
+
* answer: `true` when the game should call StoreKit's `Transaction.finish()` for this
|
|
1175
|
+
* refusal (nothing can ever be delivered), `false` when it should leave the transaction
|
|
1176
|
+
* unfinished and retry. `undefined` when the body carries none (any other endpoint, an
|
|
1177
|
+
* older backend, or a network error); `shouldFinishAppleTransaction(err)` then falls back
|
|
1178
|
+
* to the error code.
|
|
1179
|
+
*/
|
|
1180
|
+
get finish() {
|
|
1181
|
+
const f = this.bodyObject()["finish"];
|
|
1182
|
+
return typeof f === "boolean" ? f : void 0;
|
|
1183
|
+
}
|
|
1184
|
+
/** Not a genuine Apple transaction (`APPLE_SIGNATURE_INVALID`, 400). Leave it unfinished. */
|
|
1185
|
+
get isAppleSignatureInvalid() {
|
|
1186
|
+
return this.code === "APPLE_SIGNATURE_INVALID";
|
|
1187
|
+
}
|
|
1188
|
+
/** Another app's transaction: the bundle id (or Apple ID) is not this game's
|
|
1189
|
+
* (`APPLE_BUNDLE_MISMATCH`, 400). */
|
|
1190
|
+
get isAppleBundleMismatch() {
|
|
1191
|
+
return this.code === "APPLE_BUNDLE_MISMATCH";
|
|
1192
|
+
}
|
|
1193
|
+
/** The transaction's environment is not accepted here (`APPLE_ENVIRONMENT_NOT_ALLOWED`, 400).
|
|
1194
|
+
* The INVO sandbox takes only Sandbox transactions; Xcode StoreKit-testing transactions are
|
|
1195
|
+
* never accepted, because Apple does not sign them. */
|
|
1196
|
+
get isAppleEnvironmentNotAllowed() {
|
|
1197
|
+
return this.code === "APPLE_ENVIRONMENT_NOT_ALLOWED";
|
|
1198
|
+
}
|
|
1199
|
+
/** Only consumable products buy currency (`APPLE_PRODUCT_TYPE_UNSUPPORTED`, 400). */
|
|
1200
|
+
get isAppleProductTypeUnsupported() {
|
|
1201
|
+
return this.code === "APPLE_PRODUCT_TYPE_UNSUPPORTED";
|
|
1202
|
+
}
|
|
1203
|
+
/** The product id is not registered for this game (`APPLE_PRODUCT_UNKNOWN`, 400). Register
|
|
1204
|
+
* it in the INVO console and retry; keep the transaction unfinished meanwhile. */
|
|
1205
|
+
get isAppleProductUnknown() {
|
|
1206
|
+
return this.code === "APPLE_PRODUCT_UNKNOWN";
|
|
1207
|
+
}
|
|
1208
|
+
/** `metadata` was refused (`INVALID_METADATA`, 400). Fix the request and retry. */
|
|
1209
|
+
get isInvalidMetadata() {
|
|
1210
|
+
return this.code === "INVALID_METADATA";
|
|
1211
|
+
}
|
|
1212
|
+
/** A Sandbox purchase on INVO production by an account not on the game's App Review list
|
|
1213
|
+
* (`APPLE_REVIEW_ACCOUNT_REQUIRED`, 403). */
|
|
1214
|
+
get isAppleReviewAccountRequired() {
|
|
1215
|
+
return this.code === "APPLE_REVIEW_ACCOUNT_REQUIRED";
|
|
1216
|
+
}
|
|
1217
|
+
/** Apple refunded or revoked the transaction (`APPLE_TRANSACTION_REVOKED`, 409). Nothing can
|
|
1218
|
+
* ever be delivered for it: **finish it** (`finish: true`). */
|
|
1219
|
+
get isAppleTransactionRevoked() {
|
|
1220
|
+
return this.code === "APPLE_TRANSACTION_REVOKED";
|
|
1221
|
+
}
|
|
1222
|
+
/** The transaction was already credited in another INVO game
|
|
1223
|
+
* (`APPLE_TRANSACTION_ALREADY_USED`, 409). Terminal: **finish it** (`finish: true`). */
|
|
1224
|
+
get isAppleTransactionAlreadyUsed() {
|
|
1225
|
+
return this.code === "APPLE_TRANSACTION_ALREADY_USED";
|
|
1226
|
+
}
|
|
1227
|
+
/** Bought before the game sold through INVO (`APPLE_TRANSACTION_TOO_OLD`, 409). Terminal:
|
|
1228
|
+
* **finish it** (`finish: true`). */
|
|
1229
|
+
get isAppleTransactionTooOld() {
|
|
1230
|
+
return this.code === "APPLE_TRANSACTION_TOO_OLD";
|
|
1231
|
+
}
|
|
1232
|
+
/** The product's coins are out of proportion to its signed price, or over the per-purchase
|
|
1233
|
+
* maximum (`APPLE_VALUE_EXCEEDS_PRICE`, 409). Fix the product mapping and retry. */
|
|
1234
|
+
get isAppleValueExceedsPrice() {
|
|
1235
|
+
return this.code === "APPLE_VALUE_EXCEEDS_PRICE";
|
|
1236
|
+
}
|
|
1237
|
+
/** The transaction's `appAccountToken` is not the one you sent: it was made for a
|
|
1238
|
+
* different player (`APPLE_ACCOUNT_TOKEN_MISMATCH`, 409). */
|
|
1239
|
+
get isAppleAccountTokenMismatch() {
|
|
1240
|
+
return this.code === "APPLE_ACCOUNT_TOKEN_MISMATCH";
|
|
1241
|
+
}
|
|
1242
|
+
/** The game's Apple configuration is missing or turned off (`APPLE_NOT_CONFIGURED`, 409).
|
|
1243
|
+
* Retry once it is set up. */
|
|
1244
|
+
get isAppleNotConfigured() {
|
|
1245
|
+
return this.code === "APPLE_NOT_CONFIGURED";
|
|
1246
|
+
}
|
|
1247
|
+
/** Production has not yet confirmed you own the App Store app (`APPLE_NOT_VERIFIED`, 409).
|
|
1248
|
+
* Point App Store Server Notifications at INVO; retry once verified. */
|
|
1249
|
+
get isAppleNotVerified() {
|
|
1250
|
+
return this.code === "APPLE_NOT_VERIFIED";
|
|
1251
|
+
}
|
|
1252
|
+
/** Today's App Review purchase cap on production is reached (`APPLE_REVIEW_PURCHASE_LIMIT`,
|
|
1253
|
+
* 429). */
|
|
1254
|
+
get isAppleReviewPurchaseLimit() {
|
|
1255
|
+
return this.code === "APPLE_REVIEW_PURCHASE_LIMIT";
|
|
1256
|
+
}
|
|
1257
|
+
/** Verified and held, not refused (`APPLE_CREDIT_PENDING`, 503): the coins will credit on a
|
|
1258
|
+
* later retry. Keep the transaction unfinished and retry; StoreKit also redelivers it. */
|
|
1259
|
+
get isAppleCreditPending() {
|
|
1260
|
+
return this.code === "APPLE_CREDIT_PENDING";
|
|
1261
|
+
}
|
|
1262
|
+
/** A card purchase (`purchaseCurrency`) was made with a key on the Apple rail
|
|
1263
|
+
* (`WRONG_RAIL_ENDPOINT`, 400, `status: "use_apple_endpoint"`). Use
|
|
1264
|
+
* `verifyApplePurchase` for that key. */
|
|
1265
|
+
get isAppleEndpointRequired() {
|
|
1266
|
+
return this.code === "WRONG_RAIL_ENDPOINT" && this.bodyObject()["status"] === "use_apple_endpoint";
|
|
1267
|
+
}
|
|
1166
1268
|
/** `body` as a plain object, or `{}` if it's a string/number/null (non-JSON responses).
|
|
1167
1269
|
* The `in` operator throws on primitives, so callers must go through this. */
|
|
1168
1270
|
bodyObject() {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as PurchaseStatusResult, b as PurchaseCredited, c as PurchaseExpired, d as PurchaseRefunded, e as PurchaseRefused, C as CheckoutClientConfig, H as Http, f as PurchaseStatusInput, g as CallOptions, W as WaitForPurchaseInput, M as MountCheckoutOptions, h as CheckoutMountHandle, i as ClientConfig, A as ApproveResult, j as ConfirmReceiptResult, k as PhoneChangeApprovalsResult, l as ApprovePhoneChangeInput, m as ApprovePhoneChangeResult, L as LinkDeviceResult, n as PendingCollectResult, o as DestinationsQuery, p as DestinationsResult, B as BalanceResult, q as LoyaltyCardsResult, r as LoyaltyVaultResult, R as RedeemRewardResult, s as RewardsPageLink, E as EnrollmentBeginResult, t as EnrollmentVerifyResult, u as RecoveryBeginResult, v as RecoveryCompleteResult } from './types-
|
|
2
|
-
export { w as BalanceRow, x as CheckoutPurchaseStatus, y as ClaimDelivery, D as DestinationGame, I as InvoError, z as InvoErrorInfo, F as InvoHooks, G as InvoRequestInfo, J as InvoResponseInfo, K as LoyaltyCard, N as LoyaltyCardReward, O as LoyaltyCardStep, Q as LoyaltyRewardState, S as LoyaltyStepProgress, T as LoyaltyStepState, U as LoyaltyVaultEntry, P as PendingCollectItem, V as PhoneChangeApproval, X as PhoneChangeDeviceSignal, Y as PurchaseRefusalReason, Z as Rail, _ as VerificationMethod } from './types-
|
|
3
|
-
import { a as ApproveHostedOptions, A as ApproveHostedResult } from './hosted-approval-
|
|
4
|
-
export { E as EnrollmentDecision, b as EnrollmentRespond, H as HostedApprovalStatus, c as HostedEnrollment, d as HostedEnrollmentInput, e as HostedFlow } from './hosted-approval-
|
|
1
|
+
import { a as PurchaseStatusResult, b as PurchaseCredited, c as PurchaseExpired, d as PurchaseRefunded, e as PurchaseRefused, C as CheckoutClientConfig, H as Http, f as PurchaseStatusInput, g as CallOptions, W as WaitForPurchaseInput, M as MountCheckoutOptions, h as CheckoutMountHandle, i as ClientConfig, A as ApproveResult, j as ConfirmReceiptResult, k as PhoneChangeApprovalsResult, l as ApprovePhoneChangeInput, m as ApprovePhoneChangeResult, L as LinkDeviceResult, n as PendingCollectResult, o as DestinationsQuery, p as DestinationsResult, B as BalanceResult, q as LoyaltyCardsResult, r as LoyaltyVaultResult, R as RedeemRewardResult, s as RewardsPageLink, E as EnrollmentBeginResult, t as EnrollmentVerifyResult, u as RecoveryBeginResult, v as RecoveryCompleteResult } from './types-Dv0UavA9.cjs';
|
|
2
|
+
export { w as BalanceRow, x as CheckoutPurchaseStatus, y as ClaimDelivery, D as DestinationGame, I as InvoError, z as InvoErrorInfo, F as InvoHooks, G as InvoRequestInfo, J as InvoResponseInfo, K as LoyaltyCard, N as LoyaltyCardReward, O as LoyaltyCardStep, Q as LoyaltyRewardState, S as LoyaltyStepProgress, T as LoyaltyStepState, U as LoyaltyVaultEntry, P as PendingCollectItem, V as PhoneChangeApproval, X as PhoneChangeDeviceSignal, Y as PurchaseRefusalReason, Z as Rail, _ as VerificationMethod } from './types-Dv0UavA9.cjs';
|
|
3
|
+
import { a as ApproveHostedOptions, A as ApproveHostedResult } from './hosted-approval-VQ3uyeDh.cjs';
|
|
4
|
+
export { E as EnrollmentDecision, b as EnrollmentRespond, H as HostedApprovalStatus, c as HostedEnrollment, d as HostedEnrollmentInput, e as HostedFlow } from './hosted-approval-VQ3uyeDh.cjs';
|
|
5
5
|
import { R as ReportGameEventInput, a as ReportGameEventResult } from './loyalty-events-CmDw2ZoR.cjs';
|
|
6
6
|
export { G as GameEventType } from './loyalty-events-CmDw2ZoR.cjs';
|
|
7
7
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as PurchaseStatusResult, b as PurchaseCredited, c as PurchaseExpired, d as PurchaseRefunded, e as PurchaseRefused, C as CheckoutClientConfig, H as Http, f as PurchaseStatusInput, g as CallOptions, W as WaitForPurchaseInput, M as MountCheckoutOptions, h as CheckoutMountHandle, i as ClientConfig, A as ApproveResult, j as ConfirmReceiptResult, k as PhoneChangeApprovalsResult, l as ApprovePhoneChangeInput, m as ApprovePhoneChangeResult, L as LinkDeviceResult, n as PendingCollectResult, o as DestinationsQuery, p as DestinationsResult, B as BalanceResult, q as LoyaltyCardsResult, r as LoyaltyVaultResult, R as RedeemRewardResult, s as RewardsPageLink, E as EnrollmentBeginResult, t as EnrollmentVerifyResult, u as RecoveryBeginResult, v as RecoveryCompleteResult } from './types-
|
|
2
|
-
export { w as BalanceRow, x as CheckoutPurchaseStatus, y as ClaimDelivery, D as DestinationGame, I as InvoError, z as InvoErrorInfo, F as InvoHooks, G as InvoRequestInfo, J as InvoResponseInfo, K as LoyaltyCard, N as LoyaltyCardReward, O as LoyaltyCardStep, Q as LoyaltyRewardState, S as LoyaltyStepProgress, T as LoyaltyStepState, U as LoyaltyVaultEntry, P as PendingCollectItem, V as PhoneChangeApproval, X as PhoneChangeDeviceSignal, Y as PurchaseRefusalReason, Z as Rail, _ as VerificationMethod } from './types-
|
|
3
|
-
import { a as ApproveHostedOptions, A as ApproveHostedResult } from './hosted-approval-
|
|
4
|
-
export { E as EnrollmentDecision, b as EnrollmentRespond, H as HostedApprovalStatus, c as HostedEnrollment, d as HostedEnrollmentInput, e as HostedFlow } from './hosted-approval-
|
|
1
|
+
import { a as PurchaseStatusResult, b as PurchaseCredited, c as PurchaseExpired, d as PurchaseRefunded, e as PurchaseRefused, C as CheckoutClientConfig, H as Http, f as PurchaseStatusInput, g as CallOptions, W as WaitForPurchaseInput, M as MountCheckoutOptions, h as CheckoutMountHandle, i as ClientConfig, A as ApproveResult, j as ConfirmReceiptResult, k as PhoneChangeApprovalsResult, l as ApprovePhoneChangeInput, m as ApprovePhoneChangeResult, L as LinkDeviceResult, n as PendingCollectResult, o as DestinationsQuery, p as DestinationsResult, B as BalanceResult, q as LoyaltyCardsResult, r as LoyaltyVaultResult, R as RedeemRewardResult, s as RewardsPageLink, E as EnrollmentBeginResult, t as EnrollmentVerifyResult, u as RecoveryBeginResult, v as RecoveryCompleteResult } from './types-Dv0UavA9.js';
|
|
2
|
+
export { w as BalanceRow, x as CheckoutPurchaseStatus, y as ClaimDelivery, D as DestinationGame, I as InvoError, z as InvoErrorInfo, F as InvoHooks, G as InvoRequestInfo, J as InvoResponseInfo, K as LoyaltyCard, N as LoyaltyCardReward, O as LoyaltyCardStep, Q as LoyaltyRewardState, S as LoyaltyStepProgress, T as LoyaltyStepState, U as LoyaltyVaultEntry, P as PendingCollectItem, V as PhoneChangeApproval, X as PhoneChangeDeviceSignal, Y as PurchaseRefusalReason, Z as Rail, _ as VerificationMethod } from './types-Dv0UavA9.js';
|
|
3
|
+
import { a as ApproveHostedOptions, A as ApproveHostedResult } from './hosted-approval-DIYUGgHi.js';
|
|
4
|
+
export { E as EnrollmentDecision, b as EnrollmentRespond, H as HostedApprovalStatus, c as HostedEnrollment, d as HostedEnrollmentInput, e as HostedFlow } from './hosted-approval-DIYUGgHi.js';
|
|
5
5
|
import { R as ReportGameEventInput, a as ReportGameEventResult } from './loyalty-events-CmDw2ZoR.js';
|
|
6
6
|
export { G as GameEventType } from './loyalty-events-CmDw2ZoR.js';
|
|
7
7
|
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { CheckoutClient, InvoClient, PlatformCommerceClient } from './chunk-
|
|
2
|
-
export { InvoError, isPurchaseCredited, isPurchaseExpired, isPurchaseRefunded, isPurchaseRefused, nothingWasCharged, phoneChangeSignalMessage } from './chunk-
|
|
1
|
+
export { CheckoutClient, InvoClient, PlatformCommerceClient } from './chunk-SCFK6IVH.js';
|
|
2
|
+
export { InvoError, isPurchaseCredited, isPurchaseExpired, isPurchaseRefunded, isPurchaseRefused, nothingWasCharged, phoneChangeSignalMessage } from './chunk-BGCSSWVL.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -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-Dv0UavA9.js';
|
|
2
2
|
import { b as ReportServerGameEventInput, a as ReportGameEventResult } from './loyalty-events-CmDw2ZoR.js';
|
|
3
|
-
import './version-
|
|
3
|
+
import './version-DB2wgiPY.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
|
*
|
|
@@ -1576,8 +1648,8 @@ declare class CardsServer {
|
|
|
1576
1648
|
* `/subscriptions/<id>/...` relative to it. They do not exist in production (404).
|
|
1577
1649
|
*
|
|
1578
1650
|
* **Second credential.** Every call sends `X-Game-Secret-Key` AND `X-Sandbox-Clock-Key`
|
|
1579
|
-
* (`new InvoServer({ ..., sandboxClockKey })`, from the
|
|
1580
|
-
* Game Settings, "Sandbox clock key"). A missing key throws `INVALID_INPUT` before the
|
|
1651
|
+
* (`new InvoServer({ ..., sandboxClockKey })`, from the INVO console in test mode (console.invo.network/test):
|
|
1652
|
+
* open the game, Game Settings, "Sandbox clock key"). A missing key throws `INVALID_INPUT` before the
|
|
1581
1653
|
* network; a wrong one is `401 SANDBOX_CLOCK_UNAUTHORIZED` (`err.isSandboxClockUnauthorized`).
|
|
1582
1654
|
* None of these calls is auto-retried: each one moves the clock or runs the engine.
|
|
1583
1655
|
*/
|
|
@@ -1931,6 +2003,45 @@ declare class InvoServer {
|
|
|
1931
2003
|
* detects the authorized transaction and credits, on a delay.
|
|
1932
2004
|
*/
|
|
1933
2005
|
steamFinalizePurchase(input: SteamFinalizeInput, opts?: CallOptions): Promise<SteamFinalizeResult>;
|
|
2006
|
+
/**
|
|
2007
|
+
* The App Store products registered for this game, and whether INVO will sell each one
|
|
2008
|
+
* right now. Call it with the game's iOS key **before every purchase** and offer only
|
|
2009
|
+
* products with `available: true`: Apple charges the player before INVO sees the
|
|
2010
|
+
* purchase, so this is the only point where INVO can say no. Ask StoreKit for exactly the
|
|
2011
|
+
* `productId`s listed.
|
|
2012
|
+
*
|
|
2013
|
+
* `unavailableReason` (per product, and for the whole game when `canSell` is `false`):
|
|
2014
|
+
* `APPLE_NOT_VERIFIED`, `PARTNER_BILLING_NOT_SET_UP`, `PARTNER_RAIL_SUSPENDED`,
|
|
2015
|
+
* `PARTNER_CREDIT_UNAVAILABLE`.
|
|
2016
|
+
*
|
|
2017
|
+
* Refusals: `err.isAppleNotConfigured` (409, no Apple configuration or turned off),
|
|
2018
|
+
* `err.isRailChannelMismatch` (409, the key is not an iOS key on the Apple rail).
|
|
2019
|
+
*/
|
|
2020
|
+
appleProducts(opts?: CallOptions): Promise<AppleProductsResult>;
|
|
2021
|
+
/**
|
|
2022
|
+
* Verify a StoreKit 2 transaction and credit its coins, once. Call it from your game
|
|
2023
|
+
* SERVER, never the device, after StoreKit returns a verified transaction, with the
|
|
2024
|
+
* game's iOS key. Send `Transaction.jwsRepresentation` unchanged as `signedTransaction`.
|
|
2025
|
+
*
|
|
2026
|
+
* Then decide `Transaction.finish()` with {@link shouldFinishAppleTransaction}, passing
|
|
2027
|
+
* the result or the thrown error. It reads INVO's `finish` flag, which every answer carries
|
|
2028
|
+
* (`result.finish`, `err.finish`): `true` for `credited`, `already_credited` and the terminal
|
|
2029
|
+
* errors `isAppleTransactionRevoked`, `isAppleTransactionAlreadyUsed` and
|
|
2030
|
+
* `isAppleTransactionTooOld`. On anything else leave the transaction unfinished and
|
|
2031
|
+
* retry: StoreKit redelivers it, and a retry with the same signed transaction never credits
|
|
2032
|
+
* twice (a replay answers `already_credited`, with `balance` `null` unless you name the
|
|
2033
|
+
* same player). Safe to auto-retry for the same reason.
|
|
2034
|
+
*
|
|
2035
|
+
* Refusals: `isAppleSignatureInvalid`, `isAppleBundleMismatch`,
|
|
2036
|
+
* `isAppleEnvironmentNotAllowed`, `isAppleProductTypeUnsupported`, `isAppleProductUnknown`,
|
|
2037
|
+
* `isInvalidMetadata` / `isInvalidInput` (400); `isAppleReviewAccountRequired` (403);
|
|
2038
|
+
* `isAppleTransactionRevoked`, `isAppleTransactionAlreadyUsed`, `isAppleTransactionTooOld`,
|
|
2039
|
+
* `isAppleValueExceedsPrice`, `isAppleAccountTokenMismatch`, `isAppleNotConfigured`,
|
|
2040
|
+
* `isAppleNotVerified`, `isRailChannelMismatch` (409); `isAppleReviewPurchaseLimit` (429);
|
|
2041
|
+
* `isAppleCreditPending` (503, verified and held: retry; also while payments are paused);
|
|
2042
|
+
* and the usual game-key refusals, which carry no `finish` (treated as not finished).
|
|
2043
|
+
*/
|
|
2044
|
+
verifyApplePurchase(input: VerifyApplePurchaseInput, opts?: CallOptions): Promise<ApplePurchaseResult>;
|
|
1934
2045
|
/**
|
|
1935
2046
|
* Buy an in-game item by SPENDING the player's existing game currency (§4.8).
|
|
1936
2047
|
* No real money, no payment rail, no passkey — it's a balance debit, authenticated
|
|
@@ -2248,4 +2359,4 @@ declare class InvoServer {
|
|
|
2248
2359
|
private toInitiateResult;
|
|
2249
2360
|
}
|
|
2250
2361
|
|
|
2251
|
-
export { type
|
|
2362
|
+
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 };
|