@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/server.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { I as InvoError, H as Http, x as AuthHeader, y as CardSetupSessionInput, g as CallOptions, z as CardSetupSessionResult, F as CardSetupInput, G as CardSetupResult, J as CardSetupConfirmInput, K as CardSetupConfirmResult, N as PlayerCardsResult, O as PlatformPurchaseInput, Q as PlatformPurchaseResult, S as PlatformOrderStatusResult, T as PlatformRefundInput, U as PlatformRefundResult, X as CreateSubscriptionInput, Y as SubscriptionResult, Z as GetSubscriptionOptions, _ as GetSubscriptionResult, $ as ListSubscriptionsOptions, a0 as SubscriptionListResult, a1 as CancelSubscriptionOptions, a2 as CancelResult, a3 as ChangeAmountResult, a4 as SetPaymentMethodInput, a5 as SetPaymentMethodResult, a6 as RefundSubscriptionInput, a7 as RefundResult, a8 as SteamSubscriptionInitInput, a9 as SteamInitResult, aa as SteamFinalizeSubscriptionResult, ab as SandboxClockResult, ac as SandboxFailureOutcome, ad as SandboxForceFailureOptions, ae as SandboxForceAuthChallengeOptions, af as ServerConfig, ag as PlayerToken, ah as InitiateSendInput, ai as InitiateResult, aj as InitiateTransferInput, ak as CreateCheckoutInput, al as CreateCheckoutResult, am as PurchaseInput, an as PurchaseResult, ao as CurrencyPurchaseQuoteInput, ap as CurrencyPurchaseQuote, aq as ConfirmPaymentResult, ar as OrderDetailsResult, as as SteamPacksQuery, at as SteamPacksResult, au as SteamInitPurchaseInput, av as SteamInitPurchaseResult, aw as SteamFinalizeInput, ax as SteamFinalizeResult, ay as PurchaseItemInput, az as PurchaseItemResult, aA as ItemHistoryQuery, aB as ItemHistoryResult, aC as ItemOrderQuery, aD as PlayerBalanceQuery, aE as PlayerBalanceResult, aF as InboundPendingQuery, aG as InboundPendingResult, aH as LinkedIdentitiesQuery, aI as LinkedIdentitiesResult, aJ as SmsVerifyResult, aK as ClaimTransferInput, aL as ClaimResult, aM as ClaimCurrencyInput, aN as TransactionStatusResult, aO as GuardianApprovalStatusResult, aP as ServerDestinationsQuery, k as DestinationsResult, aQ as PhoneShareContact, aR as PhoneShareInitiateResult, aS as PhoneShareApproveInput, aT as PhoneShareApproveResult, aU as PhoneShareStatusResult, aV as BeginDeviceApprovalInput, aW as DeviceApprovalGrant, aX as PollDeviceApprovalInput, aY as DeviceApprovalPollResult, aZ as ConfirmDeviceEnrollmentInput, a_ as ConfirmDeviceEnrollmentResult, a$ as ApproveWithDeviceCodeInput, b0 as DeviceApprovalSettleResult, b1 as CompleteDeviceApprovalInput, b2 as CompleteDeviceApprovalResult } from './types-
|
|
2
|
-
export { b3 as CardSetupStatus, b4 as 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-CCqgVhzf.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-CCqgVhzf.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The package version, as sent in the server User-Agent. A test pins this to
|
|
6
6
|
* `package.json` so it cannot drift silently (it did: the UA read 3.0.0 through 3.7.0).
|
|
7
7
|
* Bump it with the changeset flow.
|
|
8
8
|
*/
|
|
9
|
-
declare const SDK_VERSION = "3.
|
|
9
|
+
declare const SDK_VERSION = "3.19.0";
|
|
10
10
|
|
|
11
11
|
interface VerifyWebhookOptions {
|
|
12
12
|
/** Max age of the signed timestamp, in seconds. Default 300 (5 min). */
|
|
@@ -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,50 @@ 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. Since 2026-09-28
|
|
116
|
+
* (D-PRICE-012) always `"0.00"`: a lost dispute charges INVO's card fee instead
|
|
117
|
+
* (`card_fee_charged_to_partner_usd`), not a separate processor fee. `null` where it does not
|
|
118
|
+
* apply (for example a Platform Commerce dispute). Absent on coin purchase disputes.
|
|
119
|
+
*/
|
|
120
|
+
processing_fee_usd?: string | null;
|
|
121
|
+
/**
|
|
122
|
+
* Additive (2026-09-28, D-PRICE-012), on a lost Platform Commerce or subscription
|
|
123
|
+
* purchase.disputed: INVO's card fee on the lost amount, charged to you, USD decimal string.
|
|
124
|
+
* A lost dispute not covered by the chargeback guarantee costs you exactly what a refund of
|
|
125
|
+
* the same charge does, on every charge. `"0.00"` when the guarantee covered it; `null` where
|
|
126
|
+
* it does not apply (including a settlement replay). Absent on coin purchase disputes.
|
|
127
|
+
*/
|
|
128
|
+
card_fee_charged_to_partner_usd?: string | null;
|
|
129
|
+
/**
|
|
130
|
+
* Additive (2026-09-28, D-PRICE-012), same events: your whole debit for the lost dispute,
|
|
131
|
+
* `developer_revenue_reversed_usd` plus `card_fee_charged_to_partner_usd`. `"0.00"` when the
|
|
132
|
+
* guarantee covered it; `null` where it does not apply.
|
|
133
|
+
*/
|
|
134
|
+
partner_debited_usd?: string | null;
|
|
135
|
+
/** On a lost subscription purchase.disputed: the subscription and period it concerns. */
|
|
136
|
+
subscription_id?: string | null;
|
|
137
|
+
period_seq?: number | null;
|
|
77
138
|
/**
|
|
78
139
|
* Card-only ids on purchase.disputed. `null` on a storefront chargeback (for example a
|
|
79
140
|
* Steam chargeback, which has no payment intent, charge or dispute id).
|
|
@@ -140,7 +201,21 @@ interface PlatformCommercePurchasedData {
|
|
|
140
201
|
new_balance?: string;
|
|
141
202
|
/** Card leg only (the USD charged). */
|
|
142
203
|
total_price_usd?: string;
|
|
204
|
+
/**
|
|
205
|
+
* `{ total_paid, platform_fee, developer_revenue, ... }`. `platform_fee` is INVO's whole fee
|
|
206
|
+
* and INCLUDES the international card fee; `platform_fee + developer_revenue = total_paid`.
|
|
207
|
+
* Since the 2026-09 pricing it also carries `international_card_fee_usd` (the part of
|
|
208
|
+
* `platform_fee` that is the international card fee, `"0.00"` on a US card and on the
|
|
209
|
+
* balance leg), so the card rate part is `platform_fee - international_card_fee_usd`.
|
|
210
|
+
*/
|
|
143
211
|
fee_breakdown?: Record<string, unknown>;
|
|
212
|
+
/**
|
|
213
|
+
* Additive (2026-09 pricing). The international card fee on this sale, USD decimal string:
|
|
214
|
+
* 1.5% of the listed price (before tax) on a card issued outside the US, `"0.00"` otherwise
|
|
215
|
+
* and on the balance leg. Already INCLUDED in `fee_breakdown.platform_fee`; do not add it
|
|
216
|
+
* again.
|
|
217
|
+
*/
|
|
218
|
+
international_card_fee_usd?: string;
|
|
144
219
|
/**
|
|
145
220
|
* Merchant of Record accounts only (card sales): the receipt INVO issued to the buyer.
|
|
146
221
|
* Absent on Open accounts and storefront rails.
|
|
@@ -150,8 +225,9 @@ interface PlatformCommercePurchasedData {
|
|
|
150
225
|
receipt_url?: string;
|
|
151
226
|
[key: string]: unknown;
|
|
152
227
|
}
|
|
153
|
-
/** `platform_commerce.refunded
|
|
154
|
-
*
|
|
228
|
+
/** `platform_commerce.refunded`: a Platform Commerce purchase was refunded. INVO's fee is
|
|
229
|
+
* not returned (`fee_retained: true`). On a card refund the fee stays charged to you
|
|
230
|
+
* (`card_fee_charged_to_partner_usd`, `partner_debited_usd`). */
|
|
155
231
|
interface PlatformCommerceRefundedData {
|
|
156
232
|
order_id: string | number;
|
|
157
233
|
/** "balance" | "card". */
|
|
@@ -171,6 +247,17 @@ interface PlatformCommerceRefundedData {
|
|
|
171
247
|
receipt_number?: string;
|
|
172
248
|
/** Merchant of Record only: link to the printable refund receipt page. */
|
|
173
249
|
receipt_url?: string;
|
|
250
|
+
/**
|
|
251
|
+
* Additive (2026-09 pricing), card refunds only: the part of INVO's card fee on this refund
|
|
252
|
+
* that stays charged to you, USD decimal string. The card fee is not returned on a refund.
|
|
253
|
+
*/
|
|
254
|
+
card_fee_charged_to_partner_usd?: string;
|
|
255
|
+
/**
|
|
256
|
+
* Additive (2026-09 pricing), card refunds only: everything this refund takes from your
|
|
257
|
+
* earnings, USD decimal string: your share of the sale reversed plus
|
|
258
|
+
* `card_fee_charged_to_partner_usd`.
|
|
259
|
+
*/
|
|
260
|
+
partner_debited_usd?: string;
|
|
174
261
|
[key: string]: unknown;
|
|
175
262
|
}
|
|
176
263
|
interface TransferEventData {
|
|
@@ -247,9 +334,12 @@ interface SubscriptionRenewalFunding {
|
|
|
247
334
|
[key: string]: unknown;
|
|
248
335
|
}
|
|
249
336
|
/**
|
|
250
|
-
* The fee split for one renewal. On the card rail INVO's fee is
|
|
251
|
-
*
|
|
252
|
-
*
|
|
337
|
+
* The fee split for one renewal. On the card rail INVO's fee (`invo_fee_usd`) is 4.5% + $0.30
|
|
338
|
+
* on Open (5.5% + $0.50 on Merchant of Record) of the listed price (before tax). The 1.5%
|
|
339
|
+
* international card fee on a card issued outside the US is NOT inside `invo_fee_usd`: it is
|
|
340
|
+
* reported separately as `international_card_fee_usd` (also `pass_through_fees_usd`) and charged
|
|
341
|
+
* to you on top. Read the figures; do not recompute them. On Steam, `basis` is
|
|
342
|
+
* `"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
343
|
* event's top-level `amount_usd`).
|
|
254
344
|
*/
|
|
255
345
|
interface SubscriptionRenewalSplit {
|
|
@@ -261,6 +351,23 @@ interface SubscriptionRenewalSplit {
|
|
|
261
351
|
invo_fee_coins: string;
|
|
262
352
|
partner_revenue_coins: string;
|
|
263
353
|
invo_fee_percent: string;
|
|
354
|
+
/**
|
|
355
|
+
* The international card fee charged to you on this renewal, USD decimal string, billed on
|
|
356
|
+
* top of `invo_fee_usd`: `partner_revenue_usd` stays the gross figure and does not include
|
|
357
|
+
* it. Since the 2026-09 pricing it is the flat international card fee, and
|
|
358
|
+
* `international_card_fee_usd` carries the same figure under its own name. They are ONE
|
|
359
|
+
* charge reported twice: never add the two together. `"0.00"` on a US card.
|
|
360
|
+
*/
|
|
361
|
+
pass_through_fees_usd?: string;
|
|
362
|
+
/** `"recorded"`, `"none"`, `"pending"` or `"not_applicable"` (no card charge). Treat unknown values as informational. */
|
|
363
|
+
pass_through_status?: string;
|
|
364
|
+
/**
|
|
365
|
+
* Additive (2026-09 pricing). The international card fee on this renewal: 1.5% of the listed
|
|
366
|
+
* price (before tax) on a card issued outside the US, `"0.00"` otherwise, while pending, and
|
|
367
|
+
* on a charge opened before the 2026-09 pricing. The same figure as
|
|
368
|
+
* `pass_through_fees_usd`; do not add them.
|
|
369
|
+
*/
|
|
370
|
+
international_card_fee_usd?: string;
|
|
264
371
|
[key: string]: unknown;
|
|
265
372
|
}
|
|
266
373
|
/** Revenue-share attribution on a renewal. INVO pays nothing (`settled_by_invo: false`). */
|
|
@@ -434,21 +541,40 @@ interface SubscriptionRefundDetail {
|
|
|
434
541
|
partner_revenue_reversed_usd: string;
|
|
435
542
|
/** "full" | "prorata". */
|
|
436
543
|
partner_revenue_reversal_mode: string;
|
|
437
|
-
/**
|
|
544
|
+
/**
|
|
545
|
+
* Additive (2026-09-17). Since 2026-09-28 (D-PRICE-012) always `"0.00"`: a card refund charges
|
|
546
|
+
* INVO's card fee (`card_fee_charged_to_partner_usd`), not a separate processor fee. Older
|
|
547
|
+
* events carried the processor fee here.
|
|
548
|
+
*/
|
|
438
549
|
processing_fee_usd?: string;
|
|
439
|
-
/** Additive (2026-09-17). "actual" | "estimated" | "none". */
|
|
550
|
+
/** Additive (2026-09-17). "actual" | "estimated" | "none"; `"none"` since 2026-09-28. */
|
|
440
551
|
processing_fee_basis?: string;
|
|
441
552
|
/** Additive (2026-09-17). Always "partner". */
|
|
442
553
|
processing_fee_borne_by?: string;
|
|
443
|
-
/**
|
|
554
|
+
/**
|
|
555
|
+
* Additive (2026-09-17). Everything this refund took from your revenue; since 2026-09-28 the
|
|
556
|
+
* same value as `partner_debited_usd`.
|
|
557
|
+
*/
|
|
444
558
|
partner_total_reversed_usd?: string;
|
|
559
|
+
/**
|
|
560
|
+
* Additive (2026-09-28, D-PRICE-012). INVO's card fee on the refunded part, charged to you
|
|
561
|
+
* (the card fee is not returned on a refund). `"0.00"` on a coin refund. Absent on older events.
|
|
562
|
+
*/
|
|
563
|
+
card_fee_charged_to_partner_usd?: string;
|
|
564
|
+
/**
|
|
565
|
+
* Additive (2026-09-28, D-PRICE-012). Your whole debit: `partner_revenue_reversed_usd` plus
|
|
566
|
+
* `card_fee_charged_to_partner_usd`, the refunded price before tax on a card refund. Absent on
|
|
567
|
+
* older events; read `partner_total_reversed_usd` there.
|
|
568
|
+
*/
|
|
569
|
+
partner_debited_usd?: string;
|
|
445
570
|
[key: string]: unknown;
|
|
446
571
|
}
|
|
447
572
|
/**
|
|
448
573
|
* `subscription.refunded`: its own shape. Your revenue for the refunded portion is
|
|
449
574
|
* reversed (`refund.partner_revenue_reversed_usd`); INVO's fee is retained; on a card refund
|
|
450
|
-
* you
|
|
451
|
-
* `refund.
|
|
575
|
+
* you bear the whole refunded amount, INVO's card fee included (`refund.card_fee_charged_to_partner_usd`,
|
|
576
|
+
* since 2026-09-28). "What did I earn" subtracts `refund.partner_debited_usd` (older events:
|
|
577
|
+
* `refund.partner_total_reversed_usd`, then `partner_revenue_reversed_usd`).
|
|
452
578
|
* A FULL refund cancels the subscription (`subscription_canceled: true`), and a
|
|
453
579
|
* `subscription.canceled` with `cancel_cause: "full_refund"` is sent with it (sent together and may arrive in any order).
|
|
454
580
|
* A partial one does not.
|
|
@@ -818,7 +944,9 @@ declare class SubscriptionsServer {
|
|
|
818
944
|
* and reclaims the coins it minted (`balanceDeltaCoins` is signed), a partial refund
|
|
819
945
|
* credits coins. Your revenue is reversed for the refunded portion
|
|
820
946
|
* (`partnerRevenueReversedUsd`), INVO's fee is retained, and on a card refund you bear the
|
|
821
|
-
*
|
|
947
|
+
* whole refunded amount, INVO's card fee included (`cardFeeChargedToPartnerUsd`;
|
|
948
|
+
* `partnerDebitedUsd` is the sum; since 2026-09-28, with no separate processor fee:
|
|
949
|
+
* `processingFeeUsd` reads `"0.00"`). **A full refund
|
|
822
950
|
* cancels the subscription** (`subscriptionCanceled`, and a `subscription.canceled` event
|
|
823
951
|
* with `cancel_cause: "full_refund"`, sent together with `subscription.refunded` in any
|
|
824
952
|
* order); a partial one does not. INVO emails the member.
|
|
@@ -1128,17 +1256,27 @@ declare class InvoServer {
|
|
|
1128
1256
|
* - rail "game": returns status "pending_payment" + paymentUrl (redirect the browser).
|
|
1129
1257
|
* - rail "steam": NOT a browser flow — the backend returns WRONG_RAIL_ENDPOINT.
|
|
1130
1258
|
*
|
|
1131
|
-
* INVO's card fee (
|
|
1132
|
-
*
|
|
1259
|
+
* INVO's card fee (4.5% + $0.30 on Open, 5.5% + $0.50 on Merchant of Record, plus 1.5% of
|
|
1260
|
+
* the listed price (before tax) on a card issued outside the US) is charged to you, the partner. The player
|
|
1261
|
+
* pays the listed price (plus any tax) and receives the listed coins. Card purchases only;
|
|
1262
|
+
* purchases through a third-party storefront or payment rail are unaffected. Two shapes,
|
|
1263
|
+
* chosen by what you send:
|
|
1133
1264
|
* - 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
|
-
*
|
|
1265
|
+
* card is never charged more than that total, and the coins are priced off `usdAmount`.
|
|
1266
|
+
* An older, higher fee-inclusive total is accepted and the true, lower total charged. A
|
|
1267
|
+
* total below what INVO would charge now throws `409 QUOTE_STALE` (`err.isQuoteStale`);
|
|
1268
|
+
* nothing was charged.
|
|
1269
|
+
* - without it: the card is charged exactly `usdAmount`, never more.
|
|
1270
|
+
*
|
|
1271
|
+
* From 2026-10-27 a card purchase under INVO's minimum card purchase ($2.99) throws
|
|
1272
|
+
* `400 BELOW_CARD_MINIMUM` (`err.isBelowCardMinimum`, `err.minUsd`, `err.enforcedFrom`);
|
|
1273
|
+
* until then it is accepted with `minPurchaseWarning`. `AMOUNT_BELOW_FEE` is no longer
|
|
1274
|
+
* returned.
|
|
1139
1275
|
*
|
|
1140
|
-
* A `success` result reports `processingFeeUsd
|
|
1141
|
-
* `
|
|
1276
|
+
* A `success` result reports `processingFeeUsd` (`"0.00"`), `feeTakenFrom` (`"partner"`),
|
|
1277
|
+
* `partnerFeeUsd`, `internationalCardFeeUsd` (`"0.00"` on a US card or one whose country
|
|
1278
|
+
* is unknown; both `null` if the fee could not be booked yet, which INVO does shortly after),
|
|
1279
|
+
* `coinsCredited` and `chargeTotalUsd`, each as INVO sent it.
|
|
1142
1280
|
*/
|
|
1143
1281
|
purchaseCurrency(input: PurchaseInput, opts?: CallOptions): Promise<PurchaseResult>;
|
|
1144
1282
|
/**
|
|
@@ -1146,14 +1284,17 @@ declare class InvoServer {
|
|
|
1146
1284
|
* creates nothing, so it is safe to call on every price render (`POST
|
|
1147
1285
|
* /api/currency-purchases/quote`, authenticated by your game secret like the purchase).
|
|
1148
1286
|
*
|
|
1149
|
-
*
|
|
1150
|
-
*
|
|
1151
|
-
*
|
|
1152
|
-
*
|
|
1153
|
-
*
|
|
1154
|
-
*
|
|
1155
|
-
*
|
|
1156
|
-
*
|
|
1287
|
+
* The player pays the listed price plus any tax (when you pass `country`) and receives the
|
|
1288
|
+
* listed coins: `totalUsd` carries no card fee, and `processingFeeUsd` is `"0.00"`. INVO's
|
|
1289
|
+
* card fee (4.5% + $0.30 on Open, 5.5% + $0.50 on Merchant of Record) is charged to you;
|
|
1290
|
+
* `partnerFeeUsd` carries it when INVO sends it. $10.00 quotes a $10.00 total, 100.00 coins
|
|
1291
|
+
* at the default 10 per USD, and a $0.75 partner fee on Open. Show the player `totalUsd`,
|
|
1292
|
+
* then send the same figure back as `acknowledgedTotalUsd` on {@link purchaseCurrency}; the
|
|
1293
|
+
* card is never charged more than that. `ifUnacknowledged` shows the purchase without the
|
|
1294
|
+
* acknowledgement (the card charged exactly `usdAmount`), or `null` when INVO sends none.
|
|
1295
|
+
* `minPurchaseWarning` is set while an amount under INVO's minimum card purchase is still
|
|
1296
|
+
* accepted. Card purchases only; purchases through a third-party storefront or payment
|
|
1297
|
+
* rail are unaffected.
|
|
1157
1298
|
*
|
|
1158
1299
|
* Refusals: `400 INVALID_INPUT` (amount missing, not above zero, or above INVO's card
|
|
1159
1300
|
* maximum), `400 CURRENCY_NOT_CONFIGURED`, `503 RATE_UNAVAILABLE`.
|
package/dist/server.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { InvoError, receiptFields, assertSecureBaseUrl, Http, creditFields, toDestinationsResult } from './chunk-
|
|
2
|
-
export { InvoError } from './chunk-
|
|
1
|
+
import { InvoError, receiptFields, assertSecureBaseUrl, Http, creditFields, toDestinationsResult } from './chunk-YW2PYARQ.js';
|
|
2
|
+
export { InvoError } from './chunk-YW2PYARQ.js';
|
|
3
3
|
import { createHmac, timingSafeEqual } from 'crypto';
|
|
4
4
|
|
|
5
5
|
// src/version.ts
|
|
6
|
-
var SDK_VERSION = "3.
|
|
6
|
+
var SDK_VERSION = "3.19.0";
|
|
7
7
|
|
|
8
8
|
// src/shared/types.ts
|
|
9
9
|
function isRefundPendingApproval(r) {
|
|
@@ -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
|
}
|
|
@@ -820,6 +868,9 @@ function toRefundResult(raw, subscriptionId, clientRequestId) {
|
|
|
820
868
|
processingFeeBorneBy: optionalString(raw, "processing_fee_borne_by"),
|
|
821
869
|
processingFeeTransactionId: optionalString(raw, "processing_fee_transaction_id"),
|
|
822
870
|
partnerTotalReversedUsd: optionalString(raw, "partner_total_reversed_usd"),
|
|
871
|
+
// ---- additive (2026-09-28, D-PRICE-012): undefined on a receipt stored before it ----
|
|
872
|
+
cardFeeChargedToPartnerUsd: optionalString(raw, "card_fee_charged_to_partner_usd"),
|
|
873
|
+
partnerDebitedUsd: optionalString(raw, "partner_debited_usd"),
|
|
823
874
|
initiation: optionalString(raw, "initiation"),
|
|
824
875
|
refundRequestId: optionalString(raw, "refund_request_id"),
|
|
825
876
|
raw
|
|
@@ -1346,7 +1397,9 @@ var SubscriptionsServer = class {
|
|
|
1346
1397
|
* and reclaims the coins it minted (`balanceDeltaCoins` is signed), a partial refund
|
|
1347
1398
|
* credits coins. Your revenue is reversed for the refunded portion
|
|
1348
1399
|
* (`partnerRevenueReversedUsd`), INVO's fee is retained, and on a card refund you bear the
|
|
1349
|
-
*
|
|
1400
|
+
* whole refunded amount, INVO's card fee included (`cardFeeChargedToPartnerUsd`;
|
|
1401
|
+
* `partnerDebitedUsd` is the sum; since 2026-09-28, with no separate processor fee:
|
|
1402
|
+
* `processingFeeUsd` reads `"0.00"`). **A full refund
|
|
1350
1403
|
* cancels the subscription** (`subscriptionCanceled`, and a `subscription.canceled` event
|
|
1351
1404
|
* with `cancel_cause: "full_refund"`, sent together with `subscription.refunded` in any
|
|
1352
1405
|
* order); a partial one does not. INVO emails the member.
|
|
@@ -1919,6 +1972,7 @@ var InvoServer = class {
|
|
|
1919
1972
|
// the purchase status later does not have to parse a URL itself.
|
|
1920
1973
|
sessionToken: sessionTokenFromCreateCheckout(raw, checkoutUrl),
|
|
1921
1974
|
warnings: toCheckoutWarnings(raw["warnings"]),
|
|
1975
|
+
...minPurchaseWarningField(raw),
|
|
1922
1976
|
raw
|
|
1923
1977
|
};
|
|
1924
1978
|
}
|
|
@@ -1929,17 +1983,27 @@ var InvoServer = class {
|
|
|
1929
1983
|
* - rail "game": returns status "pending_payment" + paymentUrl (redirect the browser).
|
|
1930
1984
|
* - rail "steam": NOT a browser flow — the backend returns WRONG_RAIL_ENDPOINT.
|
|
1931
1985
|
*
|
|
1932
|
-
* INVO's card fee (
|
|
1933
|
-
*
|
|
1986
|
+
* INVO's card fee (4.5% + $0.30 on Open, 5.5% + $0.50 on Merchant of Record, plus 1.5% of
|
|
1987
|
+
* the listed price (before tax) on a card issued outside the US) is charged to you, the partner. The player
|
|
1988
|
+
* pays the listed price (plus any tax) and receives the listed coins. Card purchases only;
|
|
1989
|
+
* purchases through a third-party storefront or payment rail are unaffected. Two shapes,
|
|
1990
|
+
* chosen by what you send:
|
|
1934
1991
|
* - 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
|
-
*
|
|
1992
|
+
* card is never charged more than that total, and the coins are priced off `usdAmount`.
|
|
1993
|
+
* An older, higher fee-inclusive total is accepted and the true, lower total charged. A
|
|
1994
|
+
* total below what INVO would charge now throws `409 QUOTE_STALE` (`err.isQuoteStale`);
|
|
1995
|
+
* nothing was charged.
|
|
1996
|
+
* - without it: the card is charged exactly `usdAmount`, never more.
|
|
1940
1997
|
*
|
|
1941
|
-
*
|
|
1942
|
-
* `
|
|
1998
|
+
* From 2026-10-27 a card purchase under INVO's minimum card purchase ($2.99) throws
|
|
1999
|
+
* `400 BELOW_CARD_MINIMUM` (`err.isBelowCardMinimum`, `err.minUsd`, `err.enforcedFrom`);
|
|
2000
|
+
* until then it is accepted with `minPurchaseWarning`. `AMOUNT_BELOW_FEE` is no longer
|
|
2001
|
+
* returned.
|
|
2002
|
+
*
|
|
2003
|
+
* A `success` result reports `processingFeeUsd` (`"0.00"`), `feeTakenFrom` (`"partner"`),
|
|
2004
|
+
* `partnerFeeUsd`, `internationalCardFeeUsd` (`"0.00"` on a US card or one whose country
|
|
2005
|
+
* is unknown; both `null` if the fee could not be booked yet, which INVO does shortly after),
|
|
2006
|
+
* `coinsCredited` and `chargeTotalUsd`, each as INVO sent it.
|
|
1943
2007
|
*/
|
|
1944
2008
|
async purchaseCurrency(input, opts) {
|
|
1945
2009
|
if (typeof input.playerEmail !== "string" || !input.playerEmail.trim()) {
|
|
@@ -1975,6 +2039,8 @@ var InvoServer = class {
|
|
|
1975
2039
|
if (input.playerName) body["player_name"] = input.playerName;
|
|
1976
2040
|
if (input.playerPhone) body["player_phone"] = input.playerPhone;
|
|
1977
2041
|
if (input.metadata) body["metadata"] = input.metadata;
|
|
2042
|
+
if (input.country) body["country"] = input.country;
|
|
2043
|
+
if (input.subdivision) body["subdivision"] = input.subdivision;
|
|
1978
2044
|
const raw = await this.http.post(
|
|
1979
2045
|
"/api/currency-purchases/purchase-currency",
|
|
1980
2046
|
body,
|
|
@@ -1994,6 +2060,7 @@ var InvoServer = class {
|
|
|
1994
2060
|
feeTakenFrom: optionalDecimalString(raw["fee_taken_from"]),
|
|
1995
2061
|
coinsCredited: optionalDecimalString(raw["coins_credited"]),
|
|
1996
2062
|
chargeTotalUsd: optionalDecimalString(raw["charge_total_usd"]),
|
|
2063
|
+
...pricingFields(raw),
|
|
1997
2064
|
...receiptFields(raw),
|
|
1998
2065
|
raw
|
|
1999
2066
|
};
|
|
@@ -2003,14 +2070,17 @@ var InvoServer = class {
|
|
|
2003
2070
|
* creates nothing, so it is safe to call on every price render (`POST
|
|
2004
2071
|
* /api/currency-purchases/quote`, authenticated by your game secret like the purchase).
|
|
2005
2072
|
*
|
|
2006
|
-
*
|
|
2007
|
-
*
|
|
2008
|
-
*
|
|
2009
|
-
*
|
|
2010
|
-
*
|
|
2011
|
-
*
|
|
2012
|
-
*
|
|
2013
|
-
*
|
|
2073
|
+
* The player pays the listed price plus any tax (when you pass `country`) and receives the
|
|
2074
|
+
* listed coins: `totalUsd` carries no card fee, and `processingFeeUsd` is `"0.00"`. INVO's
|
|
2075
|
+
* card fee (4.5% + $0.30 on Open, 5.5% + $0.50 on Merchant of Record) is charged to you;
|
|
2076
|
+
* `partnerFeeUsd` carries it when INVO sends it. $10.00 quotes a $10.00 total, 100.00 coins
|
|
2077
|
+
* at the default 10 per USD, and a $0.75 partner fee on Open. Show the player `totalUsd`,
|
|
2078
|
+
* then send the same figure back as `acknowledgedTotalUsd` on {@link purchaseCurrency}; the
|
|
2079
|
+
* card is never charged more than that. `ifUnacknowledged` shows the purchase without the
|
|
2080
|
+
* acknowledgement (the card charged exactly `usdAmount`), or `null` when INVO sends none.
|
|
2081
|
+
* `minPurchaseWarning` is set while an amount under INVO's minimum card purchase is still
|
|
2082
|
+
* accepted. Card purchases only; purchases through a third-party storefront or payment
|
|
2083
|
+
* rail are unaffected.
|
|
2014
2084
|
*
|
|
2015
2085
|
* Refusals: `400 INVALID_INPUT` (amount missing, not above zero, or above INVO's card
|
|
2016
2086
|
* maximum), `400 CURRENCY_NOT_CONFIGURED`, `503 RATE_UNAVAILABLE`.
|