@invonetwork/web-sdk 3.17.0 → 3.18.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 +18 -0
- package/README.md +59 -35
- 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 +143 -30
- package/dist/server.d.cts +131 -24
- package/dist/server.d.ts +131 -24
- package/dist/server.js +87 -22
- package/dist/{types-CjJARoLk.d.cts → types-BnnVi5ws.d.cts} +210 -48
- package/dist/{types-CjJARoLk.d.ts → types-BnnVi5ws.d.ts} +210 -48
- package/package.json +1 -1
package/dist/server.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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 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,
|
|
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-BnnVi5ws.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 MinPurchaseWarning, bk as PlatformPurchaseStatus, w as Rail, bl as RefundInitiation, bm as RefundPendingApproval, bn as RefundProcessingFeeBasis, bo as RefundReceipt, bp as RefundRevenueShareAttribution, bq as RefundWarning, br as SandboxClockState, bs as SavedCard, bt as SteamPack, bu as SteamUserSession, bv as Subscription, bw as SubscriptionBaseInput, bx as SubscriptionConsent, by as SubscriptionConsentInput, bz as SubscriptionFundingRail, bA as SubscriptionInterval, bB as SubscriptionRevenueShare, bC as SubscriptionRevenueShareInput, bD as SubscriptionStatus, bE as UnacknowledgedPurchaseOutcome, V as VerificationMethod, bF as isRefundPendingApproval } from './types-BnnVi5ws.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The package version, as sent in the server User-Agent. A test pins this to
|
|
@@ -65,6 +65,23 @@ interface PurchaseCompletedData {
|
|
|
65
65
|
receipt_number?: string;
|
|
66
66
|
/** Merchant of Record only: link to the printable receipt page. Anyone with it can read it. */
|
|
67
67
|
receipt_url?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Additive (2026-09 pricing). INVO's card fee charged to you for this purchase, USD decimal
|
|
70
|
+
* string: 4.5% + $0.30 on Open, 5.5% + $0.50 on Merchant of Record. The buyer paid the listed
|
|
71
|
+
* price (plus any tax) and received the listed coins; the fee nets against your earnings.
|
|
72
|
+
* Card purchases only; absent on purchases through a third-party storefront or payment rail,
|
|
73
|
+
* on an order charged before the 2026-09 pricing, and from backends that do not send it.
|
|
74
|
+
* `null` when the fee could not be booked when the purchase completed (the purchase itself
|
|
75
|
+
* succeeded; INVO books the fee shortly after).
|
|
76
|
+
*/
|
|
77
|
+
partner_fee_usd?: string | null;
|
|
78
|
+
/**
|
|
79
|
+
* Additive (2026-09 pricing). The international card fee charged to you, USD decimal string:
|
|
80
|
+
* 1.5% of the listed price (before tax) on a card issued outside the US, `"0.00"` otherwise
|
|
81
|
+
* (a card whose country is unknown counts as domestic). Separate from `partner_fee_usd`.
|
|
82
|
+
* Card purchases only; absent and `null` on the same terms as `partner_fee_usd`.
|
|
83
|
+
*/
|
|
84
|
+
international_card_fee_usd?: string | null;
|
|
68
85
|
[key: string]: unknown;
|
|
69
86
|
}
|
|
70
87
|
interface PurchaseEventData {
|
|
@@ -74,6 +91,37 @@ interface PurchaseEventData {
|
|
|
74
91
|
identity_id?: string;
|
|
75
92
|
/** Present on purchase.disputed, e.g. "lost". */
|
|
76
93
|
dispute_status?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Additive (2026-09 pricing), on a LOST purchase.disputed for a Platform Commerce card sale
|
|
96
|
+
* or a subscription charge (`order_type` `"platform_commerce"` or `"subscription_renewal"`).
|
|
97
|
+
* `true` when INVO's chargeback guarantee covers this dispute: a fraud chargeback on a card
|
|
98
|
+
* sale, which INVO absorbs, so your share is not reversed or held and no dispute fee is passed
|
|
99
|
+
* to you. `false` for any other dispute, handled as before. Never sent on a coin purchase
|
|
100
|
+
* dispute (a lost coin chargeback takes back the player's coins, not your share, so there is
|
|
101
|
+
* nothing to cover), nor on an opened or won event. Do not read absence as either value.
|
|
102
|
+
*/
|
|
103
|
+
guarantee_covered?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Additive, on a lost purchase.disputed for an order that sold no coins: `"platform_commerce"`
|
|
106
|
+
* or `"subscription_renewal"`. Absent on a coin purchase dispute.
|
|
107
|
+
*/
|
|
108
|
+
order_type?: string;
|
|
109
|
+
/**
|
|
110
|
+
* Additive, on a lost Platform Commerce or subscription purchase.disputed: your share of the
|
|
111
|
+
* sale reversed, USD decimal string (`"0.00"` when the chargeback guarantee covered it).
|
|
112
|
+
*/
|
|
113
|
+
developer_revenue_reversed_usd?: string | null;
|
|
114
|
+
/**
|
|
115
|
+
* Additive (2026-09-27), on a lost subscription purchase.disputed: the card processor fee
|
|
116
|
+
* charged to you, the same figure a refund of that period charges, USD decimal string.
|
|
117
|
+
* `"0.00"` when the chargeback guarantee covered it and on a charge made before the 2026-09
|
|
118
|
+
* pricing. `null` where it does not apply (for example a Platform Commerce dispute, where the
|
|
119
|
+
* card fee simply stays charged to you as on a refund). Absent on coin purchase disputes.
|
|
120
|
+
*/
|
|
121
|
+
processing_fee_usd?: string | null;
|
|
122
|
+
/** On a lost subscription purchase.disputed: the subscription and period it concerns. */
|
|
123
|
+
subscription_id?: string | null;
|
|
124
|
+
period_seq?: number | null;
|
|
77
125
|
/**
|
|
78
126
|
* Card-only ids on purchase.disputed. `null` on a storefront chargeback (for example a
|
|
79
127
|
* Steam chargeback, which has no payment intent, charge or dispute id).
|
|
@@ -140,7 +188,21 @@ interface PlatformCommercePurchasedData {
|
|
|
140
188
|
new_balance?: string;
|
|
141
189
|
/** Card leg only (the USD charged). */
|
|
142
190
|
total_price_usd?: string;
|
|
191
|
+
/**
|
|
192
|
+
* `{ total_paid, platform_fee, developer_revenue, ... }`. `platform_fee` is INVO's whole fee
|
|
193
|
+
* and INCLUDES the international card fee; `platform_fee + developer_revenue = total_paid`.
|
|
194
|
+
* Since the 2026-09 pricing it also carries `international_card_fee_usd` (the part of
|
|
195
|
+
* `platform_fee` that is the international card fee, `"0.00"` on a US card and on the
|
|
196
|
+
* balance leg), so the card rate part is `platform_fee - international_card_fee_usd`.
|
|
197
|
+
*/
|
|
143
198
|
fee_breakdown?: Record<string, unknown>;
|
|
199
|
+
/**
|
|
200
|
+
* Additive (2026-09 pricing). The international card fee on this sale, USD decimal string:
|
|
201
|
+
* 1.5% of the listed price (before tax) on a card issued outside the US, `"0.00"` otherwise
|
|
202
|
+
* and on the balance leg. Already INCLUDED in `fee_breakdown.platform_fee`; do not add it
|
|
203
|
+
* again.
|
|
204
|
+
*/
|
|
205
|
+
international_card_fee_usd?: string;
|
|
144
206
|
/**
|
|
145
207
|
* Merchant of Record accounts only (card sales): the receipt INVO issued to the buyer.
|
|
146
208
|
* Absent on Open accounts and storefront rails.
|
|
@@ -150,8 +212,9 @@ interface PlatformCommercePurchasedData {
|
|
|
150
212
|
receipt_url?: string;
|
|
151
213
|
[key: string]: unknown;
|
|
152
214
|
}
|
|
153
|
-
/** `platform_commerce.refunded
|
|
154
|
-
*
|
|
215
|
+
/** `platform_commerce.refunded`: a Platform Commerce purchase was refunded. INVO's fee is
|
|
216
|
+
* not returned (`fee_retained: true`). On a card refund the fee stays charged to you
|
|
217
|
+
* (`card_fee_charged_to_partner_usd`, `partner_debited_usd`). */
|
|
155
218
|
interface PlatformCommerceRefundedData {
|
|
156
219
|
order_id: string | number;
|
|
157
220
|
/** "balance" | "card". */
|
|
@@ -171,6 +234,17 @@ interface PlatformCommerceRefundedData {
|
|
|
171
234
|
receipt_number?: string;
|
|
172
235
|
/** Merchant of Record only: link to the printable refund receipt page. */
|
|
173
236
|
receipt_url?: string;
|
|
237
|
+
/**
|
|
238
|
+
* Additive (2026-09 pricing), card refunds only: the part of INVO's card fee on this refund
|
|
239
|
+
* that stays charged to you, USD decimal string. The card fee is not returned on a refund.
|
|
240
|
+
*/
|
|
241
|
+
card_fee_charged_to_partner_usd?: string;
|
|
242
|
+
/**
|
|
243
|
+
* Additive (2026-09 pricing), card refunds only: everything this refund takes from your
|
|
244
|
+
* earnings, USD decimal string: your share of the sale reversed plus
|
|
245
|
+
* `card_fee_charged_to_partner_usd`.
|
|
246
|
+
*/
|
|
247
|
+
partner_debited_usd?: string;
|
|
174
248
|
[key: string]: unknown;
|
|
175
249
|
}
|
|
176
250
|
interface TransferEventData {
|
|
@@ -247,9 +321,12 @@ interface SubscriptionRenewalFunding {
|
|
|
247
321
|
[key: string]: unknown;
|
|
248
322
|
}
|
|
249
323
|
/**
|
|
250
|
-
* The fee split for one renewal. On the card rail INVO's fee is
|
|
251
|
-
*
|
|
252
|
-
*
|
|
324
|
+
* The fee split for one renewal. On the card rail INVO's fee (`invo_fee_usd`) is 4.5% + $0.30
|
|
325
|
+
* on Open (5.5% + $0.50 on Merchant of Record) of the listed price (before tax). The 1.5%
|
|
326
|
+
* international card fee on a card issued outside the US is NOT inside `invo_fee_usd`: it is
|
|
327
|
+
* reported separately as `international_card_fee_usd` (also `pass_through_fees_usd`) and charged
|
|
328
|
+
* to you on top. Read the figures; do not recompute them. On Steam, `basis` is
|
|
329
|
+
* `"steam_net"` and `total_usd` is what the coins are worth after Valve's share and VAT, NOT the price (the price is the
|
|
253
330
|
* event's top-level `amount_usd`).
|
|
254
331
|
*/
|
|
255
332
|
interface SubscriptionRenewalSplit {
|
|
@@ -261,6 +338,23 @@ interface SubscriptionRenewalSplit {
|
|
|
261
338
|
invo_fee_coins: string;
|
|
262
339
|
partner_revenue_coins: string;
|
|
263
340
|
invo_fee_percent: string;
|
|
341
|
+
/**
|
|
342
|
+
* The international card fee charged to you on this renewal, USD decimal string, billed on
|
|
343
|
+
* top of `invo_fee_usd`: `partner_revenue_usd` stays the gross figure and does not include
|
|
344
|
+
* it. Since the 2026-09 pricing it is the flat international card fee, and
|
|
345
|
+
* `international_card_fee_usd` carries the same figure under its own name. They are ONE
|
|
346
|
+
* charge reported twice: never add the two together. `"0.00"` on a US card.
|
|
347
|
+
*/
|
|
348
|
+
pass_through_fees_usd?: string;
|
|
349
|
+
/** `"recorded"`, `"none"`, `"pending"` or `"not_applicable"` (no card charge). Treat unknown values as informational. */
|
|
350
|
+
pass_through_status?: string;
|
|
351
|
+
/**
|
|
352
|
+
* Additive (2026-09 pricing). The international card fee on this renewal: 1.5% of the listed
|
|
353
|
+
* price (before tax) on a card issued outside the US, `"0.00"` otherwise, while pending, and
|
|
354
|
+
* on a charge opened before the 2026-09 pricing. The same figure as
|
|
355
|
+
* `pass_through_fees_usd`; do not add them.
|
|
356
|
+
*/
|
|
357
|
+
international_card_fee_usd?: string;
|
|
264
358
|
[key: string]: unknown;
|
|
265
359
|
}
|
|
266
360
|
/** Revenue-share attribution on a renewal. INVO pays nothing (`settled_by_invo: false`). */
|
|
@@ -1128,17 +1222,27 @@ declare class InvoServer {
|
|
|
1128
1222
|
* - rail "game": returns status "pending_payment" + paymentUrl (redirect the browser).
|
|
1129
1223
|
* - rail "steam": NOT a browser flow — the backend returns WRONG_RAIL_ENDPOINT.
|
|
1130
1224
|
*
|
|
1131
|
-
* INVO's card fee (
|
|
1132
|
-
*
|
|
1225
|
+
* INVO's card fee (4.5% + $0.30 on Open, 5.5% + $0.50 on Merchant of Record, plus 1.5% of
|
|
1226
|
+
* the listed price (before tax) on a card issued outside the US) is charged to you, the partner. The player
|
|
1227
|
+
* pays the listed price (plus any tax) and receives the listed coins. Card purchases only;
|
|
1228
|
+
* purchases through a third-party storefront or payment rail are unaffected. Two shapes,
|
|
1229
|
+
* chosen by what you send:
|
|
1133
1230
|
* - with `acknowledgedTotalUsd` (the `totalUsd` from {@link quoteCurrencyPurchase}): the
|
|
1134
|
-
* card is charged that total and the coins are priced off `usdAmount`.
|
|
1135
|
-
*
|
|
1136
|
-
*
|
|
1137
|
-
*
|
|
1138
|
-
*
|
|
1231
|
+
* card is never charged more than that total, and the coins are priced off `usdAmount`.
|
|
1232
|
+
* An older, higher fee-inclusive total is accepted and the true, lower total charged. A
|
|
1233
|
+
* total below what INVO would charge now throws `409 QUOTE_STALE` (`err.isQuoteStale`);
|
|
1234
|
+
* nothing was charged.
|
|
1235
|
+
* - without it: the card is charged exactly `usdAmount`, never more.
|
|
1236
|
+
*
|
|
1237
|
+
* From 2026-10-27 a card purchase under INVO's minimum card purchase ($2.99) throws
|
|
1238
|
+
* `400 BELOW_CARD_MINIMUM` (`err.isBelowCardMinimum`, `err.minUsd`, `err.enforcedFrom`);
|
|
1239
|
+
* until then it is accepted with `minPurchaseWarning`. `AMOUNT_BELOW_FEE` is no longer
|
|
1240
|
+
* returned.
|
|
1139
1241
|
*
|
|
1140
|
-
* A `success` result reports `processingFeeUsd
|
|
1141
|
-
* `
|
|
1242
|
+
* A `success` result reports `processingFeeUsd` (`"0.00"`), `feeTakenFrom` (`"partner"`),
|
|
1243
|
+
* `partnerFeeUsd`, `internationalCardFeeUsd` (`"0.00"` on a US card or one whose country
|
|
1244
|
+
* is unknown; both `null` if the fee could not be booked yet, which INVO does shortly after),
|
|
1245
|
+
* `coinsCredited` and `chargeTotalUsd`, each as INVO sent it.
|
|
1142
1246
|
*/
|
|
1143
1247
|
purchaseCurrency(input: PurchaseInput, opts?: CallOptions): Promise<PurchaseResult>;
|
|
1144
1248
|
/**
|
|
@@ -1146,14 +1250,17 @@ declare class InvoServer {
|
|
|
1146
1250
|
* creates nothing, so it is safe to call on every price render (`POST
|
|
1147
1251
|
* /api/currency-purchases/quote`, authenticated by your game secret like the purchase).
|
|
1148
1252
|
*
|
|
1149
|
-
*
|
|
1150
|
-
*
|
|
1151
|
-
*
|
|
1152
|
-
*
|
|
1153
|
-
*
|
|
1154
|
-
*
|
|
1155
|
-
*
|
|
1156
|
-
*
|
|
1253
|
+
* The player pays the listed price plus any tax (when you pass `country`) and receives the
|
|
1254
|
+
* listed coins: `totalUsd` carries no card fee, and `processingFeeUsd` is `"0.00"`. INVO's
|
|
1255
|
+
* card fee (4.5% + $0.30 on Open, 5.5% + $0.50 on Merchant of Record) is charged to you;
|
|
1256
|
+
* `partnerFeeUsd` carries it when INVO sends it. $10.00 quotes a $10.00 total, 100.00 coins
|
|
1257
|
+
* at the default 10 per USD, and a $0.75 partner fee on Open. Show the player `totalUsd`,
|
|
1258
|
+
* then send the same figure back as `acknowledgedTotalUsd` on {@link purchaseCurrency}; the
|
|
1259
|
+
* card is never charged more than that. `ifUnacknowledged` shows the purchase without the
|
|
1260
|
+
* acknowledgement (the card charged exactly `usdAmount`), or `null` when INVO sends none.
|
|
1261
|
+
* `minPurchaseWarning` is set while an amount under INVO's minimum card purchase is still
|
|
1262
|
+
* accepted. Card purchases only; purchases through a third-party storefront or payment
|
|
1263
|
+
* rail are unaffected.
|
|
1157
1264
|
*
|
|
1158
1265
|
* Refusals: `400 INVALID_INPUT` (amount missing, not above zero, or above INVO's card
|
|
1159
1266
|
* maximum), `400 CURRENCY_NOT_CONFIGURED`, `503 RATE_UNAVAILABLE`.
|
package/dist/server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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-YW2PYARQ.js';
|
|
2
|
+
export { InvoError } from './chunk-YW2PYARQ.js';
|
|
3
3
|
import { createHmac, timingSafeEqual } from 'crypto';
|
|
4
4
|
|
|
5
5
|
// src/version.ts
|
|
@@ -184,6 +184,32 @@ function assertAcknowledgedTotal(value) {
|
|
|
184
184
|
function optionalDecimalString(v) {
|
|
185
185
|
return v == null ? void 0 : String(v);
|
|
186
186
|
}
|
|
187
|
+
function nullableDecimalString(raw, fallback, key) {
|
|
188
|
+
for (const src of [raw, fallback]) {
|
|
189
|
+
if (Object.prototype.hasOwnProperty.call(src, key)) {
|
|
190
|
+
const v = src[key];
|
|
191
|
+
if (v === null) return null;
|
|
192
|
+
if (v !== void 0) return String(v);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return void 0;
|
|
196
|
+
}
|
|
197
|
+
function toMinPurchaseWarning(v) {
|
|
198
|
+
if (!v || typeof v !== "object" || Array.isArray(v)) return void 0;
|
|
199
|
+
const r = v;
|
|
200
|
+
return {
|
|
201
|
+
code: String(r["code"] ?? ""),
|
|
202
|
+
minUsd: r["min_usd"] == null ? "" : String(r["min_usd"]),
|
|
203
|
+
enforcedFrom: r["enforced_from"] == null ? "" : String(r["enforced_from"]),
|
|
204
|
+
...typeof r["message"] === "string" && r["message"] ? { message: r["message"] } : {},
|
|
205
|
+
...typeof r["enforced"] === "boolean" ? { enforced: r["enforced"] } : {},
|
|
206
|
+
raw: r
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
function minPurchaseWarningField(raw) {
|
|
210
|
+
const w = toMinPurchaseWarning(raw["min_purchase_warning"]);
|
|
211
|
+
return w === void 0 ? {} : { minPurchaseWarning: w };
|
|
212
|
+
}
|
|
187
213
|
function toQuoteBreakdown(row) {
|
|
188
214
|
const r = row && typeof row === "object" ? row : {};
|
|
189
215
|
const nullable = (v) => v == null ? null : String(v);
|
|
@@ -202,16 +228,22 @@ function toQuoteBreakdown(row) {
|
|
|
202
228
|
raw: r
|
|
203
229
|
};
|
|
204
230
|
}
|
|
205
|
-
function toUnacknowledgedOutcome(row) {
|
|
231
|
+
function toUnacknowledgedOutcome(row, quote = {}) {
|
|
206
232
|
if (!row || typeof row !== "object") return null;
|
|
207
233
|
const r = row;
|
|
208
234
|
return {
|
|
209
235
|
chargeTotalUsd: String(r["charge_total_usd"] ?? ""),
|
|
210
236
|
processingFeeUsd: String(r["processing_fee_usd"] ?? ""),
|
|
211
237
|
coins: String(r["coins"] ?? ""),
|
|
212
|
-
feeTakenFrom: String(r["fee_taken_from"] ??
|
|
238
|
+
feeTakenFrom: String(r["fee_taken_from"] ?? unacknowledgedFeeFallback(r, quote)),
|
|
239
|
+
...Object.prototype.hasOwnProperty.call(r, "partner_fee_usd") ? { partnerFeeUsd: r["partner_fee_usd"] == null ? null : String(r["partner_fee_usd"]) } : {}
|
|
213
240
|
};
|
|
214
241
|
}
|
|
242
|
+
function unacknowledgedFeeFallback(row, quote) {
|
|
243
|
+
const breakdown = quote["breakdown"];
|
|
244
|
+
const hasPartnerFee = row["partner_fee_usd"] != null || quote["partner_fee_usd"] != null || !!breakdown && typeof breakdown === "object" && breakdown["partner_fee_usd"] != null;
|
|
245
|
+
return hasPartnerFee ? "partner" : "coins";
|
|
246
|
+
}
|
|
215
247
|
function toCurrencyPurchaseQuote(raw) {
|
|
216
248
|
const breakdown = toQuoteBreakdown(raw["breakdown"]);
|
|
217
249
|
return {
|
|
@@ -223,10 +255,22 @@ function toCurrencyPurchaseQuote(raw) {
|
|
|
223
255
|
coins: String(raw["coins"] ?? breakdown.coins),
|
|
224
256
|
currencyName: String(raw["currency_name"] ?? breakdown.currencyName),
|
|
225
257
|
breakdown,
|
|
226
|
-
|
|
258
|
+
...raw["fee_taken_from"] != null ? { feeTakenFrom: String(raw["fee_taken_from"]) } : {},
|
|
259
|
+
ifUnacknowledged: toUnacknowledgedOutcome(raw["if_unacknowledged"], raw),
|
|
260
|
+
...pricingFields(raw, breakdown.raw),
|
|
227
261
|
raw
|
|
228
262
|
};
|
|
229
263
|
}
|
|
264
|
+
function pricingFields(raw, fallback = {}) {
|
|
265
|
+
const out = {};
|
|
266
|
+
const partnerFee = nullableDecimalString(raw, fallback, "partner_fee_usd");
|
|
267
|
+
if (partnerFee !== void 0) out.partnerFeeUsd = partnerFee;
|
|
268
|
+
const intlFee = nullableDecimalString(raw, fallback, "international_card_fee_usd");
|
|
269
|
+
if (intlFee !== void 0) out.internationalCardFeeUsd = intlFee;
|
|
270
|
+
const warning = toMinPurchaseWarning(raw["min_purchase_warning"] ?? fallback["min_purchase_warning"]);
|
|
271
|
+
if (warning !== void 0) out.minPurchaseWarning = warning;
|
|
272
|
+
return out;
|
|
273
|
+
}
|
|
230
274
|
function invalidInput(label, value, why) {
|
|
231
275
|
return new InvoError({
|
|
232
276
|
message: `${label} ${why} (got ${JSON.stringify(value)}).`,
|
|
@@ -640,6 +684,7 @@ var PlatformCommerceServer = class {
|
|
|
640
684
|
expiresAt: typeof expiresAtRaw === "number" ? expiresAtRaw : void 0,
|
|
641
685
|
amountUsd: raw["amount_usd"] ?? null,
|
|
642
686
|
idempotentReplay: raw["idempotent_replay"] === true,
|
|
687
|
+
...minPurchaseWarningField(raw),
|
|
643
688
|
raw
|
|
644
689
|
};
|
|
645
690
|
}
|
|
@@ -718,6 +763,9 @@ var PlatformCommerceServer = class {
|
|
|
718
763
|
...raw["refunded_total_usd"] != null ? { refundedTotalUsd: String(raw["refunded_total_usd"]) } : {},
|
|
719
764
|
...raw["charge_total_usd"] != null ? { chargeTotalUsd: String(raw["charge_total_usd"]) } : {},
|
|
720
765
|
...raw["remaining_usd"] != null ? { remainingUsd: String(raw["remaining_usd"]) } : {},
|
|
766
|
+
// 2026-09 pricing, card leg only: the card fee stays charged to the partner on a refund.
|
|
767
|
+
...raw["card_fee_charged_to_partner_usd"] != null ? { cardFeeChargedToPartnerUsd: String(raw["card_fee_charged_to_partner_usd"]) } : {},
|
|
768
|
+
...raw["partner_debited_usd"] != null ? { partnerDebitedUsd: String(raw["partner_debited_usd"]) } : {},
|
|
721
769
|
raw
|
|
722
770
|
};
|
|
723
771
|
}
|
|
@@ -1919,6 +1967,7 @@ var InvoServer = class {
|
|
|
1919
1967
|
// the purchase status later does not have to parse a URL itself.
|
|
1920
1968
|
sessionToken: sessionTokenFromCreateCheckout(raw, checkoutUrl),
|
|
1921
1969
|
warnings: toCheckoutWarnings(raw["warnings"]),
|
|
1970
|
+
...minPurchaseWarningField(raw),
|
|
1922
1971
|
raw
|
|
1923
1972
|
};
|
|
1924
1973
|
}
|
|
@@ -1929,17 +1978,27 @@ var InvoServer = class {
|
|
|
1929
1978
|
* - rail "game": returns status "pending_payment" + paymentUrl (redirect the browser).
|
|
1930
1979
|
* - rail "steam": NOT a browser flow — the backend returns WRONG_RAIL_ENDPOINT.
|
|
1931
1980
|
*
|
|
1932
|
-
* INVO's card fee (
|
|
1933
|
-
*
|
|
1981
|
+
* INVO's card fee (4.5% + $0.30 on Open, 5.5% + $0.50 on Merchant of Record, plus 1.5% of
|
|
1982
|
+
* the listed price (before tax) on a card issued outside the US) is charged to you, the partner. The player
|
|
1983
|
+
* pays the listed price (plus any tax) and receives the listed coins. Card purchases only;
|
|
1984
|
+
* purchases through a third-party storefront or payment rail are unaffected. Two shapes,
|
|
1985
|
+
* chosen by what you send:
|
|
1934
1986
|
* - with `acknowledgedTotalUsd` (the `totalUsd` from {@link quoteCurrencyPurchase}): the
|
|
1935
|
-
* card is charged that total and the coins are priced off `usdAmount`.
|
|
1936
|
-
*
|
|
1937
|
-
*
|
|
1938
|
-
*
|
|
1939
|
-
*
|
|
1987
|
+
* card is never charged more than that total, and the coins are priced off `usdAmount`.
|
|
1988
|
+
* An older, higher fee-inclusive total is accepted and the true, lower total charged. A
|
|
1989
|
+
* total below what INVO would charge now throws `409 QUOTE_STALE` (`err.isQuoteStale`);
|
|
1990
|
+
* nothing was charged.
|
|
1991
|
+
* - without it: the card is charged exactly `usdAmount`, never more.
|
|
1940
1992
|
*
|
|
1941
|
-
*
|
|
1942
|
-
* `
|
|
1993
|
+
* From 2026-10-27 a card purchase under INVO's minimum card purchase ($2.99) throws
|
|
1994
|
+
* `400 BELOW_CARD_MINIMUM` (`err.isBelowCardMinimum`, `err.minUsd`, `err.enforcedFrom`);
|
|
1995
|
+
* until then it is accepted with `minPurchaseWarning`. `AMOUNT_BELOW_FEE` is no longer
|
|
1996
|
+
* returned.
|
|
1997
|
+
*
|
|
1998
|
+
* A `success` result reports `processingFeeUsd` (`"0.00"`), `feeTakenFrom` (`"partner"`),
|
|
1999
|
+
* `partnerFeeUsd`, `internationalCardFeeUsd` (`"0.00"` on a US card or one whose country
|
|
2000
|
+
* is unknown; both `null` if the fee could not be booked yet, which INVO does shortly after),
|
|
2001
|
+
* `coinsCredited` and `chargeTotalUsd`, each as INVO sent it.
|
|
1943
2002
|
*/
|
|
1944
2003
|
async purchaseCurrency(input, opts) {
|
|
1945
2004
|
if (typeof input.playerEmail !== "string" || !input.playerEmail.trim()) {
|
|
@@ -1975,6 +2034,8 @@ var InvoServer = class {
|
|
|
1975
2034
|
if (input.playerName) body["player_name"] = input.playerName;
|
|
1976
2035
|
if (input.playerPhone) body["player_phone"] = input.playerPhone;
|
|
1977
2036
|
if (input.metadata) body["metadata"] = input.metadata;
|
|
2037
|
+
if (input.country) body["country"] = input.country;
|
|
2038
|
+
if (input.subdivision) body["subdivision"] = input.subdivision;
|
|
1978
2039
|
const raw = await this.http.post(
|
|
1979
2040
|
"/api/currency-purchases/purchase-currency",
|
|
1980
2041
|
body,
|
|
@@ -1994,6 +2055,7 @@ var InvoServer = class {
|
|
|
1994
2055
|
feeTakenFrom: optionalDecimalString(raw["fee_taken_from"]),
|
|
1995
2056
|
coinsCredited: optionalDecimalString(raw["coins_credited"]),
|
|
1996
2057
|
chargeTotalUsd: optionalDecimalString(raw["charge_total_usd"]),
|
|
2058
|
+
...pricingFields(raw),
|
|
1997
2059
|
...receiptFields(raw),
|
|
1998
2060
|
raw
|
|
1999
2061
|
};
|
|
@@ -2003,14 +2065,17 @@ var InvoServer = class {
|
|
|
2003
2065
|
* creates nothing, so it is safe to call on every price render (`POST
|
|
2004
2066
|
* /api/currency-purchases/quote`, authenticated by your game secret like the purchase).
|
|
2005
2067
|
*
|
|
2006
|
-
*
|
|
2007
|
-
*
|
|
2008
|
-
*
|
|
2009
|
-
*
|
|
2010
|
-
*
|
|
2011
|
-
*
|
|
2012
|
-
*
|
|
2013
|
-
*
|
|
2068
|
+
* The player pays the listed price plus any tax (when you pass `country`) and receives the
|
|
2069
|
+
* listed coins: `totalUsd` carries no card fee, and `processingFeeUsd` is `"0.00"`. INVO's
|
|
2070
|
+
* card fee (4.5% + $0.30 on Open, 5.5% + $0.50 on Merchant of Record) is charged to you;
|
|
2071
|
+
* `partnerFeeUsd` carries it when INVO sends it. $10.00 quotes a $10.00 total, 100.00 coins
|
|
2072
|
+
* at the default 10 per USD, and a $0.75 partner fee on Open. Show the player `totalUsd`,
|
|
2073
|
+
* then send the same figure back as `acknowledgedTotalUsd` on {@link purchaseCurrency}; the
|
|
2074
|
+
* card is never charged more than that. `ifUnacknowledged` shows the purchase without the
|
|
2075
|
+
* acknowledgement (the card charged exactly `usdAmount`), or `null` when INVO sends none.
|
|
2076
|
+
* `minPurchaseWarning` is set while an amount under INVO's minimum card purchase is still
|
|
2077
|
+
* accepted. Card purchases only; purchases through a third-party storefront or payment
|
|
2078
|
+
* rail are unaffected.
|
|
2014
2079
|
*
|
|
2015
2080
|
* Refusals: `400 INVALID_INPUT` (amount missing, not above zero, or above INVO's card
|
|
2016
2081
|
* maximum), `400 CURRENCY_NOT_CONFIGURED`, `503 RATE_UNAVAILABLE`.
|