@invonetwork/web-sdk 3.17.0 → 3.19.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 +31 -0
- package/README.md +68 -41
- package/dist/{chunk-JGDNPNQX.js → chunk-YW2PYARQ.js} +60 -12
- package/dist/index.cjs +58 -10
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/server.cjs +150 -32
- package/dist/server.d.cts +172 -31
- package/dist/server.d.ts +172 -31
- package/dist/server.js +94 -24
- package/dist/{types-CjJARoLk.d.cts → types-CCqgVhzf.d.cts} +235 -52
- package/dist/{types-CjJARoLk.d.ts → types-CCqgVhzf.d.ts} +235 -52
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as ApproveResult, C as ConfirmReceiptResult, P as PurchaseStatusResult, a as PurchaseCredited, b as PurchaseExpired, c as PurchaseRefunded, d as PurchaseRefused, e as CheckoutClientConfig, H as Http, f as PurchaseStatusInput, g as CallOptions, W as WaitForPurchaseInput, M as MountCheckoutOptions, h as CheckoutMountHandle, i as ClientConfig, L as LinkDeviceResult, j as PendingCollectResult, D as DestinationsQuery, k as DestinationsResult, B as BalanceResult, E as EnrollmentBeginResult, l as EnrollmentVerifyResult, R as RecoveryBeginResult, m as RecoveryCompleteResult } from './types-
|
|
2
|
-
export { n as BalanceRow, o as CheckoutPurchaseStatus, p as DestinationGame, I as InvoError, q as InvoErrorInfo, r as InvoHooks, s as InvoRequestInfo, t as InvoResponseInfo, u as PendingCollectItem, v as PurchaseRefusalReason, w as Rail, V as VerificationMethod } from './types-
|
|
1
|
+
import { A as ApproveResult, C as ConfirmReceiptResult, P as PurchaseStatusResult, a as PurchaseCredited, b as PurchaseExpired, c as PurchaseRefunded, d as PurchaseRefused, e as CheckoutClientConfig, H as Http, f as PurchaseStatusInput, g as CallOptions, W as WaitForPurchaseInput, M as MountCheckoutOptions, h as CheckoutMountHandle, i as ClientConfig, L as LinkDeviceResult, j as PendingCollectResult, D as DestinationsQuery, k as DestinationsResult, B as BalanceResult, E as EnrollmentBeginResult, l as EnrollmentVerifyResult, R as RecoveryBeginResult, m as RecoveryCompleteResult } from './types-CCqgVhzf.cjs';
|
|
2
|
+
export { n as BalanceRow, o as CheckoutPurchaseStatus, p as DestinationGame, I as InvoError, q as InvoErrorInfo, r as InvoHooks, s as InvoRequestInfo, t as InvoResponseInfo, u as PendingCollectItem, v as PurchaseRefusalReason, w as Rail, V as VerificationMethod } from './types-CCqgVhzf.cjs';
|
|
3
3
|
|
|
4
4
|
/** The four device-approval flows (`begin.flow`). */
|
|
5
5
|
type HostedFlow = "transfer" | "send" | "send_receipt" | "transfer_receipt";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as ApproveResult, C as ConfirmReceiptResult, P as PurchaseStatusResult, a as PurchaseCredited, b as PurchaseExpired, c as PurchaseRefunded, d as PurchaseRefused, e as CheckoutClientConfig, H as Http, f as PurchaseStatusInput, g as CallOptions, W as WaitForPurchaseInput, M as MountCheckoutOptions, h as CheckoutMountHandle, i as ClientConfig, L as LinkDeviceResult, j as PendingCollectResult, D as DestinationsQuery, k as DestinationsResult, B as BalanceResult, E as EnrollmentBeginResult, l as EnrollmentVerifyResult, R as RecoveryBeginResult, m as RecoveryCompleteResult } from './types-
|
|
2
|
-
export { n as BalanceRow, o as CheckoutPurchaseStatus, p as DestinationGame, I as InvoError, q as InvoErrorInfo, r as InvoHooks, s as InvoRequestInfo, t as InvoResponseInfo, u as PendingCollectItem, v as PurchaseRefusalReason, w as Rail, V as VerificationMethod } from './types-
|
|
1
|
+
import { A as ApproveResult, C as ConfirmReceiptResult, P as PurchaseStatusResult, a as PurchaseCredited, b as PurchaseExpired, c as PurchaseRefunded, d as PurchaseRefused, e as CheckoutClientConfig, H as Http, f as PurchaseStatusInput, g as CallOptions, W as WaitForPurchaseInput, M as MountCheckoutOptions, h as CheckoutMountHandle, i as ClientConfig, L as LinkDeviceResult, j as PendingCollectResult, D as DestinationsQuery, k as DestinationsResult, B as BalanceResult, E as EnrollmentBeginResult, l as EnrollmentVerifyResult, R as RecoveryBeginResult, m as RecoveryCompleteResult } from './types-CCqgVhzf.js';
|
|
2
|
+
export { n as BalanceRow, o as CheckoutPurchaseStatus, p as DestinationGame, I as InvoError, q as InvoErrorInfo, r as InvoHooks, s as InvoRequestInfo, t as InvoResponseInfo, u as PendingCollectItem, v as PurchaseRefusalReason, w as Rail, V as VerificationMethod } from './types-CCqgVhzf.js';
|
|
3
3
|
|
|
4
4
|
/** The four device-approval flows (`begin.flow`). */
|
|
5
5
|
type HostedFlow = "transfer" | "send" | "send_receipt" | "transfer_receipt";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InvoError, assertSecureBaseUrl, Http, toDestinationsResult, receiptFields } from './chunk-
|
|
2
|
-
export { InvoError } from './chunk-
|
|
1
|
+
import { InvoError, assertSecureBaseUrl, Http, toDestinationsResult, receiptFields } from './chunk-YW2PYARQ.js';
|
|
2
|
+
export { InvoError } from './chunk-YW2PYARQ.js';
|
|
3
3
|
|
|
4
4
|
// src/shared/webauthn.ts
|
|
5
5
|
function malformedOptions(field) {
|
package/dist/server.cjs
CHANGED
|
@@ -379,11 +379,38 @@ var InvoError = class _InvoError extends Error {
|
|
|
379
379
|
const st = String(b["steam_status"] ?? "").toLowerCase();
|
|
380
380
|
return st !== "init" && st !== "";
|
|
381
381
|
}
|
|
382
|
-
/**
|
|
383
|
-
*
|
|
382
|
+
/**
|
|
383
|
+
* True if a CARD purchase was below the card minimum (`BELOW_CARD_MINIMUM`, 400). Nothing
|
|
384
|
+
* was charged. Two floors answer with this code:
|
|
385
|
+
* - INVO's minimum card purchase, $2.99 by default, on coin purchases and Platform Commerce
|
|
386
|
+
* card sales (not subscriptions), enforced from 2026-10-27. Until that date a smaller
|
|
387
|
+
* purchase is accepted and the response carries `minPurchaseWarning` instead.
|
|
388
|
+
* {@link minUsd} and {@link enforcedFrom} carry the figures in force; the amount and the
|
|
389
|
+
* date are INVO settings, so read them from the error rather than hard-coding them.
|
|
390
|
+
* - the card rail's own floor of $0.50, at any date, on coin purchases (the direct route and
|
|
391
|
+
* hosted checkout session create, complete and create-intent) and Platform Commerce card
|
|
392
|
+
* purchases ({@link minUsd} reads `"0.50"` there, with no {@link enforcedFrom}).
|
|
393
|
+
* {@link minUsd} tells you which floor refused it.
|
|
394
|
+
*
|
|
395
|
+
* Card purchases only; purchases through a third-party storefront or payment rail are
|
|
396
|
+
* unaffected. Raise the amount; do not retry it unchanged.
|
|
397
|
+
*/
|
|
384
398
|
get isBelowCardMinimum() {
|
|
385
399
|
return this.code === "BELOW_CARD_MINIMUM" || this.rawCode === "BELOW_STRIPE_MINIMUM";
|
|
386
400
|
}
|
|
401
|
+
/** On `BELOW_CARD_MINIMUM`: the minimum card purchase in force (`min_usd`), USD decimal
|
|
402
|
+
* string, for example `"2.99"`. `undefined` when the body does not carry it. */
|
|
403
|
+
get minUsd() {
|
|
404
|
+
const v = this.bodyObject()["min_usd"];
|
|
405
|
+
if (typeof v === "number" && Number.isFinite(v)) return v.toFixed(2);
|
|
406
|
+
return typeof v === "string" && v ? v : void 0;
|
|
407
|
+
}
|
|
408
|
+
/** On `BELOW_CARD_MINIMUM`: the date INVO started enforcing the minimum card purchase
|
|
409
|
+
* (`enforced_from`), ISO 8601, for example `"2026-10-27"`. `undefined` when absent. */
|
|
410
|
+
get enforcedFrom() {
|
|
411
|
+
const v = this.bodyObject()["enforced_from"];
|
|
412
|
+
return typeof v === "string" && v ? v : void 0;
|
|
413
|
+
}
|
|
387
414
|
/** True if a CARD purchase exceeded INVO's maximum single card charge
|
|
388
415
|
* (`ABOVE_CARD_MAXIMUM`, 400) — split the sale or lower the amount. Do not retry it
|
|
389
416
|
* unchanged; nothing was charged.
|
|
@@ -398,18 +425,22 @@ var InvoError = class _InvoError extends Error {
|
|
|
398
425
|
}
|
|
399
426
|
// ---- Coin purchase: INVO's card fee (2026-09-23) ----
|
|
400
427
|
/**
|
|
401
|
-
* True when an UNACKNOWLEDGED `purchaseCurrency` was refused because the amount
|
|
402
|
-
* small to carry INVO's card fee (`AMOUNT_BELOW_FEE`, 400). Nothing was charged.
|
|
403
|
-
*
|
|
404
|
-
*
|
|
428
|
+
* True when an UNACKNOWLEDGED `purchaseCurrency` was refused because the amount was too
|
|
429
|
+
* small to carry INVO's card fee (`AMOUNT_BELOW_FEE`, 400). Nothing was charged.
|
|
430
|
+
*
|
|
431
|
+
* @deprecated No longer returned: under the 2026-09 pricing the partner pays the card fee,
|
|
432
|
+
* so it is never in the buyer's charge. Kept so existing code still compiles; a small card
|
|
433
|
+
* purchase now answers `BELOW_CARD_MINIMUM` ({@link isBelowCardMinimum}).
|
|
405
434
|
*/
|
|
406
435
|
get isAmountBelowFee() {
|
|
407
436
|
return this.code === "AMOUNT_BELOW_FEE";
|
|
408
437
|
}
|
|
409
438
|
/**
|
|
410
|
-
* True when `purchaseCurrency` was sent an `acknowledgedTotalUsd`
|
|
411
|
-
*
|
|
412
|
-
*
|
|
439
|
+
* True when `purchaseCurrency` was sent an `acknowledgedTotalUsd` BELOW the total INVO would
|
|
440
|
+
* charge now (`QUOTE_STALE`, 409). Nothing was charged. Quote again, show the player the new
|
|
441
|
+
* total, and retry with it. {@link expectedTotalUsd} carries INVO's figure. A higher
|
|
442
|
+
* acknowledged total (for example an older fee-inclusive one) is not refused: INVO charges
|
|
443
|
+
* the true, lower total.
|
|
413
444
|
*/
|
|
414
445
|
get isQuoteStale() {
|
|
415
446
|
return this.code === "QUOTE_STALE";
|
|
@@ -419,11 +450,28 @@ var InvoError = class _InvoError extends Error {
|
|
|
419
450
|
const v = this.bodyObject()["expected_total_usd"];
|
|
420
451
|
return typeof v === "string" && v ? v : void 0;
|
|
421
452
|
}
|
|
422
|
-
/** On `QUOTE_STALE`: the total you sent, as INVO read it
|
|
453
|
+
/** On `QUOTE_STALE` or `TAX_PLACE_UNAVAILABLE`: the total you sent, as INVO read it
|
|
454
|
+
* (`acknowledged_total_usd`). */
|
|
423
455
|
get acknowledgedTotalUsd() {
|
|
424
456
|
const v = this.bodyObject()["acknowledged_total_usd"];
|
|
425
457
|
return typeof v === "string" && v ? v : void 0;
|
|
426
458
|
}
|
|
459
|
+
/**
|
|
460
|
+
* True when a Merchant of Record `purchaseCurrency` acknowledged a taxed total but INVO could
|
|
461
|
+
* not read the buyer's tax location from the card on this attempt, and the request carried no
|
|
462
|
+
* `country` to fall back on (`TAX_PLACE_UNAVAILABLE`, 409). Nothing was charged. Retry the
|
|
463
|
+
* purchase (a fresh attempt usually reads the card), or send the `country` (and
|
|
464
|
+
* `subdivision`) you quoted with. INVO never drops the tax a buyer was shown, so it refuses
|
|
465
|
+
* rather than charging a different figure. The body carries `retryable: true`.
|
|
466
|
+
*/
|
|
467
|
+
get isTaxPlaceUnavailable() {
|
|
468
|
+
return this.code === "TAX_PLACE_UNAVAILABLE";
|
|
469
|
+
}
|
|
470
|
+
/** On `TAX_PLACE_UNAVAILABLE`: the total without tax (`untaxed_total_usd`), decimal string. */
|
|
471
|
+
get untaxedTotalUsd() {
|
|
472
|
+
const v = this.bodyObject()["untaxed_total_usd"];
|
|
473
|
+
return typeof v === "string" && v ? v : void 0;
|
|
474
|
+
}
|
|
427
475
|
/**
|
|
428
476
|
* True if a Platform Commerce refund targeted an order that was already refunded
|
|
429
477
|
* (409). Idempotent outcome — the original refund did happen, so treat this as
|
|
@@ -1138,7 +1186,7 @@ function receiptFields(raw) {
|
|
|
1138
1186
|
}
|
|
1139
1187
|
|
|
1140
1188
|
// src/version.ts
|
|
1141
|
-
var SDK_VERSION = "3.
|
|
1189
|
+
var SDK_VERSION = "3.19.0";
|
|
1142
1190
|
|
|
1143
1191
|
// src/shared/types.ts
|
|
1144
1192
|
function isRefundPendingApproval(r) {
|
|
@@ -1319,6 +1367,32 @@ function assertAcknowledgedTotal(value) {
|
|
|
1319
1367
|
function optionalDecimalString(v) {
|
|
1320
1368
|
return v == null ? void 0 : String(v);
|
|
1321
1369
|
}
|
|
1370
|
+
function nullableDecimalString(raw, fallback, key) {
|
|
1371
|
+
for (const src of [raw, fallback]) {
|
|
1372
|
+
if (Object.prototype.hasOwnProperty.call(src, key)) {
|
|
1373
|
+
const v = src[key];
|
|
1374
|
+
if (v === null) return null;
|
|
1375
|
+
if (v !== void 0) return String(v);
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
return void 0;
|
|
1379
|
+
}
|
|
1380
|
+
function toMinPurchaseWarning(v) {
|
|
1381
|
+
if (!v || typeof v !== "object" || Array.isArray(v)) return void 0;
|
|
1382
|
+
const r = v;
|
|
1383
|
+
return {
|
|
1384
|
+
code: String(r["code"] ?? ""),
|
|
1385
|
+
minUsd: r["min_usd"] == null ? "" : String(r["min_usd"]),
|
|
1386
|
+
enforcedFrom: r["enforced_from"] == null ? "" : String(r["enforced_from"]),
|
|
1387
|
+
...typeof r["message"] === "string" && r["message"] ? { message: r["message"] } : {},
|
|
1388
|
+
...typeof r["enforced"] === "boolean" ? { enforced: r["enforced"] } : {},
|
|
1389
|
+
raw: r
|
|
1390
|
+
};
|
|
1391
|
+
}
|
|
1392
|
+
function minPurchaseWarningField(raw) {
|
|
1393
|
+
const w = toMinPurchaseWarning(raw["min_purchase_warning"]);
|
|
1394
|
+
return w === void 0 ? {} : { minPurchaseWarning: w };
|
|
1395
|
+
}
|
|
1322
1396
|
function toQuoteBreakdown(row) {
|
|
1323
1397
|
const r = row && typeof row === "object" ? row : {};
|
|
1324
1398
|
const nullable = (v) => v == null ? null : String(v);
|
|
@@ -1337,16 +1411,22 @@ function toQuoteBreakdown(row) {
|
|
|
1337
1411
|
raw: r
|
|
1338
1412
|
};
|
|
1339
1413
|
}
|
|
1340
|
-
function toUnacknowledgedOutcome(row) {
|
|
1414
|
+
function toUnacknowledgedOutcome(row, quote = {}) {
|
|
1341
1415
|
if (!row || typeof row !== "object") return null;
|
|
1342
1416
|
const r = row;
|
|
1343
1417
|
return {
|
|
1344
1418
|
chargeTotalUsd: String(r["charge_total_usd"] ?? ""),
|
|
1345
1419
|
processingFeeUsd: String(r["processing_fee_usd"] ?? ""),
|
|
1346
1420
|
coins: String(r["coins"] ?? ""),
|
|
1347
|
-
feeTakenFrom: String(r["fee_taken_from"] ??
|
|
1421
|
+
feeTakenFrom: String(r["fee_taken_from"] ?? unacknowledgedFeeFallback(r, quote)),
|
|
1422
|
+
...Object.prototype.hasOwnProperty.call(r, "partner_fee_usd") ? { partnerFeeUsd: r["partner_fee_usd"] == null ? null : String(r["partner_fee_usd"]) } : {}
|
|
1348
1423
|
};
|
|
1349
1424
|
}
|
|
1425
|
+
function unacknowledgedFeeFallback(row, quote) {
|
|
1426
|
+
const breakdown = quote["breakdown"];
|
|
1427
|
+
const hasPartnerFee = row["partner_fee_usd"] != null || quote["partner_fee_usd"] != null || !!breakdown && typeof breakdown === "object" && breakdown["partner_fee_usd"] != null;
|
|
1428
|
+
return hasPartnerFee ? "partner" : "coins";
|
|
1429
|
+
}
|
|
1350
1430
|
function toCurrencyPurchaseQuote(raw) {
|
|
1351
1431
|
const breakdown = toQuoteBreakdown(raw["breakdown"]);
|
|
1352
1432
|
return {
|
|
@@ -1358,10 +1438,22 @@ function toCurrencyPurchaseQuote(raw) {
|
|
|
1358
1438
|
coins: String(raw["coins"] ?? breakdown.coins),
|
|
1359
1439
|
currencyName: String(raw["currency_name"] ?? breakdown.currencyName),
|
|
1360
1440
|
breakdown,
|
|
1361
|
-
|
|
1441
|
+
...raw["fee_taken_from"] != null ? { feeTakenFrom: String(raw["fee_taken_from"]) } : {},
|
|
1442
|
+
ifUnacknowledged: toUnacknowledgedOutcome(raw["if_unacknowledged"], raw),
|
|
1443
|
+
...pricingFields(raw, breakdown.raw),
|
|
1362
1444
|
raw
|
|
1363
1445
|
};
|
|
1364
1446
|
}
|
|
1447
|
+
function pricingFields(raw, fallback = {}) {
|
|
1448
|
+
const out = {};
|
|
1449
|
+
const partnerFee = nullableDecimalString(raw, fallback, "partner_fee_usd");
|
|
1450
|
+
if (partnerFee !== void 0) out.partnerFeeUsd = partnerFee;
|
|
1451
|
+
const intlFee = nullableDecimalString(raw, fallback, "international_card_fee_usd");
|
|
1452
|
+
if (intlFee !== void 0) out.internationalCardFeeUsd = intlFee;
|
|
1453
|
+
const warning = toMinPurchaseWarning(raw["min_purchase_warning"] ?? fallback["min_purchase_warning"]);
|
|
1454
|
+
if (warning !== void 0) out.minPurchaseWarning = warning;
|
|
1455
|
+
return out;
|
|
1456
|
+
}
|
|
1365
1457
|
function invalidInput(label, value, why) {
|
|
1366
1458
|
return new InvoError({
|
|
1367
1459
|
message: `${label} ${why} (got ${JSON.stringify(value)}).`,
|
|
@@ -1775,6 +1867,7 @@ var PlatformCommerceServer = class {
|
|
|
1775
1867
|
expiresAt: typeof expiresAtRaw === "number" ? expiresAtRaw : void 0,
|
|
1776
1868
|
amountUsd: raw["amount_usd"] ?? null,
|
|
1777
1869
|
idempotentReplay: raw["idempotent_replay"] === true,
|
|
1870
|
+
...minPurchaseWarningField(raw),
|
|
1778
1871
|
raw
|
|
1779
1872
|
};
|
|
1780
1873
|
}
|
|
@@ -1853,6 +1946,9 @@ var PlatformCommerceServer = class {
|
|
|
1853
1946
|
...raw["refunded_total_usd"] != null ? { refundedTotalUsd: String(raw["refunded_total_usd"]) } : {},
|
|
1854
1947
|
...raw["charge_total_usd"] != null ? { chargeTotalUsd: String(raw["charge_total_usd"]) } : {},
|
|
1855
1948
|
...raw["remaining_usd"] != null ? { remainingUsd: String(raw["remaining_usd"]) } : {},
|
|
1949
|
+
// 2026-09 pricing, card leg only: the card fee stays charged to the partner on a refund.
|
|
1950
|
+
...raw["card_fee_charged_to_partner_usd"] != null ? { cardFeeChargedToPartnerUsd: String(raw["card_fee_charged_to_partner_usd"]) } : {},
|
|
1951
|
+
...raw["partner_debited_usd"] != null ? { partnerDebitedUsd: String(raw["partner_debited_usd"]) } : {},
|
|
1856
1952
|
raw
|
|
1857
1953
|
};
|
|
1858
1954
|
}
|
|
@@ -1955,6 +2051,9 @@ function toRefundResult(raw, subscriptionId, clientRequestId) {
|
|
|
1955
2051
|
processingFeeBorneBy: optionalString(raw, "processing_fee_borne_by"),
|
|
1956
2052
|
processingFeeTransactionId: optionalString(raw, "processing_fee_transaction_id"),
|
|
1957
2053
|
partnerTotalReversedUsd: optionalString(raw, "partner_total_reversed_usd"),
|
|
2054
|
+
// ---- additive (2026-09-28, D-PRICE-012): undefined on a receipt stored before it ----
|
|
2055
|
+
cardFeeChargedToPartnerUsd: optionalString(raw, "card_fee_charged_to_partner_usd"),
|
|
2056
|
+
partnerDebitedUsd: optionalString(raw, "partner_debited_usd"),
|
|
1958
2057
|
initiation: optionalString(raw, "initiation"),
|
|
1959
2058
|
refundRequestId: optionalString(raw, "refund_request_id"),
|
|
1960
2059
|
raw
|
|
@@ -2481,7 +2580,9 @@ var SubscriptionsServer = class {
|
|
|
2481
2580
|
* and reclaims the coins it minted (`balanceDeltaCoins` is signed), a partial refund
|
|
2482
2581
|
* credits coins. Your revenue is reversed for the refunded portion
|
|
2483
2582
|
* (`partnerRevenueReversedUsd`), INVO's fee is retained, and on a card refund you bear the
|
|
2484
|
-
*
|
|
2583
|
+
* whole refunded amount, INVO's card fee included (`cardFeeChargedToPartnerUsd`;
|
|
2584
|
+
* `partnerDebitedUsd` is the sum; since 2026-09-28, with no separate processor fee:
|
|
2585
|
+
* `processingFeeUsd` reads `"0.00"`). **A full refund
|
|
2485
2586
|
* cancels the subscription** (`subscriptionCanceled`, and a `subscription.canceled` event
|
|
2486
2587
|
* with `cancel_cause: "full_refund"`, sent together with `subscription.refunded` in any
|
|
2487
2588
|
* order); a partial one does not. INVO emails the member.
|
|
@@ -3054,6 +3155,7 @@ var InvoServer = class {
|
|
|
3054
3155
|
// the purchase status later does not have to parse a URL itself.
|
|
3055
3156
|
sessionToken: sessionTokenFromCreateCheckout(raw, checkoutUrl),
|
|
3056
3157
|
warnings: toCheckoutWarnings(raw["warnings"]),
|
|
3158
|
+
...minPurchaseWarningField(raw),
|
|
3057
3159
|
raw
|
|
3058
3160
|
};
|
|
3059
3161
|
}
|
|
@@ -3064,17 +3166,27 @@ var InvoServer = class {
|
|
|
3064
3166
|
* - rail "game": returns status "pending_payment" + paymentUrl (redirect the browser).
|
|
3065
3167
|
* - rail "steam": NOT a browser flow — the backend returns WRONG_RAIL_ENDPOINT.
|
|
3066
3168
|
*
|
|
3067
|
-
* INVO's card fee (
|
|
3068
|
-
*
|
|
3169
|
+
* INVO's card fee (4.5% + $0.30 on Open, 5.5% + $0.50 on Merchant of Record, plus 1.5% of
|
|
3170
|
+
* the listed price (before tax) on a card issued outside the US) is charged to you, the partner. The player
|
|
3171
|
+
* pays the listed price (plus any tax) and receives the listed coins. Card purchases only;
|
|
3172
|
+
* purchases through a third-party storefront or payment rail are unaffected. Two shapes,
|
|
3173
|
+
* chosen by what you send:
|
|
3069
3174
|
* - with `acknowledgedTotalUsd` (the `totalUsd` from {@link quoteCurrencyPurchase}): the
|
|
3070
|
-
* card is charged that total and the coins are priced off `usdAmount`.
|
|
3071
|
-
*
|
|
3072
|
-
*
|
|
3073
|
-
*
|
|
3074
|
-
*
|
|
3175
|
+
* card is never charged more than that total, and the coins are priced off `usdAmount`.
|
|
3176
|
+
* An older, higher fee-inclusive total is accepted and the true, lower total charged. A
|
|
3177
|
+
* total below what INVO would charge now throws `409 QUOTE_STALE` (`err.isQuoteStale`);
|
|
3178
|
+
* nothing was charged.
|
|
3179
|
+
* - without it: the card is charged exactly `usdAmount`, never more.
|
|
3075
3180
|
*
|
|
3076
|
-
*
|
|
3077
|
-
* `
|
|
3181
|
+
* From 2026-10-27 a card purchase under INVO's minimum card purchase ($2.99) throws
|
|
3182
|
+
* `400 BELOW_CARD_MINIMUM` (`err.isBelowCardMinimum`, `err.minUsd`, `err.enforcedFrom`);
|
|
3183
|
+
* until then it is accepted with `minPurchaseWarning`. `AMOUNT_BELOW_FEE` is no longer
|
|
3184
|
+
* returned.
|
|
3185
|
+
*
|
|
3186
|
+
* A `success` result reports `processingFeeUsd` (`"0.00"`), `feeTakenFrom` (`"partner"`),
|
|
3187
|
+
* `partnerFeeUsd`, `internationalCardFeeUsd` (`"0.00"` on a US card or one whose country
|
|
3188
|
+
* is unknown; both `null` if the fee could not be booked yet, which INVO does shortly after),
|
|
3189
|
+
* `coinsCredited` and `chargeTotalUsd`, each as INVO sent it.
|
|
3078
3190
|
*/
|
|
3079
3191
|
async purchaseCurrency(input, opts) {
|
|
3080
3192
|
if (typeof input.playerEmail !== "string" || !input.playerEmail.trim()) {
|
|
@@ -3110,6 +3222,8 @@ var InvoServer = class {
|
|
|
3110
3222
|
if (input.playerName) body["player_name"] = input.playerName;
|
|
3111
3223
|
if (input.playerPhone) body["player_phone"] = input.playerPhone;
|
|
3112
3224
|
if (input.metadata) body["metadata"] = input.metadata;
|
|
3225
|
+
if (input.country) body["country"] = input.country;
|
|
3226
|
+
if (input.subdivision) body["subdivision"] = input.subdivision;
|
|
3113
3227
|
const raw = await this.http.post(
|
|
3114
3228
|
"/api/currency-purchases/purchase-currency",
|
|
3115
3229
|
body,
|
|
@@ -3129,6 +3243,7 @@ var InvoServer = class {
|
|
|
3129
3243
|
feeTakenFrom: optionalDecimalString(raw["fee_taken_from"]),
|
|
3130
3244
|
coinsCredited: optionalDecimalString(raw["coins_credited"]),
|
|
3131
3245
|
chargeTotalUsd: optionalDecimalString(raw["charge_total_usd"]),
|
|
3246
|
+
...pricingFields(raw),
|
|
3132
3247
|
...receiptFields(raw),
|
|
3133
3248
|
raw
|
|
3134
3249
|
};
|
|
@@ -3138,14 +3253,17 @@ var InvoServer = class {
|
|
|
3138
3253
|
* creates nothing, so it is safe to call on every price render (`POST
|
|
3139
3254
|
* /api/currency-purchases/quote`, authenticated by your game secret like the purchase).
|
|
3140
3255
|
*
|
|
3141
|
-
*
|
|
3142
|
-
*
|
|
3143
|
-
*
|
|
3144
|
-
*
|
|
3145
|
-
*
|
|
3146
|
-
*
|
|
3147
|
-
*
|
|
3148
|
-
*
|
|
3256
|
+
* The player pays the listed price plus any tax (when you pass `country`) and receives the
|
|
3257
|
+
* listed coins: `totalUsd` carries no card fee, and `processingFeeUsd` is `"0.00"`. INVO's
|
|
3258
|
+
* card fee (4.5% + $0.30 on Open, 5.5% + $0.50 on Merchant of Record) is charged to you;
|
|
3259
|
+
* `partnerFeeUsd` carries it when INVO sends it. $10.00 quotes a $10.00 total, 100.00 coins
|
|
3260
|
+
* at the default 10 per USD, and a $0.75 partner fee on Open. Show the player `totalUsd`,
|
|
3261
|
+
* then send the same figure back as `acknowledgedTotalUsd` on {@link purchaseCurrency}; the
|
|
3262
|
+
* card is never charged more than that. `ifUnacknowledged` shows the purchase without the
|
|
3263
|
+
* acknowledgement (the card charged exactly `usdAmount`), or `null` when INVO sends none.
|
|
3264
|
+
* `minPurchaseWarning` is set while an amount under INVO's minimum card purchase is still
|
|
3265
|
+
* accepted. Card purchases only; purchases through a third-party storefront or payment
|
|
3266
|
+
* rail are unaffected.
|
|
3149
3267
|
*
|
|
3150
3268
|
* Refusals: `400 INVALID_INPUT` (amount missing, not above zero, or above INVO's card
|
|
3151
3269
|
* maximum), `400 CURRENCY_NOT_CONFIGURED`, `503 RATE_UNAVAILABLE`.
|