@invonetwork/web-sdk 3.24.1 → 3.25.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 CHANGED
@@ -1,1332 +1,1340 @@
1
- # Changelog
2
-
3
- ## 3.24.1
4
-
5
- ### Patch Changes
6
-
7
- - Player activity: on the recipient's entry for a send or transfer from another game, `grossAmount` and `feeAmount` are now filled in the recipient's currency (`grossAmount - feeAmount === amount`). They were `null` on every cross-game entry. Doc comment updated; no type change.
8
-
9
- ## 3.24.0
10
-
11
- ### Minor Changes
12
-
13
- - Player activity: send and transfer entries from `getPlayerActivity` / `iteratePlayerActivity` carry the fee. On the sender's entry `feeAmount` and `netAmount` (what the recipient gets) sit beside the gross `amount`; on the recipient's entry `grossAmount` and `feeAmount` sit beside `amount` (what arrived). While a send waits to be collected they show the fee that will apply; `null` when it ended without being collected, and on the recipient side of a currency-converting transfer. Purchases do not carry them.
14
- - Errors: initiate-send and initiate-transfer amount-limit refusals now carry `error_code` `AMOUNT_BELOW_MINIMUM` / `AMOUNT_ABOVE_MAXIMUM` with the limit. `err.isAmountBelowMinimum` (now also true for these, and on the wallet transfer route where `err.code` stays `INVALID_AMOUNT`), new `err.isAmountAboveMaximum`, `err.minimumAmount`, `err.maximumAmount` and `err.limitCurrencyName`. A sender phone that does not match the one on file now carries `PHONE_MISMATCH` (400); `err.isPhoneMismatch` covers it as well as `registerPlayer`'s 409.
15
- - Webhook types: `identity.passkey_reset` is typed as `IdentityPasskeyResetData` (`identity_id`, `reset_via`, `cooldown_until`, `deactivated_count`). It now also fires for an in-app recovery (`reset_via: "sdk"`) and can be subscribed to by name.
16
- - Nothing removed or renamed.
17
-
18
- ## 3.23.0
19
-
20
- ### Minor Changes
21
-
22
- - Webhook types: `PurchaseEventData` gains `dispute_fee_usd` (`string | null`, USD decimal such as `"15.00"`, `"0.00"` when INVO bears the fee) and `dispute_fee_charged_to_partner` (`boolean | null`), carried on a card `purchase.disputed` when the dispute closes. From November 8, 2026 the card dispute fee on Open-tier card sales (coin purchases, Platform Commerce card sales and subscription charges) is passed through to you at cost. A lost dispute is `purchase.disputed` with `dispute_status: "lost"`, not a separate event. README updated. Both fields optional; nothing removed or renamed.
23
-
24
- ## 3.22.0
25
-
26
- ### Minor Changes
27
-
28
- - e3895ab: 2026-10 pricing and new reads. Server: `getPlayerActivity({ playerEmail, limit?, cursor?, types? })`
29
- (`GET /api/sdk/players/activity`), one merged, newest-first page of a player's currency purchases,
30
- item purchases, Platform Commerce purchases, sends and transfers, and `iteratePlayerActivity`, which
31
- follows `nextCursor`. `platformCommerce.getPurchaseHistory({ playerEmail, limit?, cursor? })`
32
- (`GET /api/platform-commerce/purchase-history`, entries shaped like `getStatus`) and
33
- `platformCommerce.iteratePurchaseHistory`. `getTransferStatus` / `getSendStatus` results carry
34
- `expiryReason` once expired. Webhook types: `TransferEventData` gains `order_id`,
35
- `net_transfer_amount`, `claim_code_expires_at`, `from_game_id`, `to_game_id`, `from_player_id`,
36
- `expired_at`, `reason`, `expiry_reason` and `refunded_amount`; `payout.status_changed` is typed as
37
- `PayoutStatusChangedData`, with the payout fee fields `offboarding_fee_pct`, `offboarding_fee_usd`,
38
- `offboarding_fee_cap_usd` and `net_payout_usd`. New additive `err.publicCode`: the
39
- provider-neutral twin of a code (INVO's `error_code_public` on errors from the API). The SDK's own
40
- pre-network refusal of a Platform Commerce card total under $0.50 keeps `err.code` exactly as
41
- before and now also carries `err.publicCode === "BELOW_CARD_MINIMUM"` and `err.minUsd === "0.50"`;
42
- `err.isBelowCardMinimum` is true as before and accepts both spellings. Nothing removed or renamed. README: the
43
- Open card fee is 3.5% + $0.30 (was 4.5%); the chargeback guarantee is a Merchant of Record term
44
- (Open-tier card payments made before November 8, 2026 keep it); transfers are 10% (3.5% / 3.5% /
45
- 3%); payouts carry a 1% fee capped at $500 per payout; the hosted checkout reports a finished
46
- purchase as status `"completed"`; on `phoneMismatch`, call `updatePlayerPhone`. Additive only.
47
- - Player-confirmed phone change. Server: `requestPhoneChange({ playerEmail, newPhone })`
48
- (`POST /api/sdk/players/phone/change-requests`, 202, never auto-retried) returns
49
- `changeRequestId`, `status`, `expiresAt`, `delivery`, `confirmation` and `message`; INVO emails
50
- the player, who confirms on INVO's page (plus their passkey or enrolled device when they have
51
- one). `getPhoneChange(changeRequestId)` reads the request. Browser, with the player token, on
52
- the player's enrolled device: `listPhoneChangeApprovals()` and
53
- `approvePhoneChange(changeRequestId, { deviceFingerprint, decision?, sign | deviceSignal })`,
54
- which sends a `device_signal` over `phone-change|<id>|<nonce>|<timestamp>` (or
55
- `phone-change-deny|...`); new `phoneChangeSignalMessage()` builds that message. No method sends
56
- a confirmation code: games never collect it. `err.changeRequestEndpoint` on
57
- `PHONE_CHANGE_REQUIRES_VERIFICATION`; new error predicates `isConfirmOnInvoPage`,
58
- `isChangeRequestNotFound`, `isChangeRequestNotReady`, `isChangeRequestNotPending` (with
59
- `changeRequestStatus`), `isChangeRequestInProgress`, `isPhoneChangeLocked`,
60
- `isTooManyChangeRequests`, `isPhoneChangeUnavailable`, `isDeviceSignalRejected`,
61
- `isPhoneChangeRecoveryCooldown` (`PHONE_CHANGE_RECOVERY_COOLDOWN`, 409 on create and approve:
62
- a recent sign-in recovery; retry later, declining still works) and
63
- `isDeviceEnrolledAfterRequest` (`DEVICE_ENROLLED_AFTER_REQUEST`, 409 on approve). New
64
- `isPendingTransfersToOldPhone` / `isPendingTransfersToNewPhone`, which `updatePlayerPhone`
65
- now also answers (409, no counts) as well as the change request routes. Webhook
66
- type: `player.phone_changed` as `PlayerPhoneChangedData` (`new_phone` only for the requesting
67
- game). README section "Player-confirmed phone change": on `phoneMismatch` or
68
- `player.phone_changed`, never push a stored number back; ask the player. Additive only.
69
-
70
- ## 3.21.0
71
-
72
- ### Minor Changes
73
-
74
- - 0238b53: Player registration, phone changes and identity re-key. Server: `mintPlayerToken` takes optional
75
- `playerPhone` and `playerName`; with a phone, a player new to your title is created, and the
76
- result now carries `created` and `phoneMismatch` (previously dropped). New
77
- `registerPlayer({ playerEmail, playerPhone, playerName? })` (`POST /api/sdk/players`) and
78
- `updatePlayerPhone({ playerEmail, newPhone })` (`POST /api/sdk/players/phone`, never
79
- auto-retried). `initiateSend` / `initiateTransfer` results expose `identityRekeyed`,
80
- `playerToken`, `playerTokenExpiresAt`, `identityId` and `claimDeliveryPlanned`; approve results
81
- expose `claimDelivery`. New error predicates `isPlayerTokenStale`,
82
- `isPhoneChangeRequiresVerification`, `isPhoneMismatch`, `isPhoneShareRefused`;
83
- `isPlayerNotFound` also recognises the codeless `player_not_found` 404. A 403
84
- `PLAYER_TOKEN_STALE` on approve is surfaced, never auto-retried: re-mint and retry once.
85
- Additive only. README section "Registering players and changing their phone".
86
-
87
- ## 3.20.0
88
-
89
- ### Minor Changes
90
-
91
- - 1dc07df: Loyalty and rewards. Server: `InvoServer.getPlayerRewards(playerEmail)` reads one player's
92
- loyalty cards with the game secret (`GET /api/sdk/loyalty/players/rewards`). Browser, with the
93
- player token: `InvoClient.getMyRewards()` (the player's cards), `getMyVault()`,
94
- `redeemReward(vaultEntryId)` (the only response with a code; never auto-retried) and
95
- `getRewardsPageLink()` (INVO's hosted "My rewards" page). Every card step carries `progress`,
96
- `{ current, target }`, or `null` when unavailable; `state` decides completion. New error
97
- predicates `isRewardAlreadyRedeemed`, `isRewardNotFound`, `isRewardExpired`,
98
- `isRewardUnavailable` (`inventory_exhausted` / `conflict`); the server read's
99
- `PLAYER_NOT_FOUND` and `INVALID_PLAYER_EMAIL` use the existing `isPlayerNotFound` and
100
- `isInvalidPlayerEmail`. Additive only. README section "Loyalty and rewards".
101
-
102
- ## 3.19.0
103
-
104
- ### Minor Changes
105
-
106
- - 6940139: D-PRICE-012: a subscription card refund, and a lost chargeback not covered by the chargeback guarantee, now cost the partner the whole refunded amount, INVO's card fee included, exactly as a Platform Commerce card refund does. There is no separate payment processor fee on a refund any more: `processingFeeUsd` reads `"0.00"` and `processingFeeBasis` `"none"`.
107
-
108
- Additive, optional fields:
109
-
110
- - `RefundResult.cardFeeChargedToPartnerUsd` and `RefundResult.partnerDebitedUsd` on `subscriptions.refund` (the 200 receipt and the 202 `pending_approval` body). `undefined` on a receipt stored before this release.
111
- - `card_fee_charged_to_partner_usd` and `partner_debited_usd` on the `refund` block of `subscription.refunded` (`SubscriptionRefundDetail`) and on `purchase.disputed` (`PurchaseEventData`, subscription and Platform Commerce losses; `null` where not applicable).
112
-
113
- README: subscription refund costs, lost chargebacks and the "What did I earn?" answer updated.
114
-
115
- ## 3.18.0
116
-
117
- ### Minor Changes
118
-
119
- - 432fb75: INVO's 2026-09 card pricing. On card purchases the partner now pays INVO's card fee (4.5% + $0.30 on Open, 5.5% + $0.50 on Merchant of Record, plus 1.5% of the listed price (before tax) on a card issued outside the US); the player pays the listed price (plus tax where owed) and receives the listed coins. Fraud screening and a chargeback guarantee (a fraud chargeback on a card sale is covered by INVO) are included. Minimum card purchase $2.99 on coin purchases and Platform Commerce card sales, enforced from 2026-10-27. Card purchases only; purchases through a third-party storefront or payment rail are unaffected. All additive:
120
-
121
- - `PurchaseResult` and `CurrencyPurchaseQuote` gain `partnerFeeUsd`, `internationalCardFeeUsd` and `minPurchaseWarning` (`MinPurchaseWarning`: `{ code, minUsd, enforcedFrom, message?, enforced?, raw }`), each set only when INVO sends it. `processingFeeUsd` stays and reads `"0.00"`.
122
- - `FeeTakenFrom` gains `"partner"`. `UnacknowledgedPurchaseOutcome.feeTakenFrom` stays required; INVO always sends it, and should it ever be missing the SDK reads `"partner"` when the quote carries `partner_fee_usd`, otherwise `"coins"` as before.
123
- - `err.minUsd` and `err.enforcedFrom` on `BELOW_CARD_MINIMUM` (`err.isBelowCardMinimum`, which now also covers INVO's minimum card purchase). `err.isAmountBelowFee` is deprecated: `AMOUNT_BELOW_FEE` is no longer returned.
124
- - `acknowledgedTotalUsd` is still honored: INVO never charges more than it, and an older, higher fee-inclusive total is accepted with the true, lower total charged. Only a total below the true total is refused (`QUOTE_STALE`).
125
- - `partnerFeeUsd` and `internationalCardFeeUsd` are `string | null`: `null` only when the fee could not be booked when the purchase completed (the purchase succeeded; INVO books the fee shortly after). `internationalCardFeeUsd` is `"0.00"` on a US card or one whose country is unknown, and always `null` on a quote (no card yet). The quote also carries `feeTakenFrom`, and `ifUnacknowledged.partnerFeeUsd`.
126
- - `createCheckout()` and the Platform Commerce card leg of `platformCommerce.purchase()` return `minPurchaseWarning` while an amount under the minimum card purchase is still accepted. `BELOW_CARD_MINIMUM` also answers a card charge under the $0.50 card floor at any date, on coin purchases, hosted checkout and Platform Commerce: `err.minUsd` reads `"0.50"` there, with no `err.enforcedFrom`.
127
- - `purchaseCurrency()` accepts `country` and `subdivision`, the place you quoted with. On Merchant of Record INVO uses it only when it cannot read the buyer's tax location from the card; without it such a purchase is refused with `409 TAX_PLACE_UNAVAILABLE` (new `err.isTaxPlaceUnavailable`, `err.untaxedTotalUsd`), nothing charged.
128
- - Platform Commerce card refunds: `cardFeeChargedToPartnerUsd` and `partnerDebitedUsd` on the refund result and `card_fee_charged_to_partner_usd` / `partner_debited_usd` on `platform_commerce.refunded` (the card fee is not returned on a refund; it stays charged to you).
129
- - Webhook types: `purchase.completed` gains `partner_fee_usd` and `international_card_fee_usd` (nullable); `purchase.disputed` gains `guarantee_covered` (lost Platform Commerce card sale and subscription disputes only; never on a coin purchase dispute), `order_type`, `developer_revenue_reversed_usd`, `subscription_id`, `period_seq` and `processing_fee_usd` (the processor fee a non-fraud lost subscription chargeback charges you, as a refund does); `platform_commerce.purchased` gains `international_card_fee_usd` (already included in `fee_breakdown.platform_fee`); `subscription.renewed`'s split gains `international_card_fee_usd` (the same figure as `pass_through_fees_usd`, never add them; `partner_revenue_usd` stays gross).
130
- - Behaviour to notice: an unacknowledged $10.00 coin purchase now credits the full 100.00 coins (93.70 under the earlier pricing); an older fee-inclusive acknowledged total is accepted and the lower true total charged; `AMOUNT_BELOW_FEE` is no longer returned.
131
- - README and doc comments: every card fee figure, the Tiers table (card rates, international fee, who pays, fraud screening, chargeback guarantee, minimum card purchase) and the quote example ($10.00 charges the player $10.00; your fee is $0.75 on Open).
132
-
133
- ## 3.17.0
134
-
135
- ### Minor Changes
136
-
137
- - 28a96bf: Webhook payload types: `PurchaseEventData` gains `payment_intent_id` / `charge_id` / `dispute_id` (`string | null`: `null` on a Steam chargeback), `rail`, `steam_transid`, `fully_refunded`, `currency_debited` and `new_balance`. Steam chargebacks now arrive as `purchase.disputed` with the same keys as a lost card dispute, and a Steam partial refund arrives as `purchase.refunded` with `fully_refunded: false`. README: if you revoke on `purchase.refunded`, handle `purchase.disputed` the same way. All additive and optional.
138
-
139
- ## 3.16.1
140
-
141
- ### Patch Changes
142
-
143
- - 9dd2bf5: README: the `isDuplicateClientRequestId` note describes only what the caller sees. Documentation only.
144
-
145
- ## 3.16.0
146
-
147
- ### Minor Changes
148
-
149
- - 58143c2: `warnings` on `createCheckout()` results (typed `CheckoutWarning[]`, mapped from the additive `warnings` field): a checkout session sells game currency, and `metadata` carrying `item_id` / `item_name` now returns `ITEM_METADATA_ON_CURRENCY_SESSION`, pointing to `platformCommerce.purchase` for item sales. New error helpers: `err.isDuplicateClientRequestId` (409 `DUPLICATE_CLIENT_REQUEST_ID` on a Platform Commerce card purchase, with `order_id` / `order_status`; `err.isDuplicateRequest` is also true), `err.isTrialAmountBelowFeeFloor` (400 `TRIAL_AMOUNT_BELOW_FEE_FLOOR`; the message names the smallest accepted trial price) and `err.isIdentityCheckUnavailable` (503 `IDENTITY_CHECK_UNAVAILABLE` on claims and confirm-receipt, retryable). `err.isAmountBelowMinimum` now also covers `purchaseItem`, whose `totalPrice` is rounded to cents. README: refunds take back only the coins still held from that purchase, chargebacks up to the purchase's coins from the available balance, never below zero. All additive and optional.
150
-
151
- ## 3.15.0
152
-
153
- ### Minor Changes
154
-
155
- - 5adf010: `cards.createSetupSession()` takes optional `playerName` and `playerPhone` (mapped to `player_name` / `player_phone`). When the member is new to the game and `playerName` is sent, INVO creates the member exactly as `subscriptions.create` does and then mints the card link, so a brand-new signup can save a card before a paid trial (`subscriptions.create` with `trialAmountUsd` and `playerCardId`). Without `playerName` an unknown member is still `err.isPlayerNotFound` (404). A known member is never re-created or renamed by this call. New `err.isPlayerCreateFailed` (503 `PLAYER_CREATE_FAILED`); a phone already on another member answers `err.isPhoneShareApprovalRequired` (409). The SDK refuses a blank or over-255-character `playerName` and a non-E.164 `playerPhone` before the network (`INVALID_INPUT`, status 0). README: the card page and paid-trial sections show the new-signup order. All additive and optional.
156
-
157
- ## 3.14.2
158
-
159
- ### Patch Changes
160
-
161
- - README: the Merchant of Record chargeback threshold is measured on the previous complete calendar month. Documentation only.
162
-
163
- ## 3.14.1
164
-
165
- ### Patch Changes
166
-
167
- - README: Merchant of Record is applied for from the Selling & Tax page in the INVO console (the page name was wrong in 3.14.0). Documentation only.
168
-
169
- ## 3.14.0
170
-
171
- ### Minor Changes
172
-
173
- - 8f2298b: `credited` and `reasonCode` on `confirmPayment()` and `steamFinalizePurchase()` results (mapped from the additive `credited` / `reason_code` response fields; `status` is unchanged and still means the payment succeeded, so report a completed purchase only when `credited` is `true`). Merchant of Record receipt fields `receiptNumber` / `receiptUrl` on `purchaseCurrency()`, `getOrderDetails()`, `CheckoutClient.getPurchaseStatus()`, `platformCommerce.getStatus()` and `firstCharge`, and `receipt_number` / `receipt_url` (plus `tax_treatment` on `purchase.completed`) on the purchase, Platform Commerce and subscription webhook payload types. README: the tier's effect on responses (`tax_treatment: "partner_responsible"` on Open, receipts and the chargeback reserve on Merchant of Record). Platform Commerce card refunds in parts: optional `refundRemaining` / `confirmAdditionalRefund` on `platformCommerce.refund()`, optional `partialRefund` / `adopted` / `refundedTotalUsd` / `chargeTotalUsd` / `remainingUsd` on its result, and `err.isRefundRemainingRequiresConfirmation` / `err.isRefundRecentlyIssued` / `err.isRefundNotCompleted` (`err.isAlreadyRefunded` is now false for the two refund-in-parts refusals). All additive and optional. README: subscription card charges are 4% + $0.30 on Open and 5% + $0.50 on Merchant of Record (were 7% + $0.30 and 8.5% + $0.30); international card and currency conversion costs on subscriptions pass through at cost; chargebacks by tier; Merchant of Record is applied for from the console.
174
-
175
- ## 3.13.0
176
-
177
- ### Minor Changes
178
-
179
- - INVO's card fee on coin purchases, paid trials, and the two tiers.
180
-
181
- **Coin purchases carry INVO's card fee: 3.5% + $0.30** of the price (on the Open tier), never less than the card cost. `purchaseCurrency` charges in the same request, so there are now two shapes and you pick one by what you send:
182
-
183
- - **Quote, show, acknowledge.** New `server.quoteCurrencyPurchase({ playerEmail, usdAmount, country?, subdivision? })` calls `POST /api/currency-purchases/quote`. It moves no money and creates nothing, and returns `totalUsd`, `amountCents`, `subtotalUsd`, `processingFeeUsd`, `coins`, `currencyName`, a camelCase `breakdown` and `ifUnacknowledged`. Show the player `totalUsd`, then pass it as the new optional `acknowledgedTotalUsd` on `purchaseCurrency`: the card is charged that total, to the cent, and the coins are priced off `usdAmount`. $10.00 quotes $10.65.
184
- - **Send only `usdAmount`.** The card is charged exactly `usdAmount`, never more, and the fee comes out of the coins: $10.00 credits 93.70 coins at the default 10 per USD.
185
-
186
- A `success` result now also carries `processingFeeUsd`, `feeTakenFrom` (`"charge"` or `"coins"`), `coinsCredited` and `chargeTotalUsd`. New error helpers: `err.isQuoteStale` (409 `QUOTE_STALE`, with `err.expectedTotalUsd` and `err.acknowledgedTotalUsd`) and `err.isAmountBelowFee` (400 `AMOUNT_BELOW_FEE`). Nothing is charged on either. `acknowledgedTotalUsd` is shape-checked locally (a positive two-decimal amount) with a ceiling above the largest price, because the fee rides above INVO's card maximum.
187
-
188
- **Refunds of coin purchases:** only unspent coins are refundable; spent coins are never refunded. Documented; no SDK call refunds a coin purchase.
189
-
190
- **Paid trials on card subscriptions.** `subscriptions.create` accepts `trialAmountUsd` (with `trialDays` or `trialEnd`, card only, at least 0.50 and less than `amountUsd`): period 1 is charged the trial price inside the call and `amountUsd` from period 2. The consent object accepts `disclosedTrialAmountUsd`, `disclosedTrialDays` and `disclosedTrialEnd`, and returns `disclosed_trial_amount_usd`, `disclosed_trial_days` and `disclosed_trial_end`. The subscription gains `trialAmountUsd` and, on create and finalize bodies, `trialAmountCoinsEstimate`. Webhook types: `is_trial` on `subscription.renewed`; `is_trial` and `trial_amount_usd` on the trial period's `payment_failed`, `past_due`, `authentication_required` and `expired` (new `SubscriptionTrialEventFields`); `expire_cause` (`"trial_payment_failed"`) on `subscription.expired`. New error helpers: `isPaymentMethodRequired`, `isTrialAmountInvalid`, `isTrialAmountRequiresTrial`, `isTrialAmountNotSupportedForFunding`, `isConsentDisclosedTrialInvalid`. The SDK refuses, before the network and with INVO's own codes, a `trialAmountUsd` without a trial, with `walletOnly: true`, or on `steamInit`; the $0.50 floor and the "less than `amountUsd`" rule are left to INVO.
191
-
192
- **README:** a new Tiers section (Open by default: you are the seller and handle tax; Merchant of Record by application: INVO is the seller and handles tax; fees per tier), the coin fee flow, the refund rule and paid trials. Every statement that INVO is the merchant of record on the card rail for everyone is removed.
193
-
194
- All additive: no export was removed, renamed or retyped, and every new field on an existing type is optional.
195
-
196
- ## 3.12.1
197
-
198
- ### Patch Changes
199
-
200
- - Docs: subscription packages.
201
-
202
- The README's Subscriptions section gains a **Subscription packages** part. A package (the API calls it a plan) is what a developer sells: a name, a price, a billing interval and the `item_id` the game checks. Packages are created, edited, closed and reopened in the INVO dashboard with the developer's own sign-in, never with the game secret or a player token, so this SDK does not wrap them and has no `packages` or `plans` namespace. That is deliberate.
203
-
204
- Nothing about an integration changes. `server.subscriptions.create(...)` and `steamInit(...)` still subscribe a member to an `itemId`, webhooks carry the same payloads, and entitlement still comes from `subscription.renewed`. A package's subscriber counts and monthly revenue are measured per title and `item_id`, so a new package immediately shows the members already subscribed to its item. The section also covers the two counts (`subscriber_count` on basis `active`, `live_subscriber_count` on basis `live`), who a price change applies to, and that closing a package cancels nobody. Full guide: https://docs.invo.network/docs/subscriptions-packages/
205
-
206
- Doc correction: the subscription refund daily limit. The README and the `subscriptions.refund` JSDoc said a game's daily self-serve refund limit is $500 by default. It no longer is: by default the limit is never lower than the largest single subscription charge (`25000.00` USD today), so any single period can always be refunded on its own, and if INVO raises the per-charge maximum the limit rises with it. INVO can still set a specific limit for one game, which applies as set, even if lower. Everything else about refunds is unchanged: reaching the limit exactly still runs, going over it answers HTTP 202 `pending_approval`, and approved requests do not count toward the day. The sandbox recipe now says how to see a 202 (ask INVO for a low limit on the sandbox game).
207
-
208
- Documentation only. No export was added, removed, renamed or retyped.
209
-
210
- ## 3.12.0
211
-
212
- ### Minor Changes
213
-
214
- - The card maximum is INVO's, not the SDK's.
215
-
216
- **INVO raised the maximum single card charge from $999.99 to $100,000.00 on 2026-09-18, and this package was refusing it.** The old limit was enforced client-side and threw before any network call, so a partner charging $50,000 failed inside the SDK and INVO never saw the request. The backend raise was invisible to every SDK user until this release. Per-customer velocity limits rose with it, to 100,000 per hour, 200,000 per day and 1,000,000 per month, all enforced by INVO.
217
-
218
- **The design decision: the floor is a fact, the ceiling is a policy, and only facts belong in a client.**
219
-
220
- $0.50 is the card rail's own minimum charge. Below it nothing settles in any environment, INVO holds it as a plain constant rather than a setting, and no configuration makes a smaller amount chargeable. That check stays exactly where it was and still throws before any request (`BELOW_STRIPE_MINIMUM`, `err.isBelowCardMinimum`).
221
-
222
- The maximum is the opposite. It is a runtime setting an INVO admin edits without a deploy, and it differs between sandbox and production. Any number pinned in a published package is stale the moment somebody changes it, and the only remedy is a release, which is precisely the failure this release is repairing. So the local ceiling is **removed** rather than re-pinned at $100,000.00. It was not replaced by a fetch of the live limits either: that would turn one purchase call into two network calls, add a failure mode and a cache to a money path, and still be a snapshot rather than the truth at the moment of charge, because only the request itself is evaluated against the setting in force.
223
-
224
- What remains is a structural bound. `usdAmount` and a card `totalPrice` must still be a positive amount with at most two decimals, and must still be at most `999999.99`, the same house ceiling every other money field in this SDK uses. That figure is deliberately **above** the largest value INVO's setting is permitted to take, so it can never refuse an amount INVO would have accepted. The invariant for anyone editing this later: the local bound must never be tighter than the server's maximum possible limit. This SDK may cost you a wasted round trip. It must never cost you a sale that a package upgrade would have allowed.
225
-
226
- **What changed for you**
227
-
228
- - Amounts between `999.99` and `999999.99` are now sent instead of being rejected locally. Nothing that worked before stops working; the validation only loosened.
229
- - `err.isAboveCardMaximum` is unchanged and still means what it always meant, but it now arrives only from INVO (a `400`), never from the SDK. Nothing was charged.
230
- - An amount above `999999.99` now throws `INVALID_INPUT` where it previously threw `ABOVE_CARD_MAXIMUM`. That range is malformed input, not a policy refusal, and INVO classifies it the same way.
231
-
232
- **When INVO refuses an amount the SDK allowed**, catch `err.isAboveCardMaximum`. `err.message` carries the figure that was in force for that request, for example "Card purchases must be $100,000.00 or less." Do not retry it unchanged: lower the amount, split the sale, or ask INVO to raise the setting. The live figure for a tenant is also the `max_amount` of the hosted checkout's `validate-game` read, next to `min_amount`; read that if you want to show a limit in your own UI, and re-read it, because it can change under you. A velocity limit is a `429` with `err.retryAfter`, not this error.
233
-
234
- **README: the minimum is $0.50.** The docs said only `0 < x <= 999.99` and left the floor unstated. They now state $0.50, which is what INVO advertises and what the card rail actually enforces. A $1.00 minimum was advertised by INVO's own checkout read until 2026-09-18 and was enforced nowhere; it is gone rather than enforced, because enforcing it would newly refuse charges between $0.50 and $0.99 that settle today.
235
-
236
- No export was added, removed, renamed or retyped.
237
-
238
- ## 3.11.0
239
-
240
- ### Minor Changes
241
-
242
- - The purchase status read, and the subscription fee is 7%.
243
-
244
- **A buyer can always be told what happened to the money they paid.** `invo.checkout` (and the standalone `CheckoutClient`, for a page with no player token) reads `GET /api/checkout/sessions/<id>`, authenticated by the SESSION token; the id in the path is a label, not a credential. `getPurchaseStatus({ sessionId, sessionToken })` reads once; `waitForPurchase({ ..., intervalMs, timeoutMs, maxAttempts, signal, onUpdate })` polls until INVO says it is finished and returns that result. Six statuses, four of them terminal, plus `orderId`, `coinsCredited` / `transactionId` / `newBalance` on a credit, `reasonCode` + a player-safe `message` on a refusal, and both money figures (`amountChargedUsd`, `listedUsd`) so a buyer billed 206.29 for a 200 pack can be shown where the 6.29 went.
245
-
246
- `terminal` is read off the response and is NEVER recomputed from `status`, so a status a later backend introduces cannot make this build decide a purchase finished, or finished well. A status it does not recognise is not terminal and is never a success. `paid_pending_credit` is deliberately not terminal at any age: INVO's reconciler recovers a stalled credit. A failed poll is not a failed purchase: network, timeout, 429 and 5xx are polled through; 401, 403 and 410 are raised at once (`isWrongSessionPurpose`, `isCheckoutSessionMismatch`, `isCheckoutSessionExpired`). On the cap `waitForPurchase` returns the last result it read rather than throwing, so the page keeps showing something true.
247
-
248
- `CheckoutPurchaseStatus` is a widened union (`… | (string & {})`), not a literal one, and a tsc test pins that partner code storing or comparing an unknown status still compiles, which is the fix 3.10.0 had to make to `RefundResult` after the fact. It is named `Checkout…` because `PurchaseStatus` is already the direct `purchaseCurrency` result and is unchanged. New: `CheckoutClient`, `InvoClient.checkout`, `isPurchaseCredited` / `isPurchaseRefused` / `isPurchaseRefunded` / `isPurchaseExpired`, `nothingWasCharged` (true only where INVO said no money was taken; everything else, an unknown code included, happened after the card was charged, so never put a Try again on it), and the types `PurchaseStatusResult`, `PurchaseStatusInput`, `WaitForPurchaseInput`, `PurchaseRefusalReason`, `PurchaseCredited` / `PurchaseRefused` / `PurchaseRefunded` / `PurchaseExpired`, `CheckoutClientConfig`.
249
-
250
- `createCheckout()` now also returns `sessionToken`, read from INVO's `session_token` field (backend commit `856fa266`) and falling back to the `checkout_url` query string only for a server that predates it, so nothing has to parse a URL to use the read. The two cannot disagree, and if a response ever carried both and they differed the field wins, because a query-key spelling is not a contract.
251
-
252
- **Doc fix: INVO's subscription fee is 7% plus $0.30, not 10%** ($9.99 pays INVO $1.00 and you $8.99). Subscriptions became their own rate on 2026-09-17; item purchases stay at 10/90. No code change.
253
-
254
- **Not included: withdrawals.** INVO's withdrawal request and history reads gained additive `kyc_hold`, `kyc_hold_reason` and `next_steps` fields on 2026-09-17. This package exposes no withdrawal surface at all, so there is nowhere for them to go, and adding one is a separate decision rather than part of a documentation pass.
255
-
256
- **Fixed: the User-Agent version had drifted.** `SDK_VERSION` was left at `3.10.0` when 3.10.1 published, so every server call from 3.10.1 reported a version that was not the one running, and the test pinning it to `package.json` was failing on `main`. Back in step, and the pin is green.
257
-
258
- ## 3.10.1
259
-
260
- ### Patch Changes
261
-
262
- - `linkDevice()` takes no arguments. The server mints the link id, so requiring one was wrong: callers had to invent a placeholder. The parameter stays optional and any value passed is still sent and ignored by the server, so code written against 3.10 keeps working unchanged. The README now also states that a tenant whose players enrol a passkey on the tenant's own domain MUST offer `linkDevice()`, because that credential can only be asserted on that tenant's origin, and that recovery is never the answer to `ENROLLMENT_REQUIRES_PROOF`.
263
-
264
- ## 3.10.0
265
-
266
- ### Minor Changes
267
-
268
- - f66103c: Card-only subscriptions and subscription refund guardrails (INVO backend, 2026-09-17). Everything here is additive: no field, type or behaviour of an existing call was removed or renamed.
269
-
270
- **Card-only subscriptions (behaviour change on INVO's side, no type changes).** A card subscription's card is now charged the full price every period; the member's coin wallet never pays for it and never moves. Steam subscriptions are unchanged (wallet first, Steam tops up the shortfall).
271
-
272
- - `subscription.renewed` on the card rail: `funding.balance_applied_coins` is always `"0.00"`, `funding.card_charged_usd` is the price, `mint_order_id` is never `null`.
273
- - Every paid card renewal also emits `purchase.completed` with `data.metadata.source === "subscription_renewal"`. Do not grant currency from it; `subscription.renewed` is the entitlement signal.
274
- - A member with no saved card fails with `failure_code: "no_payment_method"` whatever their balance. New additive `failure_code`: `wallet_negative`.
275
- - `walletOnly` is marked `@deprecated` (still accepted and returned): a wallet-only card subscription can never be paid (`failure_code: "wallet_only"`).
276
- - `subscription.authentication_required`: `card_amount_usd` now equals `amount_due_usd` on card challenges.
277
- - Doc fix: the `amountUsd` JSDoc now states the per-charge ceiling of `25000.00` (it still said `500.00`), and `SubscriptionExpiredData` no longer says `steam_containment` is sent.
278
-
279
- **Subscription refund guardrails.**
280
-
281
- - `subscriptions.refund` can now return a refund request. `RefundResult` stays a single interface (its `status` is typed `"refunded" | "pending_approval" | (string & {})`, so any string still assigns and compares); branch with the new `isRefundPendingApproval(r)` type guard, which narrows to `RefundPendingApproval`. `"pending_approval"` is the new HTTP 202: the refund would exceed the game's daily self-serve limit ($500 by default), nothing moved, and INVO reviews it as a refund request (`requestId`, `requestStatus`, `requestedAmountUsd`, `requestedAt`, `dailyCapUsd`, `executedTodayUsd`, `message`). Both carry every receipt field; the `request*` fields are optional on `RefundResult` and required on `RefundPendingApproval`. The status string is passed through from INVO unchanged.
282
- - New optional result fields: `warnings` (`REASON_RECOMMENDED`, `REASON_TRUNCATED`), `subscriptionCanceled`, `subscriptionStatus`, `processingFeeUsd`, `processingFeeBasis`, `processingFeeBorneBy`, `processingFeeTransactionId`, `partnerTotalReversedUsd`, `initiation`, `refundRequestId`. `undefined` on receipts stored before the change.
283
- - `reason` is documented as recommended now and required after a notice period. Refunds run within 30 days of the charge. A full refund cancels the subscription. Card-only periods are refunded in cash, partial included. The partner bears the card processor fee. INVO emails the member.
284
- - New `InvoError` classifiers: `isRefundsNotEnabled` (403), `isRefundWindowClosed` (409), `isRefundRequestPending` (409), `isRefundRequestRejected` (409), `isConcurrentRequest` (409), `isRefundMismatch` (502), with body accessors `refundRequestId`, `decisionReason`, `periodChargedAt`, `refundWindowDays`, `refundWindowClosedAt`.
285
- - New webhook types: `subscription.refund_requested`, `subscription.refund_approved`, `subscription.refund_rejected` (`SubscriptionRefundRequestData`, `SubscriptionRefundApprovedData`, `SubscriptionRefundRejectedData`). Additive fields on `subscription.refunded` (`refund.processing_fee_*`, `refund.partner_total_reversed_usd`, `initiation`, `refund_request_id`, `subscription_canceled`) and `subscription.canceled` (`cancel_cause: "full_refund"`).
286
- - New exports: `isRefundPendingApproval`; types `RefundReceipt`, `RefundPendingApproval` (both extend `RefundResult`), `RefundWarning`, `RefundInitiation`, `RefundProcessingFeeBasis`.
287
-
288
- **Compatibility.** Additive only. Code that compares `status` to any string, builds `RefundResult` mocks with a `string` status, or `extends`/`implements` `RefundResult` keeps compiling (pinned by a tsc test). `subscription.refunded`, `subscription.refund_approved` and, on a full refund, `subscription.canceled` are sent together and may arrive in any order.
289
-
290
- README: the Subscriptions section states card-only funding, the renewal `purchase.completed` trap, the refund limits and the 202, the new events and classifiers, and "what did I earn" now subtracts `partner_total_reversed_usd`.
291
-
292
- ## 3.9.0
293
-
294
- ### Minor Changes
295
-
296
- - The INVO-hosted card page is the recommended way to save a card for a subscription.
297
-
298
- New on `invo.cards`:
299
-
300
- - **`createSetupSession({ playerEmail, successUrl?, cancelUrl?, metadata? })`** ->
301
- `{ sessionId, cardSetupUrl, expiresAt, raw }` (`POST /api/checkout/card-setup-sessions`,
302
- game secret header). Mint a 10-minute link server-side, send the member to `cardSetupUrl`
303
- (top-level, never framed), and read the saved card's `id` back from `cards.list`; it appears
304
- there immediately, carries the off-session consent a subscription needs, and no event fires
305
- for it. No browser code, no client secret, no card processor named anywhere, so INVO can change
306
- processor without partners changing anything. Never auto-retried: each call mints a fresh link.
307
- Script-scheme `successUrl` / `cancelUrl` values are refused before the network (`INVALID_INPUT`,
308
- status 0), matching INVO's own rule.
309
- - `beginSetup` / `confirmSetup` are now documented as the **processor-bound alternative**: they
310
- hand back a `clientSecret` only the current processor's client library can consume, so a card
311
- form built on them needs rework when INVO changes processor.
312
-
313
- New error classifiers: `isPlayerNotFound` (404 `PLAYER_NOT_FOUND`: the card page never creates
314
- players), `isInvalidPlayerEmail` (400 `INVALID_PLAYER_EMAIL`), `isInvalidInput` (`INVALID_INPUT`,
315
- at status 0 from the SDK's own guards or 400 from INVO for a script-scheme URL).
316
-
317
- Fixed: `subscriptions.get(id, { includePlayer: true })` never populated `player`. INVO puts
318
- `player_email` / `player_name` on the subscription object itself, not in a separate block; they
319
- are now surfaced as `subscription.playerEmail` / `subscription.playerName`, and `player` is
320
- derived from them.
321
-
322
- README: a "Cards for subscriptions" section a partner can follow start to finish (mint, send,
323
- read the card back, subscribe, what each error means, the 10-minute session, no browser code).
324
-
325
- README corrections that ride along in this release: `subscription.expired` no longer carries
326
- `failure_code: "steam_containment"` (a balance is spendable in any title whatever rail bought
327
- it, so the "wallet value that cannot be spent in this game" deferral is gone from the deferrals
328
- paragraph and the event table); the Steam transfer-policy note now says it is a rule about
329
- currency moving between titles, not about spending (an item purchase never fails on origin);
330
- and "game" reads "title" in a few places so a platform tenant is not misled by the word.
331
- Line endings: a `.gitattributes` (`* text=auto eol=lf`) keeps the packed README, CHANGELOG and
332
- package.json LF on every checkout (3.9.0's first build packed CRLF from a Windows checkout).
333
-
334
- ## 3.8.1
335
-
336
- ### Patch Changes
337
-
338
- - Subscription docs: the per-charge ceiling is 25000.00, not 500.00, and it is
339
- per CHARGE rather than per month. An annual plan bills the whole year in one
340
- go, so a $500 a month plan sold as a 12-month plan is a single $6,000 charge
341
- and is chargeable. The old number quietly refused every annual plan above
342
- $41.66 a month.
343
-
344
- ## 3.8.0
345
-
346
- ### Minor Changes
347
-
348
- - Subscriptions are a first-class server surface, on both rails, with the card capture and the
349
- sandbox clock tools beside them.
350
-
351
- New on `InvoServer`:
352
-
353
- - **`invo.subscriptions`**: `create` (card rail; charges the first period before answering,
354
- idempotent on `clientRequestId`, a repeat is a typed `idempotentReplay: true` result),
355
- `get`, `listForPlayer`, `cancel` (an already-terminal row is a 200 `alreadyCanceled`, never
356
- thrown), `changeAmount` (staged for the next renewal), `setPaymentMethod`, `refund`
357
- (idempotent; the receipt replays), `steamInit` and `steamFinalize` (Steam rail;
358
- `alreadyProcessed` is a result, not an error).
359
- - **`invo.cards`**: `beginSetup` / `confirmSetup` / `list`: the off-session card capture a
360
- card subscription needs. The hosted checkout does not save a card for subscriptions.
361
- - **`invo.sandbox.subscriptions`**: `advanceClock` / `forceRenewal` / `forceFailure` /
362
- `forceAuthChallenge`. These post to `/subscriptions/<id>/...` **relative to the sandbox
363
- base URL, not under `/api`**, and send `X-Sandbox-Clock-Key` from the new
364
- `sandboxClockKey` config; a missing key throws before the network.
365
-
366
- Typed results: `SubscriptionResult` (the subscription object with its TWO clocks,
367
- `firstCharge` with `paidPeriodSeq`, `card`, `idempotentReplay`), `FirstCharge` (`paid` |
368
- `requires_action` | `skipped_trial` | `failed` | `pending` | `pending_authorization`),
369
- `SteamInitResult` (`steamOrderId` for the client callback, `amountCoins`, `pendingReuse`),
370
- `CancelResult`, `ChangeAmountResult`, `RefundResult`, `CardSetupResult`, `SandboxClockResult`
371
- (`engineStats`), and typed `data` for all seven `subscription.*` webhook events.
372
-
373
- Error classifiers: `isActiveSubscriptionExists` (+ `existingSubscriptionId`),
374
- `isIdempotentReplayMismatch` (+ `mismatchedFields`), `isSteamReauthorizationRequired`,
375
- `isNotACardSubscription`, `isSteamChannelRequired`, `isSubscriptionTerminal`,
376
- `isNotAuthorized`, `isSandboxClockUnauthorized`, `isSteamRefundNotSupported`, `isFlowPaused`,
377
- `isGameNotLive`; `isSteamAuthorizationPending` now also covers the subscription 409.
378
-
379
- Also: the server `User-Agent` version now derives from the package version (it had read
380
- `3.0.0` since 3.0.0), pinned by a test.
381
-
382
- ## 3.7.0
383
-
384
- ### Minor Changes
385
-
386
- - Device approval grant (RFC 8628) is now a first-class server surface — including **the
387
- step that moves the money**.
388
-
389
- An integrator followed the README, polled a grant to `approved`, and stopped. Nothing
390
- moved: an approved grant is a _factor_, and the transaction sat at
391
- `pending_pin_verification` until it expired and was refunded. The README's section ended
392
- at the poll and neither package had a method for the step after it. Both halves of that
393
- are fixed here.
394
-
395
- New on `InvoServer` (all authenticate with the **player token** — on a console the game
396
- server holds the token it minted, and the game secret is never sent):
397
-
398
- - `beginDeviceApproval({ playerToken, transactionId, flow, channel? })` → the RFC 8628
399
- §3.2 grant (`deviceCode`, `userCode`, `verificationUriComplete`, `expiresIn`,
400
- `interval`, `channel`). `channel: "popup"` is refused before the network — it is
401
- browser-only (`InvoClient.approveHosted`).
402
- - `pollDeviceApproval({ playerToken, deviceCode })` → a typed outcome
403
- (`authorization_pending` / `slow_down` / `approved` / `access_denied` /
404
- `expired_token`), plus the `enrollment` object while a first-time phone waits on the
405
- game screen. `invalid_grant` throws.
406
- - `confirmDeviceEnrollment({ playerToken, deviceCode, decision })` → answers the
407
- on-screen match-code prompt (`"approve"` | `"deny"`).
408
- - **`approveWithDeviceCode({ playerToken, transactionId, flow, deviceCode })` — the money
409
- step.** Routes by flow: `send` → `/api/sdk/send/{id}/approve`, `transfer` →
410
- `/api/sdk/transfers/{id}/approve`, `send_receipt` →
411
- `/api/sdk/send/{id}/confirm-receipt`, `transfer_receipt` →
412
- `/api/sdk/transfers/{id}/confirm-receipt`. Never auto-retried.
413
- - `completeDeviceApproval(...)` — convenience loop: polls honouring `interval` and
414
- `slow_down`, surfaces the enrollment prompt, then calls `approveWithDeviceCode`.
415
-
416
- **`TRANSACTION_NOT_PENDING` is a result, not a throw.** `approveWithDeviceCode` returns
417
- `{ status: "not_pending", alreadySettled, currentStatus }` so "your earlier attempt
418
- already landed" is distinguishable from a real refusal **without string-matching** — the
419
- difference between "the guard worked" and "her currency is stuck". Every other refusal
420
- stays a typed thrown `InvoError`.
421
-
422
- `alreadySettled` is **flow-aware and fails closed**. The four endpoints gate on different
423
- status sets — the sender approves accept `pending_pin_verification` /
424
- `pending_verification`, the two receipt endpoints accept `pending_claim` / `verified` — so
425
- a receipt settle landing on `pending_pin_verification` means the SENDER has not approved
426
- yet (possibly held at a guardian 202). That is _before_ the step, not past it, and calling
427
- it settled would tell a game to hand over goods for value never credited. It is an
428
- allow-list per flow rather than a "not expired/failed" deny-list, so a status INVO adds
429
- later answers `alreadySettled: false` with `currentStatus` set — go read the transaction —
430
- instead of defaulting to "the money moved" in already-deployed copies of this SDK.
431
-
432
- Older backend bodies that carried only the message ("Transaction not pending…", "…cannot
433
- be confirmed…") with no machine code are matched too, but narrowly: HTTP 400, one of those
434
- two phrases, **and** a readable `(current status: …)` / `(status: …)` clause. "cannot be
435
- confirmed" is ordinary English, so a phrase match alone can never assert that money moved.
436
-
437
- New `InvoError` predicates: `isTransactionNotPending`, `currentTransactionStatus`,
438
- `isDeviceApprovalNotApproved`, `isDeviceApprovalAlreadyPending`,
439
- `deviceApprovalExpiresAt`, `isSettleFault`, `errorRef`. The RFC 8628 §3.5 tokens are
440
- promoted onto `err.code`.
441
-
442
- Two safety fixes in `completeDeviceApproval`: `transactionId` is validated **before** the
443
- loop (an empty id used to poll for minutes, let the player approve, and only then throw —
444
- an approved grant with nothing settled), and the `respond` callable handed to
445
- `onEnrollment` now resolves quietly for every "the prompt is moot" refusal
446
- (`expired_token`, `invalid_grant`, and the two enrollment 409s) instead of rejecting. A
447
- prompt on a TV routinely outlives its ten-minute grant, callers fire `respond` without
448
- awaiting it, and an unhandled rejection exits a Node process.
449
-
450
- README: the console section is rewritten around begin → show the QR → poll → **call
451
- `approveWithDeviceCode`** → webhooks, with the supersede-vs-409 begin semantics corrected
452
- and "consumed when used" replaced by _when_ the code is spent. A new top-level **Sends and
453
- transfers, stage by stage** section covers both flows and both sides with a
454
- call-order table, an error table, and a common-mistakes box led by "polling to `approved`
455
- and stopping". The error tables now also carry the receipt-flow-only refusals a console
456
- recipient meets (`receiver_not_enrolled_use_claim_code`, `not_intended_receiver`, the
457
- phone-share 409, `RECIPIENT_IDENTITY_PENDING` / `_DECLINED`) and a warning that a settle
458
- FAILURE is ambiguous about the money — INVO commits and then reads the transaction back to
459
- build its 200, so a `*_FAILED` or a timeout can both describe money that already moved:
460
- read the transaction status before telling the player it failed, and never auto-start a
461
- replacement. SMS is now confined to a clearly-labelled legacy-fallback subsection.
462
-
463
- ## 3.6.0
464
-
465
- ### Minor Changes
466
-
467
- - New: `InvoClient.approveHosted({ transactionId, flow })` — web games approve on INVO's
468
- hosted identity page. The browser is the RFC 8628 client: with the player token it already
469
- holds, the SDK calls `POST /api/sdk/approvals/device/begin` with `channel: "popup"` (INVO
470
- records the page's `Origin` as the popup's opener), opens the hosted page in a popup
471
- (synchronously, inside your click handler), polls `poll` honouring `interval` and
472
- `slow_down` (+5 s), drives the INVO-branded match-code prompt from the poll's `enrollment`
473
- object ("Set up INVO on iPhone? Code 48-27. Say Yes only if the phone you just
474
- scanned/opened shows this code." → `confirm-enrollment`; `confirmed` shows "Finishing on
475
- iPhone… / Stop it, wrong code"; a 409 already-decided takes it down quietly), and when the
476
- poll says `approved` calls the flow's approve endpoint with the `device_code` —
477
- `transfers/{id}/approve`, `send/{id}/approve`, `send/{id}/confirm-receipt`,
478
- `transfers/{id}/confirm-receipt`. Resolves `{ status: "approved", approval }` (the same
479
- `ApproveResult` / `ConfirmReceiptResult` the in-app calls return) or `denied` / `expired` /
480
- `closed` / `blocked` / `redirected`; rejects with `InvoError` when the backend refuses.
481
- `device_code` lives in the call's closure only — never on the result, never logged. The
482
- page's `postMessage` is a wake-up that triggers an immediate poll (accepted only from the
483
- hosted page's https origin and only from the popup the SDK opened), never a result. A
484
- popup blocked by the browser resolves `blocked` before anything is started (default);
485
- `popupBlocked: "redirect"` opts in to a full-tab redirect. A page sending
486
- `Cross-Origin-Opener-Policy: same-origin` is detected and reported as `blocked` with a
487
- hint. Your server does nothing new; its `device_approval.approved` webhook still fires.
488
- In-app partner-domain passkeys are unchanged and remain supported. `onEnrollment(e,
489
- respond)` + `renderPrompt:false` let a game draw its own prompt.
490
-
491
- Docs: new "Web games — approving on INVO's hosted page" section; the console-flow poll
492
- example now shows `match_code`. Test-only devDependency added: `happy-dom`.
493
-
494
- Docs (hosted identity pages, Phase 7): the console section documents `channel` on
495
- `begin` (`qr` default | `popup` — the browser must call `begin` itself, its https `Origin`
496
- becomes the popup's opener, server-to-server callers are refused | `app_browser` — the
497
- mobile plugins; the return scheme `invo-sdk-<game_id>` is derived server-side), the echoed
498
- `channel` on the begin body, `recovery` on the poll's `enrollment` object, the hosted
499
- passkey-recovery flow (screen confirm + emailed single-use link → old INVO passkeys
500
- deactivated, `identity.passkey_reset` webhook, 24-hour `PASSKEY_RECOVERY_COOLDOWN` on
501
- money out; receiving unaffected), the mobile auto-confirm note (`app_browser` enrolment is
502
- confirmed by INVO, no prompt), and `ENROLLMENT_REQUIRES_PROOF` on the page. Sends &
503
- transfers: guardian approval now goes by email first (`consent_channel` and
504
- `resend_endpoint` on the raw 202 `guardian_approval` block; `decision_source: "email_link"`),
505
- the once-per-approval `POST /api/sdk/approvals/guardian/{approvalId}/resend` `{channel:"sms"}`
506
- contract (initiator's token; 403/409/410/503 codes), and phone-share / recipient-identity
507
- consents on the same hosted page (unchanged 409 / 202 codes, `consent_channel` on the
508
- phone-share body). Passkeys: the partner-domain freeze — new titles have nothing to verify
509
- (`409 PARTNER_RP_FROZEN`; `WEBAUTHN_NOT_ENABLED_FOR_TENANT` is the expected state, use
510
- `approveHosted`), tenants with a domain verified before the freeze keep it, removal is
511
- irreversible. The "SMS first, then email" fallback sentence corrected to "email first, SMS
512
- on request". Documentation only.
513
-
514
- ### Patch Changes
515
-
516
- - Docs: the device-approval page (RFC 8628, consoles / TVs / native Steam and desktop
517
- clients) now enrols the player's INVO passkey on the **first** scan, and the proof is the
518
- game screen: the phone says "confirm on your game screen", the game shows "Set up INVO on
519
- this phone: iPhone?", the player presses Yes on the console, and the phone's biometric
520
- creates the passkey and approves — no code to type, no SMS; every later scan is scan,
521
- biometric, done. The "the player needs an INVO passkey" bullet is replaced accordingly.
522
- Documents the two integrator-facing additions: the `enrollment` object
523
- (`state` / `device_label` / `requested_at`) on the `authorization_pending` poll body while
524
- a phone is waiting, and `POST /api/sdk/approvals/device/confirm-enrollment`
525
- (`{device_code, decision: "approve" | "deny"}`, same auth as begin/poll; deny ends the
526
- grant with `access_denied`), plus the backup email. Also documents two backend
527
- behaviours: `begin` extends the transaction's own approval window past the code's expiry
528
- (`transfer` / `send`), and `begin` may be called again for the same transaction once an
529
- approved code's window has passed. Documentation only — no code or type changes; the
530
- `begin`/`poll` endpoints, the `device_approval.approved` webhook and its `method` value
531
- are unchanged.
532
-
533
- Also on the send side: the claim SMS now carries a link to a hosted INVO claim page where
534
- a recipient without the game collects with one email + an emailed code + their phone's
535
- passkey (in-game claim unchanged; `transfer.received` fires the same); documents the
536
- sender-token REST call `POST /api/sdk/send/{transactionId}/resend-claim` (30-second
537
- cooldown, 10 per transaction per hour — no SDK method); and that an uncollected send is
538
- still refunded at 24 hours but the sender is now emailed and the recipient texted, with
539
- `transfer.claim_expired` / `transfer.refunded` as the source of truth. The `transfer.*`
540
- rows were added to the event-types table.
541
-
542
- - df2efe9: Docs: add an explicit per-platform verification/approval recommendation. The
543
- "gold standard" section now spells out which method fits which client — a passkey
544
- directly on mobile app/web and desktop web, and the QR device-approval flow
545
- (RFC 8628) on consoles **and** on native Steam / desktop game clients (Mac &
546
- Windows), where it is the embedded game client, not the OS, that can't invoke the
547
- platform authenticator. Also documents the SMS-first-then-email fallback for
548
- remote approvals with no passkey path. Documentation only — no code or type
549
- changes; the `VerificationMethod` union and the device-approval REST flow are
550
- unchanged.
551
-
552
- All notable changes to `@invonetwork/web-sdk` are documented here. This project follows
553
- [Semantic Versioning](https://semver.org/). Releases are managed with
554
- [changesets](https://github.com/changesets/changesets).
555
-
556
- ## [3.5.0] - 2026-09-01
557
-
558
- **The Steam purchase flow is now first-class SDK surface: `steamPacks()`, `steamInitPurchase()`, `steamFinalizePurchase()`** — plus browser-based checkout for platforms where the Steam overlay does not render, a finalize-poller error taxonomy, and webhook `channel` typing. No breaking changes.
559
-
560
- Until now the SDK only _steered away_ from Steam (`purchaseCurrency` fails fast on `rail: "steam"`); the dedicated endpoints had to be called by hand. All three are typed methods now, and the fail-fast message names them.
561
-
562
- ### Added
563
-
564
- - **`InvoServer.steamPacks(query?)`** — the pack catalogue. `currencyAmount` is per-player (VAT and the storefront's revenue share come out of the sticker before currency is derived — a $4.99 pack yields 34, not 50, units at $1 = 10). Render it verbatim; never compute currency from price and never cache one answer for all players.
565
- - **`InvoServer.steamInitPurchase(input)`** — start the purchase. Idempotent on `purchaseReference` (retries, including manual retries after a 409, MUST reuse it). New authorization modes:
566
- - `usersession: "client"` (default, unchanged): Steam overlay in-game. The SDK sends **no** `usersession` key at all in this mode, pinned by test, so existing behaviour cannot shift.
567
- - `usersession: "web"`: for platforms where the overlay does not render (observed: Electron on macOS). Requires `playerIp` — the PLAYER's address, never your server's; refused client-side before the network without it. Returns `steamCheckoutUrl`: Steam's own hosted approval page, which must open as a **top-level tab** (it cannot be iframed). _Note: Steam's sandbox issues checkout URLs its production host will not serve, so web-session approval is provable only against production; the rest of the flow is identical to client-session._
568
- - `metadata` — echoed on the `purchase.completed` webhook (`data.metadata`) — the way to correlate your own player/order ids. The Steam rail merges its own context keys (`steam_wallet_currency`, `steam_country`, `steam_account_status`, `vat_rate_pct`) into the echoed object; avoid those names in yours.
569
- - **`InvoServer.steamFinalizePurchase({orderId})`** — capture + credit. Idempotent: a replay returns `alreadyProcessed: true` and never credits twice.
570
- - **Finalize poller taxonomy on `InvoError`** — because _not every 409 means "not yet"_, and a poller that assumes so polls a dead order forever:
571
- - `isSteamAuthorizationPending` — player has not approved yet (Steam reports `Init`). The normal wait state; poll again.
572
- - `isSteamAuthorizationDead` — any settled status — `Cancelled`, `Failed`, `Refunded`, `Chargedback`, and every other non-Init outcome (pending is the CLOSED set: only `Init` means "not yet"). Stop; no later call can succeed.
573
- - The two are mutually exclusive by construction, and a test pins that they can never both answer true.
574
- - **`InvoError.isPartnerCreditUnavailable`** (`PARTNER_CREDIT_UNAVAILABLE`, 409) — the studio's settlement float cannot cover the purchase. Structure is fine; the money is not. Plain failure toast; do **not** hot-poll init (each attempt briefly re-reserves headroom), and reuse the same `purchaseReference` on manual retry.
575
- - **`InvoError.isPartnerRailSuspended`** (`PARTNER_RAIL_SUSPENDED`, 409) — terminal from the game's seat. The umbrella `isPartnerSettlementUnavailable` still covers both.
576
- - **`InvoError.isUnknownSteamPack`** (400) — re-fetch `steamPacks()`; the body's `valid_pack_ids` lists what exists.
577
- - **`InvoError.isMissingPlayerIp`** (400) — always an integration bug on web sessions.
578
- - **`PurchaseCompletedData.channel`** — which storefront the purchase came from (`"steam"` / `"ios"` / `"android"` / `"web"` / `"console"`), beside `rail`. `null` means a legacy game key: a real answer ("unattributed"), read it as one.
579
-
580
- ### Changed
581
-
582
- - `purchaseCurrency`'s `rail: "steam"` fail-fast message now names the real methods instead of vaguely citing "dedicated endpoints".
583
-
584
- ## [3.4.0] - 2026-09-01
585
-
586
- **A Steam title now bills through its OWN Steam application.** New error helpers;
587
- no breaking changes to any existing method or type.
588
-
589
- ### Why this is a real change and not a doc tidy
590
-
591
- Steam pays whoever owns the Steam application. Until now, INVO documented a
592
- single INVO-owned Steam app that billed every title on the network — so a studio
593
- had nothing to register and the money reached them through INVO. That model is
594
- gone. Each title sells through the studio's own Steam app, the money lands in
595
- their own Steamworks account, and INVO issues the player's currency immediately
596
- and settles with the studio afterwards against a payment method on file.
597
-
598
- If you shipped against 3.3.0 or earlier and your Steam integration works today,
599
- nothing in your code needs to change. What changes is the **studio's** one-time
600
- setup, and the errors you may now see if they have not done it.
601
-
602
- ### Added
603
-
604
- - `InvoError.isSteamNotConfigured` — the title has no Steam application
605
- registered with INVO yet (`STEAM_NOT_CONFIGURED`, 503).
606
- - `InvoError.isPartnerBillingNotSetUp` — the studio has not finished INVO billing
607
- setup (`PARTNER_BILLING_NOT_SET_UP`, 409).
608
- - `InvoError.isPartnerSettlementUnavailable` — settlement suspended or over
609
- limit (`PARTNER_RAIL_SUSPENDED` / `PARTNER_CREDIT_UNAVAILABLE`, 409). Show a
610
- neutral "purchases are unavailable right now": it is not the player's problem.
611
- - `InvoError.isSteamAppChanged` — the order was started against a different
612
- Steam application than the title is configured for now (`STEAM_APP_CHANGED`,
613
- 409). Only reachable if a studio swaps apps mid-flight.
614
-
615
- All four are refused **before the player is charged**, which is the point.
616
-
617
- ### Changed
618
-
619
- - README: the Steam section now documents the studio's Steamworks setup
620
- (microtransactions enabled, a publisher-GROUP Web API key that includes the
621
- app, appid + key entered in the INVO dashboard, payment method on file).
622
- - README: removed the claim that no Steam-side registration was required.
623
-
624
- ## [3.3.0] - 2026-08-31
625
-
626
- **Documentation only. No code changes, no API changes.**
627
-
628
- Documents **Device Approval** — passkey step-up for consoles, TVs and any device
629
- with no browser. It is the OAuth 2.0 Device Authorization Grant
630
- ([RFC 8628](https://datatracker.ietf.org/doc/html/rfc8628)), so a standard
631
- client library understands the responses.
632
-
633
- - The device shows a short code and a QR (`verification_uri_complete`); the
634
- player approves on their phone; your **server** polls
635
- `POST /api/sdk/approvals/device/poll` until it hears back.
636
- - **One approval authorises one transaction.** Unlike the plain RFC 8628 grant,
637
- which authorises a _client_, an INVO device code is bound to the transaction
638
- you named and is consumed when used — it cannot approve anything else and
639
- cannot be reused.
640
- - `user_code` is meant to be seen; `device_code` is not. Poll from your backend.
641
- - Subscribe to `device_approval.approved` to learn the moment an approval lands
642
- instead of waiting for the next poll. Polling still works alone.
643
- - Available to every title with nothing to configure — the constraint is a
644
- property of the _device_, not the game, so a title with a website and a
645
- console build uses the normal ceremony in the browser and this one on console.
646
- - Currency purchases on a console go through that console's store, as the
647
- platform holder requires; this flow is for approving transfers and sends.
648
-
649
- Minor rather than patch because it documents a new API surface. The snippets are
650
- pinned by a test against this file, for the same reason the Steam ones are: a
651
- REST flow with no SDK method behind it is the one thing no other test can see.
652
-
653
- ## [3.2.3] - 2026-08-28
654
-
655
- **Documentation only. No code changes, no API changes.** Corrects two errors in
656
- the 3.2.2 Steam snippets that made them fail if copied.
657
-
658
- - **Base path.** The snippets said `/api/enhanced-purchase/...`. The routes are
659
- mounted at **`/api/currency-purchases/...`** -- `enhanced_purchase_api` is the
660
- module name, not the mount point. Copying 3.2.2 returned `404 Resource not
661
- found`, which reads like the Steam rail is unavailable rather than like a
662
- wrong URL.
663
- - **Auth header.** The snippets sent `X-Game-Secret`. The header is
664
- **`X-Game-Secret-Key`**, as it is everywhere else in this document. An unknown
665
- header is ignored, so the request arrived unauthenticated.
666
-
667
- Both were confined to the Steam section added in 3.2.2; every other snippet was
668
- correct. The Steam flow itself is unchanged -- pack catalogue, `pack_id`,
669
- VAT-aware amounts, all exactly as 3.2.2 describes.
670
-
671
- The paths and header are now pinned by a test against this file, because the
672
- Steam section is the one snippet with no SDK method behind it and so was the one
673
- thing no test could see.
674
-
675
- ## [3.2.2] - 2026-08-28
676
-
677
- **Documentation only. No code changes, no API changes.**
678
-
679
- Steam currency purchases now work on a **pack model**, and this documents it. The
680
- 3.2.1 notes described an earlier design that has been replaced -- read this
681
- instead.
682
-
683
- - **INVO owns the Steam pack catalogue.** You do not set prices and you never
684
- send an amount. Fetch `GET /steam/packs?steamid=...`, render it, and pass a
685
- `pack_id` to `/steam/init-purchase`. An amount is refused with
686
- `400 UNKNOWN_STEAM_PACK`.
687
- - **The price is identical everywhere; the currency inside is not.** Steam prices
688
- are VAT-inclusive wherever VAT is collected, so more of a fixed price goes to
689
- tax in a high-VAT country -- the same $9.99 pack yields 69 units in the US and
690
- 58 in France.
691
- - **Always pass `steamid`** when fetching the catalogue. Without it amounts are
692
- quoted with no VAT deducted, so a store promises more than the purchase
693
- delivers. Do not cache one catalogue for all players.
694
- - A Steam-distributed title may only sell currency on the `steam` rail
695
- (`409 STEAM_PURCHASE_LAYER_REQUIRED`), and a locked Steam account is refused up
696
- front (`409 STEAM_ACCOUNT_LOCKED`).
697
-
698
- Steam remains a server-to-server REST flow rather than an SDK method, because the
699
- purchase is authorised inside the Steam client and your game relays that.
700
-
701
- ## [3.2.1] - 2026-08-28
702
-
703
- **Documentation only. No code changes, no API changes.**
704
-
705
- Documents two things about the Steam rail that the SDK does not change but every
706
- Steam integration has to handle:
707
-
708
- - **Currency for a Steam-distributed title must be bought on the `steam` rail.**
709
- Any other rail is refused with `409 STEAM_PURCHASE_LAYER_REQUIRED`. This is a
710
- platform requirement and it applies across every storefront the title ships on,
711
- because a player's balance is shared between them.
712
- - **The player is charged more than the value you request.** Steam's platform
713
- commission is priced into the charge rather than absorbed, so the Steam
714
- init-purchase response now carries `charged_usd` alongside `value_usd`. Show
715
- `charged_usd` in your store. The currency the player receives is unchanged, so a
716
- pack is worth the same in-game on every rail, and the rate is configuration --
717
- read the response rather than hard-coding a multiplier.
718
-
719
- ## [3.2.0] — 2026-08-24
720
-
721
- **Storefront keys.** A game that ships on more than one storefront now gets one SDK
722
- key per storefront -- `steam`, `ios`, `android`, `web`, `console` -- all valid at the
723
- same time, and the key determines the payment rail. Construct one client per key and
724
- use whichever matches where the player is buying. **Additive: no behavior changes, no
725
- API removals.** A single existing key keeps working exactly as it does today, `rail`
726
- included, with no deadline and no migration.
727
-
728
- Three new typed error predicates for refusals this SDK previously surfaced only as a
729
- raw `code` string:
730
-
731
- - `InvoError.isRailChannelMismatch` -- the `rail` you sent disagrees with the storefront key
732
- you authenticated with (400). The fix is to stop sending `rail`; the key already
733
- determines it. INVO refuses rather than silently overriding, because overriding
734
- would bill a player through a route you did not ask for.
735
- - `InvoError.isSteamRailNotEntitled` -- a Steam purchase was attempted for a title INVO has
736
- not registered as distributed on Steam (403). Holding a `steam` storefront key does
737
- not by itself register the title.
738
- - `InvoError.isSteamPurchaseLayerRequired` -- a title distributed on Steam tried to sell currency
739
- on a non-Steam rail (409). Use the dedicated Steam purchase flow.
740
-
741
- Also in this release: the 3-D Secure completion method's documentation no longer names
742
- a payment processor. INVO does not name processors in developer-facing surfaces, and
743
- this line had been an exception to that for some time.
744
-
745
- Also in 3.2.0: **provider-neutral error codes.** INVO stamps a neutral alias
746
- (`error_code_public`) beside any machine code that carries a payment
747
- processor's name. This SDK previously read only the raw code, so a partner
748
- branching on `err.code` had to hard-code a vendor name INVO's own public
749
- documentation is not allowed to print. `err.code` is now the neutral alias when
750
- one exists (`STRIPE_ERROR` becomes `PROCESSOR_ERROR`), and the literal wire value stays reachable on
751
- `err.rawCode` for anyone already matching it. Refund reads prefer
752
- `processor_refund_reference` over the vendor-named field, with a fallback.
753
-
754
- **Storefront keys are still server-side keys.** A storefront key names where the
755
- _purchase_ came from, not where the key lives. It belongs in your backend exactly like
756
- your original key -- never in a game client, an app bundle, or browser code.
757
-
758
- ## [3.1.0] — 2026-08-04
759
-
760
- **Passkeys are the gold standard; the SMS-PIN path is deprecated.** This release makes INVO's
761
- authentication guidance explicit in the two places developers actually look — the README and IDE
762
- autocomplete. **No behavior changes, no API removals, no runtime warnings.** Upgrading and
763
- changing nothing produces byte-identical runtime behavior.
764
-
765
- A passkey is a phishing-resistant, origin-bound WebAuthn assertion. An SMS PIN is a shared secret
766
- on a channel exposed to SIM swap and interception. They were documented as interchangeable
767
- verification options; they are not, and the docs said so in a way that produced PIN-first
768
- integrations.
769
-
770
- ### Added — error-contract classifiers
771
-
772
- Three 403s that previously arrived as a generic `InvoError` (correct `status`/`code`/`message`,
773
- but no typed branch) now have classifiers:
774
-
775
- - **`err.isSourceGameNotLive`** — the caller's OWN game is in testing. Self-serve: switch it to
776
- Live in the console (Game Settings → Status).
777
- - **`err.isTargetGameNotLive`** — the DESTINATION game is in testing. Usually another
778
- developer's game, so the caller **cannot** fix it. **Deliberately distinct** from the source
779
- case: collapsing them into one "not live" branch yields a "go fix it" CTA that dead-ends half
780
- the time.
781
- - **`err.gameStatus`** — the `game_status` field from either refusal (e.g. `"testing"`).
782
- - **`err.isWebauthnNotEnabledForTenant`** — tenant has no verified WebAuthn RP ID. **This is
783
- configuration state, not a failure**: fall back to the SMS/in-app path instead of surfacing an
784
- error. Currently the common case — 4/23 sandbox and **0/3 production** tenants are configured.
785
-
786
- Note the backend splits field names across these: the `*_GAME_NOT_LIVE` pair uses
787
- `error_code`/`message`, while `WEBAUTHN_NOT_ENABLED_FOR_TENANT` uses `code`/`error`. The SDK
788
- already read both, so `err.code` is populated either way — the new tests pin both shapes.
789
-
790
- ### Clarified — the SDK does not, and did not, collapse non-2xx into transport errors
791
-
792
- Following a report of a `403` being debugged as a network outage: verified end-to-end that a
793
- non-2xx always surfaces with its real `status`, `code`, and `message`, and that `status: 0` is
794
- reserved for a genuine absence of an HTTP response. **No fix was needed in the SDK** — the loss
795
- happened in an integration-layer catch-all. Added regression tests pinning the behavior, plus a
796
- README section (**"`.status === 0` means 'no HTTP response' — and nothing else"**) showing the
797
- anti-pattern and the correct handler, and a note that `409` is a retryable not-ready state
798
- rather than a failure.
799
-
800
- ### Deprecated
801
-
802
- - **`InvoServer.verifySmsTransfer` / `InvoServer.verifySmsSend`** — marked `@deprecated`. They
803
- still work exactly as before and still hit the same endpoints. A **future major version will
804
- remove them**; no date is committed yet. Keep them only as a genuine last resort for users who
805
- cannot enroll a passkey (unsupported device, no platform authenticator) or who decline.
806
- **Migration:** when `initiateSend`/`initiateTransfer` returns `verificationMethod: "sms"`, read
807
- it as _"this sender has no passkey"_ — prompt `InvoClient.enrollPasskey()` and then
808
- `InvoClient.approveSend` / `approveTransfer`, instead of routing to a PIN pad.
809
-
810
- ### Changed (documentation only)
811
-
812
- - New README section — **"Passkeys are the gold standard — don't build on SMS"** — with the
813
- do/don't table, the deprecation notice, and an explicit list of the OTP surfaces that are
814
- **not** discouraged.
815
- - `VerificationMethod`, `InitiateResult.verificationMethod` and `SmsVerifyResult` doc comments
816
- reframed: `"in_app"` and `"sms"` are no longer presented as peer options.
817
- - "Before you go live" now stresses configuring RP ID / origins _before_ launch, since an
818
- unconfigured tenant silently drops every sender onto the deprecated path.
819
- - **New "Prerequisite: passkeys are dark until your tenant verifies a domain" subsection.**
820
- Recommending passkeys without saying what unlocks them would send developers straight into a
821
- `403` on their first `enrollPasskey()` call — with 0/3 prod tenants configured, that is
822
- currently _everyone_. The deprecation carries no removal date for the same reason.
823
- - Stability section corrected — it still claimed `2.0.0` was the only major, which `3.0.0`
824
- made false.
825
- - Design doc: `docs/features/passkey-first-authentication.md`.
826
-
827
- ### Not affected — still recommended
828
-
829
- `enrollmentBegin`/`enrollmentVerify`, `recoveryBegin`/`recoveryComplete`, and
830
- `phoneShareInitiate`/`phoneShareApprove` all involve a one-time code but are the on-ramp _to_ a
831
- passkey (or phone-ownership consent), not a substitute for one. They are **not** deprecated.
832
-
833
- ### Upgrade note
834
-
835
- The only way this release can surface in a pipeline is a lint rule that treats `@deprecated`
836
- usage as an error (e.g. `deprecation/deprecation` with `--max-warnings 0`). That is a lint-level
837
- signal, not a build or runtime break, and it is the intended notice.
838
-
839
- ## [3.0.0] — 2026-07-20
840
-
841
- **BREAKING — the Platform Commerce card leg moved to INVO's hosted checkout.** The backend now
842
- hosts the entire card flow (card fields, Apple Pay / Google Pay, billing-address collection,
843
- 3-D Secure) on its own checkout page, so the browser card-element surface shipped in 2.5.x is
844
- gone. Card sales are simpler AND safer: server creates → buyer pays on `checkoutUrl` → fulfill
845
- on the `platform_commerce.purchased` webhook. Note: the card leg is pending final enablement on
846
- the backend (sandbox payment test) — the balance leg is fully live.
847
-
848
- ### Migration from 2.5.x (card leg only — balance/status/refund/webhooks unchanged)
849
-
850
- - `platformCommerce.purchase({ fundingSource: "card" })`: **remove `billingAddress`** (the type
851
- is gone; the hosted page collects it) and optionally pass `successUrl` / `cancelUrl` /
852
- `metadata`. The result now carries `checkoutUrl` / `sessionId` / `expiresAt` (unix seconds) /
853
- `idempotentReplay` — **`clientSecret` no longer exists.**
854
- - Browser: **`confirmCardPayment` and `mountCardPayment` are removed** (with all card-element
855
- types and the `commercePublishableKey` config). Replace with a redirect
856
- (`location.href = checkoutUrl`) or the new optional embed:
857
- `invo.platformCommerce.mountCheckout(el, checkoutUrl, { onComplete })` — an iframe plus an
858
- origin-checked listener for the page's `INVO_CHECKOUT_COMPLETE` message.
859
- - Card duplicates no longer 409: retrying `purchase` with the same `clientRequestId` **replays
860
- the same checkout session** (`idempotentReplay: true`), so a lost response is recoverable.
861
-
862
- ### Added
863
-
864
- - `PlatformPurchaseInput.successUrl/cancelUrl/metadata`; result fields
865
- `sessionId/checkoutUrl/expiresAt/idempotentReplay`.
866
- - `InvoClient.platformCommerce.mountCheckout(el, checkoutUrl, opts)` → `{ iframe, destroy() }`.
867
- - `err.isAboveCardMaximum` (`ABOVE_CARD_MAXIMUM`, card > $999.99) + client-side card USD
868
- bounds fail-fast ($0.50–$999.99).
869
- - Card `requires_payment` responses without a `checkout_url` fail closed (`INVALID_RESPONSE`).
870
-
871
- ### Removed
872
-
873
- - `confirmCardPayment`, `mountCardPayment`, `commercePublishableKey`, `BillingAddress`, and the
874
- card-element/processor types + the runtime CDN script loader (no more processor touchpoints
875
- in this SDK at all).
876
-
877
- ## [2.5.1] — 2026-07-20
878
-
879
- Hardening patch from a second, independent post-release audit (correctness vs the backend
880
- blueprint + security red-team) of the 2.5.0 Platform Commerce feature. No API breaks.
881
-
882
- ### Fixed
883
-
884
- - **Card-confirm script loader could hang forever on retry.** After a transient CDN failure
885
- (or a pre-existing processor `<script>` tag whose events already fired), the next
886
- `mountCardPayment`/`confirmCardPayment` attached listeners to a dead tag and never settled —
887
- checkout silently dead until page reload. The loader now removes failed tags and polls
888
- (bounded, 10s) when a tag pre-exists.
889
- - **Orphaned card element on submit-lookup failure.** `confirmCardPayment` now destroys the
890
- mounted Payment Element before rethrowing when the `submit` selector can't be resolved
891
- (previously a retry stacked a second live card iframe).
892
- - **Billing-address validation errors no longer echo the submitted values** (cardholder PII
893
- could otherwise land in logs/Sentry); optional billing fields (`name`/`line2`/`state`) are
894
- now type-checked.
895
- - **`playerPhone` on `platformCommerce.purchase` is now E.164-validated** — this endpoint can
896
- create the player identity, so a national-format phone must never reach the wire.
897
- - **`err.isInsufficientBalance` now also classifies the zero-balance 400** ("Player has no
898
- balance in this tenant", which carries only `current_balance`).
899
- - **Breaker-open 503 keeps its human message** (`err.code === "service_unavailable"`, message
900
- no longer collapses to the bare token).
901
- - **Webhook types:** `platform_commerce.refunded` `player_email` is nullable + `identity_id`
902
- added; (2.5.0 already made card-leg `total_price` optional on `purchased`).
903
- - **Refund result surfaces `newBalance`** (balance leg) **and `processorRefundId`** (card leg)
904
- instead of leaving them `raw`-only.
905
- - Platform-commerce error tests now assert the REAL backend envelopes
906
- (`{status,error_code,message}` / bare `{message}`), not idealized shapes.
907
-
908
- ### Docs
909
-
910
- - Card-leg lost-response caveat on `purchase` (duplicate 409 can strand a `clientSecret`-less
911
- pending order — reconcile via webhook/`getStatus`, retry with a NEW `clientRequestId`).
912
- - `confirmCardPayment`: bank-redirect return-leg guidance + remount-after-decline note;
913
- `CardPaymentResult.raw` log-redaction note.
914
-
915
- ## [2.5.0] — 2026-07-20
916
-
917
- **Platform Commerce (ecommerce).** A new flow for **platform** tenants (non-game apps: vertical
918
- video, creator merch, marketplace) to sell items funded by **INVO balance or a real card**, with
919
- INVO as merchant of record and full refunds. This is **distinct from item purchase** — that is a
920
- _game_ tenant spending a player's _existing game currency_ on an _in-game_ item (balance only, no
921
- card, no refund). Additive; only platform tenants can call it (a game tenant gets `403
922
- NOT_A_PLATFORM_TENANT`). (Backend handoff: BE-PIP-009 `PLATFORM_COMMERCE_SDK.md`.)
923
-
924
- - **Server** (`InvoServer.platformCommerce`, mirrored in the Python SDK as
925
- `server.platform_commerce`):
926
- - `purchase(input)` — `fundingSource: "balance"` settles synchronously (`status:"success"`);
927
- `"card"` returns `status:"requires_payment"` + a `clientSecret` and **requires a
928
- `billingAddress`**. Idempotent on `clientRequestId`.
929
- - `getStatus(orderId)` — `completed` | `pending_payment` | `refunded`.
930
- - `refund({ orderId | clientRequestId, reason? })` — INVO retains its fee; a second refund
931
- throws `409` (`err.isAlreadyRefunded`).
932
- - **Browser** (`InvoClient.platformCommerce`):
933
- - `confirmCardPayment(clientSecret, { mount, publishableKey?, returnUrl?, submit? })` — mounts
934
- the card element and confirms; returns `{ status: "succeeded" | "requires_action" |
935
- "processing" | "failed" }`. The processor JS is **lazy-loaded from its CDN — no bundled
936
- dependency**; pass its publishable key (or set `commercePublishableKey` on the client config).
937
- - `mountCardPayment(clientSecret, opts)` — the primitive: `{ element, confirm(), destroy() }`
938
- to confirm from your own Pay button.
939
- - **Webhooks:** new typed `platform_commerce.purchased` / `platform_commerce.refunded` events.
940
- **Fulfill card orders on `platform_commerce.purchased`, never on the browser confirmation.**
941
- - **New `InvoError` classifiers:** `isNotPlatformTenant` (403), `isAmountBelowMinimum`,
942
- `isBelowCardMinimum` (card < $0.50), `isAlreadyRefunded` (409).
943
- - Docs: README now leads the flow list with an explicit **item purchase vs Platform Commerce**
944
- contrast; new "Platform Commerce (ecommerce)" section.
945
-
946
- ## [2.4.1] — 2026-07-10
947
-
948
- Docs only, no code change — corrects stale README prose that the 2.4.0 publish still carried:
949
- the status line led with an old version, and the Stability section still cited the `2.0.0`
950
- `playerPhone` requirement as the standing breaking change (2.2.0 relaxed it back to optional).
951
- Republished so the package-bundled README is accurate.
952
-
953
- ## [2.4.0] — 2026-07-10
954
-
955
- **Steam transfer policy.** Steam-purchased currency is locked to Steam titles; the backend now
956
- enforces this at transfer/send initiate and annotates destinations. Additive, and inert until a
957
- title is flagged Steam-distributed. (Design doc: `docs/features/steam-transfer-policy.md`.)
958
-
959
- - New `InvoError` classifiers on `initiateSend`/`initiateTransfer` 409s:
960
- `isSteamValueNonTransferable` (with `steamTransferableMax` / `steamOriginAmount` — decimal
961
- strings) and `isNonSteamValueIntoSteamBlocked`. Surface `err.message` verbatim.
962
- - New `DestinationGame.acceptsSteamOriginValue` (maps `accepts_steam_origin_value`; `false` when
963
- omitted) — disable non-Steam destinations for a player holding Steam value so they never hit
964
- the 409.
965
-
966
- No breaking changes.
967
-
968
- ## [2.3.0] — 2026-07-07
969
-
970
- **Claim-time phone-share approval.** The backend closed a security gap: claiming/collecting a
971
- phone-routed transfer now authorizes the collecting identity against the receiver phone before
972
- crediting. So `confirmReceiptSend`/`confirmReceiptTransfer` and `claimTransfer`/`claimCurrency`
973
- can now return the phone-share `409 PHONE_SHARE_APPROVAL_REQUIRED` (previously only
974
- registration/mint did). The existing `InvoError.isPhoneShareApprovalRequired` already classifies
975
- it — no consumer code must change — but:
976
-
977
- - New **`InvoError.phoneShareLast4`** surfaces the `phone_last4` from the 409 body for the UI
978
- ("we texted the phone ending 1234").
979
- - `isPhoneShareApprovalRequired` docs + the `confirmReceipt*`/claim method docs + README now
980
- spell out the claim-time path: it's **not a failure** — the funds are held and the phone owner
981
- is texted; show `err.message` verbatim, then **retry the same call** once approved (it succeeds
982
- idempotently); on denial/expiry the sender is refunded.
983
-
984
- Additive, no breaking changes; affects all rails' claim paths (transfer, currency send, amazon).
985
-
986
- ## [2.2.0] — 2026-07-07
987
-
988
- **Backend reconciliation** — a full audit of the SDK against the live backend surfaced three
989
- places the SDK didn't match reality. All changes are backward-compatible (relaxing required
990
- inputs / adding surface); no working call breaks.
991
-
992
- - **`mintPlayerToken` no longer requires `playerPhone`.** `/api/sdk/player-token` is a
993
- session-token mint for an **existing** player (looked up by email) — not a registration call.
994
- It reads only `player_email` and ignores `player_phone`. The 2.0.0 hard E.164 requirement was
995
- a bug: it could **block a valid token mint for an existing email-only player**. `playerPhone`
996
- is now optional and validated only if provided. Phone stays enforced where it matters — the
997
- sender's phone on `initiateSend`/`initiateTransfer`, and at player creation.
998
- - **Send by phone alone.** `receiverPlayerEmail` (send) and `targetPlayerEmail` (transfer) are
999
- now **optional** — you can send to a recipient's phone; they supply their email at claim
1000
- (claim still requires it, since that's where the recipient establishes identity).
1001
- - **`getPlayerBalance` is by email only.** There is no by-`playerId` balance route on the
1002
- backend, so passing `playerId` threw a confusing 404. It now throws a clear `INVALID_INPUT`
1003
- pointing you to `InvoClient.getBalance()` (client-side) or `playerEmail` (server-side).
1004
- - **New `InvoError.isUserVerificationRequired`** for the `WEBAUTHN_UV_REQUIRED` (401) approve
1005
- failure — re-run the passkey ceremony requiring UV.
1006
- - Fixed `iterateItemPurchaseHistory` to read the backend's `total_count` pagination key (was
1007
- `total`; the loop already terminated via the short-page guard, so behavior is unchanged).
1008
-
1009
- **Migration:** none required. If you were passing `playerPhone` to `mintPlayerToken` it still
1010
- works; you can now also omit it. Replace any `getPlayerBalance({ playerId })` with an email
1011
- lookup or `InvoClient.getBalance()`.
1012
-
1013
- ## [2.1.2] — 2026-07-07
1014
-
1015
- **Hosted-checkout reconciliation** (the create-session API contract is unchanged; the hosted
1016
- page was rebuilt). Additive + docs only.
1017
-
1018
- - `createCheckout` now surfaces `expiresInSeconds` (the `checkout_url` token TTL, e.g. 900) as
1019
- a first-class field on `CreateCheckoutResult` — previously only on `.raw`.
1020
- - README: the `platform` rail is described as cards + Apple Pay / Google Pay / Link +
1021
- international billing (no app-store commission), and the checkout note now says reloading the
1022
- URL after a completed payment is idempotent (an already-complete success screen), not an
1023
- error. No API/signature changes.
1024
-
1025
- ## [2.1.1] — 2026-07-06
1026
-
1027
- **Security & correctness hardening** from a full audit + red-team of both SDKs. No API changes;
1028
- upgrade recommended.
1029
-
1030
- - **Fail closed on HTTP redirects (security).** The transport now sends `redirect:"manual"` and
1031
- throws `UNEXPECTED_REDIRECT` on any 3xx instead of following it. Previously a redirect from
1032
- the API host could cause the game-secret header to be re-sent to an unvalidated URL (matches
1033
- the Python SDK fix, where the leak also covered the player token and an `http://` downgrade).
1034
- - **`retryAfter` no longer treats a blank `retry_after` as `0`.** An empty/whitespace
1035
- `retry_after` string used to become `0` (`Number("")===0`) — an immediate, no-backoff retry.
1036
- It's now correctly `undefined`, in both `InvoError.retryAfter` and the retry layer.
1037
- - **Whitespace OTP codes rejected client-side.** `recoveryComplete`/`enrollmentVerify` now
1038
- reject a whitespace-only `code` before the network call, so it can't burn an attempt against
1039
- the attempt-capped endpoints (parity with the Python SDK).
1040
- - **Webhook verify uses `crypto.timingSafeEqual`** on the sync path (parity with Python's
1041
- `hmac.compare_digest`); the runtime-agnostic async/edge path keeps its string compare.
1042
- - **WebAuthn option mappers fail cleanly.** A malformed `register/begin` body now throws
1043
- `WEBAUTHN_OPTIONS_MALFORMED` (an `InvoError`) instead of a raw `TypeError`.
1044
-
1045
- ## [2.1.0] — 2026-07-02
1046
-
1047
- **Passkey recovery ("lost or replaced my passkey").** Deleting a passkey on the device never
1048
- tells the server the key is gone, so re-enrollment was dead-ended by the anti-takeover gate
1049
- (`ENROLLMENT_REQUIRES_PROOF`) with nothing left to prove possession with. The backend shipped
1050
- a self-serve, possession-proofed recovery flow; this release wires the client side.
1051
-
1052
- - `InvoClient.recoveryBegin()` — sends a one-time code to the phone/email on file
1053
- (`{ status: "sent", channels }`); `InvoClient.recoveryComplete(code)` — deactivates the
1054
- stale server-side passkey and authorizes a fresh enrollment
1055
- (`{ status: "recovered", deactivatedCount, next }`). Then retry the same `enrollPasskey()`.
1056
- - New `InvoError` classifiers: `isEnrollmentCodeInvalid`, `isPasskeyRecoveryCooldown`, and
1057
- `retryAfterAt` (the ISO timestamp on the 403 cooldown — distinct from the numeric
1058
- `retryAfter` throttle field). Bare `no_channel_on_file` / `rate_limited` error tokens are
1059
- now promoted to `err.code`.
1060
- - **24-hour money cooldown surfaced:** a recovery-enrolled passkey logs in and collects
1061
- funds immediately, but `approveSend`/`approveTransfer` throw 403
1062
- `PASSKEY_RECOVERY_COOLDOWN` for 24h (SIM-swap protection). Branch on
1063
- `isPasskeyRecoveryCooldown`, show the pause message with `retryAfterAt`, don't retry-loop.
1064
- - README: recovery subsection under Passkeys, incl. the password-manager cleanup tip for
1065
- "there is a problem saving your passkey" (stale orphan entry).
1066
-
1067
- Additive, no breaking changes. Routes require SDK verification enabled for the tenant
1068
- (dark 503 otherwise).
1069
-
1070
- ## [2.0.0] — 2026-07-02
1071
-
1072
- **BREAKING — `mintPlayerToken` now requires `playerPhone` (E.164).** Requested by the INVO
1073
- backend after a live incident: a player registered email-only couldn't receive a cross-game
1074
- transfer (incoming transfers are matched by phone) and never got the account-linking consent
1075
- SMS (also phone-triggered). The network identity is derived from **email + phone together**,
1076
- so the phone must be present on the FIRST registration call — attaching it later changes the
1077
- identity and forces device re-enrollment.
1078
-
1079
- - `mintPlayerToken({ playerEmail, playerPhone })` — `playerPhone` is required and validated
1080
- as E.164 (`+15555550100`: leading `+`, country code, digits only) before any network call;
1081
- the body now posts `player_phone` alongside `player_email`.
1082
- - **Pending approval is surfaced, not an error to swallow:** minting with a phone that
1083
- already belongs to another INVO account (same person, new email) throws the existing
1084
- `isPhoneShareApprovalRequired` 409 — the phone holder got a consent SMS. New
1085
- `InvoError.phoneShareApprovalId` exposes the `approval_id` from the 409 body for the
1086
- `phoneShareApprove` OTP fallback. Docs updated to cover the registration path (previously
1087
- documented for claims only).
1088
- - README: new "Player registration (email + phone, required)" section; examples updated
1089
- (`proxy-server.ts` token route now rejects a phoneless actor with a clear 400).
1090
-
1091
- **Migration:** collect the player's phone in your enrollment UI before the first
1092
- `mintPlayerToken` call and pass it as `playerPhone` in E.164. Handle the
1093
- `isPhoneShareApprovalRequired` error as a "pending approval" UI state.
1094
-
1095
- ## [1.2.1] — 2026-07-01
1096
-
1097
- **Fix — browser "Illegal invocation".** The SDK invoked its fetch as `this.fetchImpl(...)`,
1098
- so the browser's native `fetch` ran with the wrong `this` and threw
1099
- `TypeError: Illegal invocation` — breaking every browser `InvoClient` read
1100
- (balance/destinations/pending) and the passkey ceremonies when using the default global
1101
- `fetch` (retries then made it slow on top). The fetch impl is now bound to `globalThis`
1102
- (harmless for a custom `fetch`). No API change. Node/tests were unaffected, which is why it
1103
- slipped through — added a `this`-sensitive regression test.
1104
-
1105
- ## [1.2.0] — 2026-07-01
1106
-
1107
- Two more server-side capabilities on `InvoServer`.
1108
-
1109
- - **Phone-share OTP handshake** — `phoneShareInitiate` / `phoneShareApprove` / `phoneShareStatus`
1110
- resolve a `409 PHONE_SHARE_APPROVAL_REQUIRED`. Unauthenticated (phone-owner-driven — no game
1111
- secret, no player token), relayed by a partner backend; after approve, re-issue the identical
1112
- original request (the grant is server-side + auto-consumed). Adds
1113
- `InvoError.isPhoneShareAlreadyApproved`.
1114
- - **Server-side `getDestinations`** — game-secret variant of the browser
1115
- `InvoClient.getDestinations`; pass `{ sourceGameId, direction }` (default `"transfer"`), rows
1116
- share the same `DestinationGame` shape.
1117
-
1118
- ## [1.1.0] — 2026-07-01
1119
-
1120
- Four additive server-side flows on `InvoServer` (the SMS-PIN / claim-code / status /
1121
- guardian paths partners still need alongside the passkey path).
1122
-
1123
- - **SMS-PIN completion** — `verifySmsTransfer` / `verifySmsSend` (for `verificationMethod: "sms"`).
1124
- - **Claim-by-code** — `claimTransfer` / `claimCurrency`, incl. the `needsAccountSelection`
1125
- multi-account disambiguation (a `200` with `candidates`, not an error).
1126
- - **Status reads** — `getTransferStatus` / `getSendStatus` (surface `verificationState`).
1127
- - **Guardian approval-status poll** — `getGuardianApprovalStatus` (poll a hold to `state`).
1128
- - New typed results (`SmsVerifyResult`, `ClaimResult`, `TransactionStatusResult`,
1129
- `GuardianApprovalStatusResult`) + `InvoError.isPhoneShareApprovalRequired`.
1130
-
1131
- ## [1.0.0] — 2026-07-01
1132
-
1133
- **1.0 — stable.** The public API is now covered by a stability commitment: it follows
1134
- semver and no breaking change ships without a major bump + migration note. This is a
1135
- milestone release, **not a breaking change** — code on `0.8.x` continues to work unchanged.
1136
-
1137
- Also in this release (docs + DX):
1138
-
1139
- - **Integration modes** documented — **browser-direct** (default) and **behind your proxy**
1140
- (keep the INVO player token server-side via a custom `baseUrl`/`fetch`; no CORS or
1141
- security-posture change). Plus a token-bootstrap example and a CORS + RP-ID/origins
1142
- go-live checklist.
1143
- - `linkDevice` called out as the lowest-risk first adoption (additive, no refactor).
1144
-
1145
- ## [0.8.0] — 2026-07-01
1146
-
1147
- Completes the **discovery layer** for send/transfer UIs.
1148
-
1149
- - **`InvoClient.getBalance()`** (browser, player-token, `GET /api/sdk/balance`) — the
1150
- player's balances for the token's game: `balances[]` (`currencyId`, `currencyName`,
1151
- `currencySymbol`/`currencySymbolUrl` (nullable), `availableBalance`/`reservedBalance`/
1152
- `totalBalance` as decimal strings) plus `totalValue` / `currencyCount` / `hasFunds`. A
1153
- player who hasn't transacted here yet returns an empty `balances` array (a `200`, not an
1154
- error); `404 GAME_NOT_FOUND` throws.
1155
- - **`InvoServer.getLinkedIdentities({ playerEmail | playerPhone })`** (server-only,
1156
- game-secret) — a player's linked wallet identities (game-scoped). Provide one identifier
1157
- (phone wins if both); no in-game match returns `notFound: true` with empty `emails`
1158
- instead of throwing. **Returns first-party PII — never expose to the browser.**
1159
-
1160
- ## [0.7.0] — 2026-07-01
1161
-
1162
- Start of the **discovery layer** for send/transfer UIs.
1163
-
1164
- - **`InvoClient.getDestinations({ direction })`** — one player-token call
1165
- (`GET /api/sdk/destinations`) returns every game the player can send/transfer to, with
1166
- all display metadata **inline** (game name, icon, currency name/symbol, min/max transfer
1167
- limits) — no per-game lookup. Includes source game/currency info and `transferMode`
1168
- (`universal`/`linked` + `linkedGameIds`).
1169
- - _(Coming in 0.7.x: `getBalance` single-game player-token read; `getLinkedIdentities`
1170
- server-side.)_
1171
-
1172
- ## [0.6.0] — 2026-07-01
1173
-
1174
- Three additive browser flows for partner front-ends, built to the live backend contracts.
1175
-
1176
- - **`InvoClient.getPendingCollect()`** — the player's own pending-to-collect list
1177
- (player-token `GET /api/sdk/transfers/pending`), PII-free. Each row's `kind`
1178
- (`identity_gate` → `approve*`, `receiving_confirm` → `confirmReceipt*`) tells you the
1179
- action; typed fields incl. `held` / `holdReason` / `stepUpRequired`.
1180
- - **First-enrollment OTP grant** — `enrollmentBegin()` / `enrollmentVerify(code)` for
1181
- `ENROLLMENT_REQUIRES_AUTHORIZATION` (send OTP to phone+email, verify, then retry the
1182
- same `enrollPasskey()` — the server grant is auto-consumed). New `InvoError` helpers
1183
- `isEnrollmentAuthorizationRequired` / `isEnrollmentProofRequired`.
1184
- - **Typed approve/confirm holds** — `approve*`/`confirmReceipt*` now surface a typed
1185
- `holdReason` (from `error_code ?? code`) on HTTP 202 holds, plus `risk` /
1186
- `guardianApproval` / `pollEndpoint` on approve. `RECIPIENT_IDENTITY_PENDING` correctly
1187
- surfaces on confirm-receipt. Success carries no `holdReason`.
1188
-
1189
- ## [0.5.0] — 2026-07-01
1190
-
1191
- Support partner `metadata` end-to-end on the purchase flow (additive, backward-compatible).
1192
-
1193
- - **`PurchaseCompletedData.metadata?`** — the `purchase.completed` webhook now echoes your
1194
- metadata back (all rails); `event.data.metadata` is typed.
1195
- - **`purchaseCurrency`** now accepts and forwards `metadata` (the direct `/purchase-currency`
1196
- endpoint accepts it too, matching `createCheckout`).
1197
-
1198
- ## [0.4.2] — 2026-06-30
1199
-
1200
- Fixes from an independent line-by-line audit against the live backend.
1201
-
1202
- - **`linkDevice` now works.** `device/link/webauthn/begin` returns a wrapped
1203
- `{ link_id, options }` body (challenge nested under `options`) and binds the
1204
- challenge to a server-generated `link_id`. The client now unwraps `options` and
1205
- echoes the server's `link_id` to `/complete` (it previously threw on an undefined
1206
- challenge and sent the wrong id).
1207
- - **`InvoError.code` is now populated for the direct purchase rail + guardian flows.**
1208
- `errorFromResponse` reads `error_code` (SecureErrorHandler + `/purchase-currency`)
1209
- in addition to `code`, and promotes known no-code tokens (`flow_paused`,
1210
- `spending_limit_exceeded`, `receiver_not_enrolled_use_claim_code`) to `.code`. Fixes
1211
- `isDuplicateRequest` on the direct rail.
1212
- - **Guardian/minor routing.** The 202 guardian body also carries
1213
- `verification_method:"sms"`; the SDK now suppresses it (reports
1214
- `verificationMethod: undefined`) so a guardian-pending minor isn't routed into the
1215
- SMS-PIN UI. README example reordered to branch on `guardianApproval` first.
1216
-
1217
- ## [0.4.1] — 2026-06-30
1218
-
1219
- Docs only — replaced the README's internal-leaking "Deployment prerequisites"
1220
- (backend flag names, DB columns, gating mechanics) with a partner-facing
1221
- "Before you go live"; republished so the npm page README is current.
1222
-
1223
- ## [0.4.0] — 2026-06-30
1224
-
1225
- Additive release — more server reads, edge-ready webhooks, cancellation, and tooling.
1226
-
1227
- - **`getInboundPending({ playerEmail | playerPhone })`** — live, unclaimed inbound
1228
- sends/transfers for a player (the source of truth behind the "you have X to collect"
1229
- badge; pairs with `transfer.claim_pending`).
1230
- - **`verifyWebhookAsync`** — Web Crypto variant of `verifyWebhook` that runs on
1231
- Cloudflare Workers / Deno / Vercel+Netlify Edge / Bun / browsers; and
1232
- **`createWebhookHandler`** — a zero-dep Fetch-API `(Request) => Promise<Response>`
1233
- webhook route handler (Next.js App Router, Workers, Deno, Hono, Bun).
1234
- - **`iterateItemPurchaseHistory`** — async iterator that pages through a player's
1235
- full item-purchase history.
1236
- - **Per-call `AbortSignal`** — every method accepts an optional `{ signal }`; an
1237
- aborted call throws `InvoError` code `ABORTED` and is never retried.
1238
- - **Tooling**: ESLint (+ lint in CI), changesets release automation, `SECURITY.md`,
1239
- and `CODEOWNERS`.
1240
-
1241
- ## [0.3.0] — 2026-06-30
1242
-
1243
- Additive release — new server capabilities plus transport resilience/observability.
1244
-
1245
- - **Webhook verification** (`/server`): `verifyWebhook(rawBody, signatureHeader, secret | secrets, opts?)`
1246
- — constant-time HMAC-SHA256 over `${t}.${rawBody}`, 5-minute replay window,
1247
- multi-secret rotation; returns a typed `InvoWebhookEvent` discriminated union
1248
- (`purchase.*`, `item.purchased`, `transfer.*`, `payout.status_changed`, `webhook.test`).
1249
- Throws `InvoError` (`WEBHOOK_SIGNATURE_INVALID` / `WEBHOOK_TIMESTAMP_EXPIRED` /
1250
- `WEBHOOK_MALFORMED` / `WEBHOOK_SECRET_MISSING`). Server-only; the browser bundle
1251
- stays crypto-free. Independently security-audited.
1252
- - **`getPlayerBalance({ playerEmail | playerId })`** (`/server`): typed `player` / `balances` / `summary`.
1253
- - **Automatic retries**: network errors/timeouts, `429` (honoring `retry_after`), and
1254
- `5xx` are retried with exponential backoff + jitter. New config `maxRetries`
1255
- (default 2, `0` disables) and `retryBaseDelayMs` (default 250).
1256
- - **Observability hooks**: optional `onRequest` / `onResponse` / `onError` on both
1257
- entries (best-effort/non-throwing); `InvoError.requestId` carries the backend
1258
- request id for support/tracing.
1259
- - **Typed reads**: `confirmPayment` → `ConfirmPaymentResult`; `getOrderDetails` /
1260
- `getItemOrderDetails` → `OrderDetailsResult`; `getItemPurchaseHistory` →
1261
- `ItemHistoryResult` (previously untyped `Record`). All keep `raw`.
1262
- - **Light validation**: `mintPlayerToken` and `createCheckout` require a non-blank
1263
- `playerEmail` (throws `INVALID_INPUT` before the network call).
1264
- - **License**: `package.json` `license` is now `SEE LICENSE IN LICENSE` (was
1265
- `UNLICENSED`); `LICENSE` rewritten as an explicit install-and-use grant for
1266
- building INVO integrations.
1267
-
1268
- ## [0.2.1] — 2026-06-30
1269
-
1270
- Docs only — no code change (republished so the npm page README is current).
1271
-
1272
- - Rewrote the README into a complete integration/deployment guide: capability
1273
- overview, architecture, deployment prerequisites, per-flow sections (currency
1274
- purchase, item purchase, sends, transfers, passkeys), webhooks, errors, and a
1275
- full API reference for both entries.
1276
- - Added INVO console onboarding: `https://console.invo.network` (production) and
1277
- `https://dev.console.invo.network` (testing/sandbox), mapped to their API base URLs.
1278
-
1279
- ## [0.2.0] — 2026-06-30
1280
-
1281
- Adds **item purchase** (spend existing game currency on an in-game item, §4.8) — an
1282
- additive, server-only surface.
1283
-
1284
- - `InvoServer` (`/server`): `purchaseItem`, `getItemPurchaseHistory`, `getItemOrderDetails`.
1285
- - Server-side, game-secret auth — no passkey, no real money, no payment rail (it's a
1286
- balance debit). Grant the item off the `item.purchased` webhook.
1287
- - Client-side guards: required fields (trim-checked), `itemQuantity` integer `1..1000`,
1288
- prices `> 0` and `<= 999999.99` (magnitude-safe 2-decimal check), and
1289
- `totalPrice == unitPrice × itemQuantity (±0.01)` compared in integer cents.
1290
- - Load-bearing response fields (`transaction_id`, `order_id`) throw `INVALID_RESPONSE`
1291
- if missing on a 200.
1292
- - `InvoError` helpers: `isInsufficientBalance` (gated to 400; not the `429` throttle),
1293
- `isDuplicateRequest` (409), `retryAfter` (numeric or string `retry_after`); all
1294
- null-safe against non-JSON error bodies.
1295
- - Independently audited (2 agents) against handoff doc §4.8/§6/§8; contract verified,
1296
- error-classification edge cases fixed.
1297
-
1298
- ## [0.1.0] — 2026-06-30
1299
-
1300
- Initial scaffold.
1301
-
1302
- - `InvoServer` (`/server`): `mintPlayerToken`, `initiateSend`, `initiateTransfer`,
1303
- `createCheckout`, `purchaseCurrency`, `confirmPayment`, `getOrderDetails`.
1304
- - Client-side purchase guards (§4.7): USD amount `0 < x ≤ 999.99`, required
1305
- `purchaseReference`, and `rail:"steam"` rejected before the network call
1306
- (`INVALID_INPUT` / `MISSING_PURCHASE_REFERENCE` / `WRONG_RAIL_ENDPOINT`).
1307
- - `InvoClient` (browser): `enrollPasskey`, `approveSend`/`approveTransfer`,
1308
- `confirmReceiptSend`/`confirmReceiptTransfer`, and `linkDevice` for the
1309
- interchangeable-methods flow (§4.6).
1310
- - Optional `refreshToken` hook: transparently re-mints and retries once on
1311
- `SDK_TOKEN_EXPIRED` (§11.2).
1312
- - Shared: typed `InvoError`, isomorphic HTTP client, WebAuthn JSON⇄binary helpers.
1313
- - Tests: HTTP layer, server request mapping + purchase guards, browser client
1314
- flows (enroll/approve/link/token-refresh), and WebAuthn serialization.
1315
- - Contracts extracted + auditor-verified against the INVO backend.
1316
-
1317
- ### Hardening (independent red-team pass)
1318
-
1319
- - **Guardian/minor `202` path no longer mismapped to `verificationMethod:"sms"`** —
1320
- `initiateSend`/`initiateTransfer` now return `verificationMethod: undefined` and a
1321
- `guardianApproval` block on the guardian path, so callers don't route into the
1322
- PIN UI by mistake (§4.3).
1323
- - `usdAmount` validation tightened: rejects non-plain-decimal strings
1324
- (`"0x10"`, `"1e2"`, whitespace) and >2 decimal places before any network call.
1325
- - Load-bearing response fields (`token`, `checkout_url`) now throw `INVALID_RESPONSE`
1326
- instead of silently surfacing as empty strings.
1327
- - `getOrderDetails` requires at least one of `orderId`/`transactionId`.
1328
- - Token refresh now re-runs the **whole** passkey ceremony on `SDK_TOKEN_EXPIRED`
1329
- (never replays a single-use assertion) and single-flights concurrent refreshes.
1330
- - `baseUrl` must be `https://` (localhost exempt) so the token/secret can't travel
1331
- in cleartext.
1332
- - Published tarball excludes sourcemaps (no proprietary source shipped).
1
+ # Changelog
2
+
3
+ ## 3.25.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Server: `InvoServer.payouts`, partner payouts and creator payouts. `registerPayee` (`POST /api/partner-payees`), `listPayees`, `getPayee`, `resendPayeeInvite`, `requestPayout` (`POST /api/partner-payouts/request`, with `payeeId` to have INVO pay a verified creator from the earnings INVO owes you, or `bankAccountId` for your own verified bank), `getPayout`, `listPayouts` (optional `payeeId`) and `cancelPayout` (a creator payout still `requested`). Results keep the API's snake_case fields. Creators are INVO's customers: you see their status only, never their documents, tax id or bank details.
8
+ - Webhook types: `payee.status_changed` is typed as `PayeeStatusChangedData`. `PayoutStatusChangedData` gains `payee_id`, `payout_method` and `returned_at`. Payout statuses now include `cancelled` and `returned`.
9
+ - Nothing removed or renamed.
10
+
11
+ ## 3.24.1
12
+
13
+ ### Patch Changes
14
+
15
+ - Player activity: on the recipient's entry for a send or transfer from another game, `grossAmount` and `feeAmount` are now filled in the recipient's currency (`grossAmount - feeAmount === amount`). They were `null` on every cross-game entry. Doc comment updated; no type change.
16
+
17
+ ## 3.24.0
18
+
19
+ ### Minor Changes
20
+
21
+ - Player activity: send and transfer entries from `getPlayerActivity` / `iteratePlayerActivity` carry the fee. On the sender's entry `feeAmount` and `netAmount` (what the recipient gets) sit beside the gross `amount`; on the recipient's entry `grossAmount` and `feeAmount` sit beside `amount` (what arrived). While a send waits to be collected they show the fee that will apply; `null` when it ended without being collected, and on the recipient side of a currency-converting transfer. Purchases do not carry them.
22
+ - Errors: initiate-send and initiate-transfer amount-limit refusals now carry `error_code` `AMOUNT_BELOW_MINIMUM` / `AMOUNT_ABOVE_MAXIMUM` with the limit. `err.isAmountBelowMinimum` (now also true for these, and on the wallet transfer route where `err.code` stays `INVALID_AMOUNT`), new `err.isAmountAboveMaximum`, `err.minimumAmount`, `err.maximumAmount` and `err.limitCurrencyName`. A sender phone that does not match the one on file now carries `PHONE_MISMATCH` (400); `err.isPhoneMismatch` covers it as well as `registerPlayer`'s 409.
23
+ - Webhook types: `identity.passkey_reset` is typed as `IdentityPasskeyResetData` (`identity_id`, `reset_via`, `cooldown_until`, `deactivated_count`). It now also fires for an in-app recovery (`reset_via: "sdk"`) and can be subscribed to by name.
24
+ - Nothing removed or renamed.
25
+
26
+ ## 3.23.0
27
+
28
+ ### Minor Changes
29
+
30
+ - Webhook types: `PurchaseEventData` gains `dispute_fee_usd` (`string | null`, USD decimal such as `"15.00"`, `"0.00"` when INVO bears the fee) and `dispute_fee_charged_to_partner` (`boolean | null`), carried on a card `purchase.disputed` when the dispute closes. From November 8, 2026 the card dispute fee on Open-tier card sales (coin purchases, Platform Commerce card sales and subscription charges) is passed through to you at cost. A lost dispute is `purchase.disputed` with `dispute_status: "lost"`, not a separate event. README updated. Both fields optional; nothing removed or renamed.
31
+
32
+ ## 3.22.0
33
+
34
+ ### Minor Changes
35
+
36
+ - e3895ab: 2026-10 pricing and new reads. Server: `getPlayerActivity({ playerEmail, limit?, cursor?, types? })`
37
+ (`GET /api/sdk/players/activity`), one merged, newest-first page of a player's currency purchases,
38
+ item purchases, Platform Commerce purchases, sends and transfers, and `iteratePlayerActivity`, which
39
+ follows `nextCursor`. `platformCommerce.getPurchaseHistory({ playerEmail, limit?, cursor? })`
40
+ (`GET /api/platform-commerce/purchase-history`, entries shaped like `getStatus`) and
41
+ `platformCommerce.iteratePurchaseHistory`. `getTransferStatus` / `getSendStatus` results carry
42
+ `expiryReason` once expired. Webhook types: `TransferEventData` gains `order_id`,
43
+ `net_transfer_amount`, `claim_code_expires_at`, `from_game_id`, `to_game_id`, `from_player_id`,
44
+ `expired_at`, `reason`, `expiry_reason` and `refunded_amount`; `payout.status_changed` is typed as
45
+ `PayoutStatusChangedData`, with the payout fee fields `offboarding_fee_pct`, `offboarding_fee_usd`,
46
+ `offboarding_fee_cap_usd` and `net_payout_usd`. New additive `err.publicCode`: the
47
+ provider-neutral twin of a code (INVO's `error_code_public` on errors from the API). The SDK's own
48
+ pre-network refusal of a Platform Commerce card total under $0.50 keeps `err.code` exactly as
49
+ before and now also carries `err.publicCode === "BELOW_CARD_MINIMUM"` and `err.minUsd === "0.50"`;
50
+ `err.isBelowCardMinimum` is true as before and accepts both spellings. Nothing removed or renamed. README: the
51
+ Open card fee is 3.5% + $0.30 (was 4.5%); the chargeback guarantee is a Merchant of Record term
52
+ (Open-tier card payments made before November 8, 2026 keep it); transfers are 10% (3.5% / 3.5% /
53
+ 3%); payouts carry a 1% fee capped at $500 per payout; the hosted checkout reports a finished
54
+ purchase as status `"completed"`; on `phoneMismatch`, call `updatePlayerPhone`. Additive only.
55
+ - Player-confirmed phone change. Server: `requestPhoneChange({ playerEmail, newPhone })`
56
+ (`POST /api/sdk/players/phone/change-requests`, 202, never auto-retried) returns
57
+ `changeRequestId`, `status`, `expiresAt`, `delivery`, `confirmation` and `message`; INVO emails
58
+ the player, who confirms on INVO's page (plus their passkey or enrolled device when they have
59
+ one). `getPhoneChange(changeRequestId)` reads the request. Browser, with the player token, on
60
+ the player's enrolled device: `listPhoneChangeApprovals()` and
61
+ `approvePhoneChange(changeRequestId, { deviceFingerprint, decision?, sign | deviceSignal })`,
62
+ which sends a `device_signal` over `phone-change|<id>|<nonce>|<timestamp>` (or
63
+ `phone-change-deny|...`); new `phoneChangeSignalMessage()` builds that message. No method sends
64
+ a confirmation code: games never collect it. `err.changeRequestEndpoint` on
65
+ `PHONE_CHANGE_REQUIRES_VERIFICATION`; new error predicates `isConfirmOnInvoPage`,
66
+ `isChangeRequestNotFound`, `isChangeRequestNotReady`, `isChangeRequestNotPending` (with
67
+ `changeRequestStatus`), `isChangeRequestInProgress`, `isPhoneChangeLocked`,
68
+ `isTooManyChangeRequests`, `isPhoneChangeUnavailable`, `isDeviceSignalRejected`,
69
+ `isPhoneChangeRecoveryCooldown` (`PHONE_CHANGE_RECOVERY_COOLDOWN`, 409 on create and approve:
70
+ a recent sign-in recovery; retry later, declining still works) and
71
+ `isDeviceEnrolledAfterRequest` (`DEVICE_ENROLLED_AFTER_REQUEST`, 409 on approve). New
72
+ `isPendingTransfersToOldPhone` / `isPendingTransfersToNewPhone`, which `updatePlayerPhone`
73
+ now also answers (409, no counts) as well as the change request routes. Webhook
74
+ type: `player.phone_changed` as `PlayerPhoneChangedData` (`new_phone` only for the requesting
75
+ game). README section "Player-confirmed phone change": on `phoneMismatch` or
76
+ `player.phone_changed`, never push a stored number back; ask the player. Additive only.
77
+
78
+ ## 3.21.0
79
+
80
+ ### Minor Changes
81
+
82
+ - 0238b53: Player registration, phone changes and identity re-key. Server: `mintPlayerToken` takes optional
83
+ `playerPhone` and `playerName`; with a phone, a player new to your title is created, and the
84
+ result now carries `created` and `phoneMismatch` (previously dropped). New
85
+ `registerPlayer({ playerEmail, playerPhone, playerName? })` (`POST /api/sdk/players`) and
86
+ `updatePlayerPhone({ playerEmail, newPhone })` (`POST /api/sdk/players/phone`, never
87
+ auto-retried). `initiateSend` / `initiateTransfer` results expose `identityRekeyed`,
88
+ `playerToken`, `playerTokenExpiresAt`, `identityId` and `claimDeliveryPlanned`; approve results
89
+ expose `claimDelivery`. New error predicates `isPlayerTokenStale`,
90
+ `isPhoneChangeRequiresVerification`, `isPhoneMismatch`, `isPhoneShareRefused`;
91
+ `isPlayerNotFound` also recognises the codeless `player_not_found` 404. A 403
92
+ `PLAYER_TOKEN_STALE` on approve is surfaced, never auto-retried: re-mint and retry once.
93
+ Additive only. README section "Registering players and changing their phone".
94
+
95
+ ## 3.20.0
96
+
97
+ ### Minor Changes
98
+
99
+ - 1dc07df: Loyalty and rewards. Server: `InvoServer.getPlayerRewards(playerEmail)` reads one player's
100
+ loyalty cards with the game secret (`GET /api/sdk/loyalty/players/rewards`). Browser, with the
101
+ player token: `InvoClient.getMyRewards()` (the player's cards), `getMyVault()`,
102
+ `redeemReward(vaultEntryId)` (the only response with a code; never auto-retried) and
103
+ `getRewardsPageLink()` (INVO's hosted "My rewards" page). Every card step carries `progress`,
104
+ `{ current, target }`, or `null` when unavailable; `state` decides completion. New error
105
+ predicates `isRewardAlreadyRedeemed`, `isRewardNotFound`, `isRewardExpired`,
106
+ `isRewardUnavailable` (`inventory_exhausted` / `conflict`); the server read's
107
+ `PLAYER_NOT_FOUND` and `INVALID_PLAYER_EMAIL` use the existing `isPlayerNotFound` and
108
+ `isInvalidPlayerEmail`. Additive only. README section "Loyalty and rewards".
109
+
110
+ ## 3.19.0
111
+
112
+ ### Minor Changes
113
+
114
+ - 6940139: D-PRICE-012: a subscription card refund, and a lost chargeback not covered by the chargeback guarantee, now cost the partner the whole refunded amount, INVO's card fee included, exactly as a Platform Commerce card refund does. There is no separate payment processor fee on a refund any more: `processingFeeUsd` reads `"0.00"` and `processingFeeBasis` `"none"`.
115
+
116
+ Additive, optional fields:
117
+
118
+ - `RefundResult.cardFeeChargedToPartnerUsd` and `RefundResult.partnerDebitedUsd` on `subscriptions.refund` (the 200 receipt and the 202 `pending_approval` body). `undefined` on a receipt stored before this release.
119
+ - `card_fee_charged_to_partner_usd` and `partner_debited_usd` on the `refund` block of `subscription.refunded` (`SubscriptionRefundDetail`) and on `purchase.disputed` (`PurchaseEventData`, subscription and Platform Commerce losses; `null` where not applicable).
120
+
121
+ README: subscription refund costs, lost chargebacks and the "What did I earn?" answer updated.
122
+
123
+ ## 3.18.0
124
+
125
+ ### Minor Changes
126
+
127
+ - 432fb75: INVO's 2026-09 card pricing. On card purchases the partner now pays INVO's card fee (4.5% + $0.30 on Open, 5.5% + $0.50 on Merchant of Record, plus 1.5% of the listed price (before tax) on a card issued outside the US); the player pays the listed price (plus tax where owed) and receives the listed coins. Fraud screening and a chargeback guarantee (a fraud chargeback on a card sale is covered by INVO) are included. Minimum card purchase $2.99 on coin purchases and Platform Commerce card sales, enforced from 2026-10-27. Card purchases only; purchases through a third-party storefront or payment rail are unaffected. All additive:
128
+
129
+ - `PurchaseResult` and `CurrencyPurchaseQuote` gain `partnerFeeUsd`, `internationalCardFeeUsd` and `minPurchaseWarning` (`MinPurchaseWarning`: `{ code, minUsd, enforcedFrom, message?, enforced?, raw }`), each set only when INVO sends it. `processingFeeUsd` stays and reads `"0.00"`.
130
+ - `FeeTakenFrom` gains `"partner"`. `UnacknowledgedPurchaseOutcome.feeTakenFrom` stays required; INVO always sends it, and should it ever be missing the SDK reads `"partner"` when the quote carries `partner_fee_usd`, otherwise `"coins"` as before.
131
+ - `err.minUsd` and `err.enforcedFrom` on `BELOW_CARD_MINIMUM` (`err.isBelowCardMinimum`, which now also covers INVO's minimum card purchase). `err.isAmountBelowFee` is deprecated: `AMOUNT_BELOW_FEE` is no longer returned.
132
+ - `acknowledgedTotalUsd` is still honored: INVO never charges more than it, and an older, higher fee-inclusive total is accepted with the true, lower total charged. Only a total below the true total is refused (`QUOTE_STALE`).
133
+ - `partnerFeeUsd` and `internationalCardFeeUsd` are `string | null`: `null` only when the fee could not be booked when the purchase completed (the purchase succeeded; INVO books the fee shortly after). `internationalCardFeeUsd` is `"0.00"` on a US card or one whose country is unknown, and always `null` on a quote (no card yet). The quote also carries `feeTakenFrom`, and `ifUnacknowledged.partnerFeeUsd`.
134
+ - `createCheckout()` and the Platform Commerce card leg of `platformCommerce.purchase()` return `minPurchaseWarning` while an amount under the minimum card purchase is still accepted. `BELOW_CARD_MINIMUM` also answers a card charge under the $0.50 card floor at any date, on coin purchases, hosted checkout and Platform Commerce: `err.minUsd` reads `"0.50"` there, with no `err.enforcedFrom`.
135
+ - `purchaseCurrency()` accepts `country` and `subdivision`, the place you quoted with. On Merchant of Record INVO uses it only when it cannot read the buyer's tax location from the card; without it such a purchase is refused with `409 TAX_PLACE_UNAVAILABLE` (new `err.isTaxPlaceUnavailable`, `err.untaxedTotalUsd`), nothing charged.
136
+ - Platform Commerce card refunds: `cardFeeChargedToPartnerUsd` and `partnerDebitedUsd` on the refund result and `card_fee_charged_to_partner_usd` / `partner_debited_usd` on `platform_commerce.refunded` (the card fee is not returned on a refund; it stays charged to you).
137
+ - Webhook types: `purchase.completed` gains `partner_fee_usd` and `international_card_fee_usd` (nullable); `purchase.disputed` gains `guarantee_covered` (lost Platform Commerce card sale and subscription disputes only; never on a coin purchase dispute), `order_type`, `developer_revenue_reversed_usd`, `subscription_id`, `period_seq` and `processing_fee_usd` (the processor fee a non-fraud lost subscription chargeback charges you, as a refund does); `platform_commerce.purchased` gains `international_card_fee_usd` (already included in `fee_breakdown.platform_fee`); `subscription.renewed`'s split gains `international_card_fee_usd` (the same figure as `pass_through_fees_usd`, never add them; `partner_revenue_usd` stays gross).
138
+ - Behaviour to notice: an unacknowledged $10.00 coin purchase now credits the full 100.00 coins (93.70 under the earlier pricing); an older fee-inclusive acknowledged total is accepted and the lower true total charged; `AMOUNT_BELOW_FEE` is no longer returned.
139
+ - README and doc comments: every card fee figure, the Tiers table (card rates, international fee, who pays, fraud screening, chargeback guarantee, minimum card purchase) and the quote example ($10.00 charges the player $10.00; your fee is $0.75 on Open).
140
+
141
+ ## 3.17.0
142
+
143
+ ### Minor Changes
144
+
145
+ - 28a96bf: Webhook payload types: `PurchaseEventData` gains `payment_intent_id` / `charge_id` / `dispute_id` (`string | null`: `null` on a Steam chargeback), `rail`, `steam_transid`, `fully_refunded`, `currency_debited` and `new_balance`. Steam chargebacks now arrive as `purchase.disputed` with the same keys as a lost card dispute, and a Steam partial refund arrives as `purchase.refunded` with `fully_refunded: false`. README: if you revoke on `purchase.refunded`, handle `purchase.disputed` the same way. All additive and optional.
146
+
147
+ ## 3.16.1
148
+
149
+ ### Patch Changes
150
+
151
+ - 9dd2bf5: README: the `isDuplicateClientRequestId` note describes only what the caller sees. Documentation only.
152
+
153
+ ## 3.16.0
154
+
155
+ ### Minor Changes
156
+
157
+ - 58143c2: `warnings` on `createCheckout()` results (typed `CheckoutWarning[]`, mapped from the additive `warnings` field): a checkout session sells game currency, and `metadata` carrying `item_id` / `item_name` now returns `ITEM_METADATA_ON_CURRENCY_SESSION`, pointing to `platformCommerce.purchase` for item sales. New error helpers: `err.isDuplicateClientRequestId` (409 `DUPLICATE_CLIENT_REQUEST_ID` on a Platform Commerce card purchase, with `order_id` / `order_status`; `err.isDuplicateRequest` is also true), `err.isTrialAmountBelowFeeFloor` (400 `TRIAL_AMOUNT_BELOW_FEE_FLOOR`; the message names the smallest accepted trial price) and `err.isIdentityCheckUnavailable` (503 `IDENTITY_CHECK_UNAVAILABLE` on claims and confirm-receipt, retryable). `err.isAmountBelowMinimum` now also covers `purchaseItem`, whose `totalPrice` is rounded to cents. README: refunds take back only the coins still held from that purchase, chargebacks up to the purchase's coins from the available balance, never below zero. All additive and optional.
158
+
159
+ ## 3.15.0
160
+
161
+ ### Minor Changes
162
+
163
+ - 5adf010: `cards.createSetupSession()` takes optional `playerName` and `playerPhone` (mapped to `player_name` / `player_phone`). When the member is new to the game and `playerName` is sent, INVO creates the member exactly as `subscriptions.create` does and then mints the card link, so a brand-new signup can save a card before a paid trial (`subscriptions.create` with `trialAmountUsd` and `playerCardId`). Without `playerName` an unknown member is still `err.isPlayerNotFound` (404). A known member is never re-created or renamed by this call. New `err.isPlayerCreateFailed` (503 `PLAYER_CREATE_FAILED`); a phone already on another member answers `err.isPhoneShareApprovalRequired` (409). The SDK refuses a blank or over-255-character `playerName` and a non-E.164 `playerPhone` before the network (`INVALID_INPUT`, status 0). README: the card page and paid-trial sections show the new-signup order. All additive and optional.
164
+
165
+ ## 3.14.2
166
+
167
+ ### Patch Changes
168
+
169
+ - README: the Merchant of Record chargeback threshold is measured on the previous complete calendar month. Documentation only.
170
+
171
+ ## 3.14.1
172
+
173
+ ### Patch Changes
174
+
175
+ - README: Merchant of Record is applied for from the Selling & Tax page in the INVO console (the page name was wrong in 3.14.0). Documentation only.
176
+
177
+ ## 3.14.0
178
+
179
+ ### Minor Changes
180
+
181
+ - 8f2298b: `credited` and `reasonCode` on `confirmPayment()` and `steamFinalizePurchase()` results (mapped from the additive `credited` / `reason_code` response fields; `status` is unchanged and still means the payment succeeded, so report a completed purchase only when `credited` is `true`). Merchant of Record receipt fields `receiptNumber` / `receiptUrl` on `purchaseCurrency()`, `getOrderDetails()`, `CheckoutClient.getPurchaseStatus()`, `platformCommerce.getStatus()` and `firstCharge`, and `receipt_number` / `receipt_url` (plus `tax_treatment` on `purchase.completed`) on the purchase, Platform Commerce and subscription webhook payload types. README: the tier's effect on responses (`tax_treatment: "partner_responsible"` on Open, receipts and the chargeback reserve on Merchant of Record). Platform Commerce card refunds in parts: optional `refundRemaining` / `confirmAdditionalRefund` on `platformCommerce.refund()`, optional `partialRefund` / `adopted` / `refundedTotalUsd` / `chargeTotalUsd` / `remainingUsd` on its result, and `err.isRefundRemainingRequiresConfirmation` / `err.isRefundRecentlyIssued` / `err.isRefundNotCompleted` (`err.isAlreadyRefunded` is now false for the two refund-in-parts refusals). All additive and optional. README: subscription card charges are 4% + $0.30 on Open and 5% + $0.50 on Merchant of Record (were 7% + $0.30 and 8.5% + $0.30); international card and currency conversion costs on subscriptions pass through at cost; chargebacks by tier; Merchant of Record is applied for from the console.
182
+
183
+ ## 3.13.0
184
+
185
+ ### Minor Changes
186
+
187
+ - INVO's card fee on coin purchases, paid trials, and the two tiers.
188
+
189
+ **Coin purchases carry INVO's card fee: 3.5% + $0.30** of the price (on the Open tier), never less than the card cost. `purchaseCurrency` charges in the same request, so there are now two shapes and you pick one by what you send:
190
+
191
+ - **Quote, show, acknowledge.** New `server.quoteCurrencyPurchase({ playerEmail, usdAmount, country?, subdivision? })` calls `POST /api/currency-purchases/quote`. It moves no money and creates nothing, and returns `totalUsd`, `amountCents`, `subtotalUsd`, `processingFeeUsd`, `coins`, `currencyName`, a camelCase `breakdown` and `ifUnacknowledged`. Show the player `totalUsd`, then pass it as the new optional `acknowledgedTotalUsd` on `purchaseCurrency`: the card is charged that total, to the cent, and the coins are priced off `usdAmount`. $10.00 quotes $10.65.
192
+ - **Send only `usdAmount`.** The card is charged exactly `usdAmount`, never more, and the fee comes out of the coins: $10.00 credits 93.70 coins at the default 10 per USD.
193
+
194
+ A `success` result now also carries `processingFeeUsd`, `feeTakenFrom` (`"charge"` or `"coins"`), `coinsCredited` and `chargeTotalUsd`. New error helpers: `err.isQuoteStale` (409 `QUOTE_STALE`, with `err.expectedTotalUsd` and `err.acknowledgedTotalUsd`) and `err.isAmountBelowFee` (400 `AMOUNT_BELOW_FEE`). Nothing is charged on either. `acknowledgedTotalUsd` is shape-checked locally (a positive two-decimal amount) with a ceiling above the largest price, because the fee rides above INVO's card maximum.
195
+
196
+ **Refunds of coin purchases:** only unspent coins are refundable; spent coins are never refunded. Documented; no SDK call refunds a coin purchase.
197
+
198
+ **Paid trials on card subscriptions.** `subscriptions.create` accepts `trialAmountUsd` (with `trialDays` or `trialEnd`, card only, at least 0.50 and less than `amountUsd`): period 1 is charged the trial price inside the call and `amountUsd` from period 2. The consent object accepts `disclosedTrialAmountUsd`, `disclosedTrialDays` and `disclosedTrialEnd`, and returns `disclosed_trial_amount_usd`, `disclosed_trial_days` and `disclosed_trial_end`. The subscription gains `trialAmountUsd` and, on create and finalize bodies, `trialAmountCoinsEstimate`. Webhook types: `is_trial` on `subscription.renewed`; `is_trial` and `trial_amount_usd` on the trial period's `payment_failed`, `past_due`, `authentication_required` and `expired` (new `SubscriptionTrialEventFields`); `expire_cause` (`"trial_payment_failed"`) on `subscription.expired`. New error helpers: `isPaymentMethodRequired`, `isTrialAmountInvalid`, `isTrialAmountRequiresTrial`, `isTrialAmountNotSupportedForFunding`, `isConsentDisclosedTrialInvalid`. The SDK refuses, before the network and with INVO's own codes, a `trialAmountUsd` without a trial, with `walletOnly: true`, or on `steamInit`; the $0.50 floor and the "less than `amountUsd`" rule are left to INVO.
199
+
200
+ **README:** a new Tiers section (Open by default: you are the seller and handle tax; Merchant of Record by application: INVO is the seller and handles tax; fees per tier), the coin fee flow, the refund rule and paid trials. Every statement that INVO is the merchant of record on the card rail for everyone is removed.
201
+
202
+ All additive: no export was removed, renamed or retyped, and every new field on an existing type is optional.
203
+
204
+ ## 3.12.1
205
+
206
+ ### Patch Changes
207
+
208
+ - Docs: subscription packages.
209
+
210
+ The README's Subscriptions section gains a **Subscription packages** part. A package (the API calls it a plan) is what a developer sells: a name, a price, a billing interval and the `item_id` the game checks. Packages are created, edited, closed and reopened in the INVO dashboard with the developer's own sign-in, never with the game secret or a player token, so this SDK does not wrap them and has no `packages` or `plans` namespace. That is deliberate.
211
+
212
+ Nothing about an integration changes. `server.subscriptions.create(...)` and `steamInit(...)` still subscribe a member to an `itemId`, webhooks carry the same payloads, and entitlement still comes from `subscription.renewed`. A package's subscriber counts and monthly revenue are measured per title and `item_id`, so a new package immediately shows the members already subscribed to its item. The section also covers the two counts (`subscriber_count` on basis `active`, `live_subscriber_count` on basis `live`), who a price change applies to, and that closing a package cancels nobody. Full guide: https://docs.invo.network/docs/subscriptions-packages/
213
+
214
+ Doc correction: the subscription refund daily limit. The README and the `subscriptions.refund` JSDoc said a game's daily self-serve refund limit is $500 by default. It no longer is: by default the limit is never lower than the largest single subscription charge (`25000.00` USD today), so any single period can always be refunded on its own, and if INVO raises the per-charge maximum the limit rises with it. INVO can still set a specific limit for one game, which applies as set, even if lower. Everything else about refunds is unchanged: reaching the limit exactly still runs, going over it answers HTTP 202 `pending_approval`, and approved requests do not count toward the day. The sandbox recipe now says how to see a 202 (ask INVO for a low limit on the sandbox game).
215
+
216
+ Documentation only. No export was added, removed, renamed or retyped.
217
+
218
+ ## 3.12.0
219
+
220
+ ### Minor Changes
221
+
222
+ - The card maximum is INVO's, not the SDK's.
223
+
224
+ **INVO raised the maximum single card charge from $999.99 to $100,000.00 on 2026-09-18, and this package was refusing it.** The old limit was enforced client-side and threw before any network call, so a partner charging $50,000 failed inside the SDK and INVO never saw the request. The backend raise was invisible to every SDK user until this release. Per-customer velocity limits rose with it, to 100,000 per hour, 200,000 per day and 1,000,000 per month, all enforced by INVO.
225
+
226
+ **The design decision: the floor is a fact, the ceiling is a policy, and only facts belong in a client.**
227
+
228
+ $0.50 is the card rail's own minimum charge. Below it nothing settles in any environment, INVO holds it as a plain constant rather than a setting, and no configuration makes a smaller amount chargeable. That check stays exactly where it was and still throws before any request (`BELOW_STRIPE_MINIMUM`, `err.isBelowCardMinimum`).
229
+
230
+ The maximum is the opposite. It is a runtime setting an INVO admin edits without a deploy, and it differs between sandbox and production. Any number pinned in a published package is stale the moment somebody changes it, and the only remedy is a release, which is precisely the failure this release is repairing. So the local ceiling is **removed** rather than re-pinned at $100,000.00. It was not replaced by a fetch of the live limits either: that would turn one purchase call into two network calls, add a failure mode and a cache to a money path, and still be a snapshot rather than the truth at the moment of charge, because only the request itself is evaluated against the setting in force.
231
+
232
+ What remains is a structural bound. `usdAmount` and a card `totalPrice` must still be a positive amount with at most two decimals, and must still be at most `999999.99`, the same house ceiling every other money field in this SDK uses. That figure is deliberately **above** the largest value INVO's setting is permitted to take, so it can never refuse an amount INVO would have accepted. The invariant for anyone editing this later: the local bound must never be tighter than the server's maximum possible limit. This SDK may cost you a wasted round trip. It must never cost you a sale that a package upgrade would have allowed.
233
+
234
+ **What changed for you**
235
+
236
+ - Amounts between `999.99` and `999999.99` are now sent instead of being rejected locally. Nothing that worked before stops working; the validation only loosened.
237
+ - `err.isAboveCardMaximum` is unchanged and still means what it always meant, but it now arrives only from INVO (a `400`), never from the SDK. Nothing was charged.
238
+ - An amount above `999999.99` now throws `INVALID_INPUT` where it previously threw `ABOVE_CARD_MAXIMUM`. That range is malformed input, not a policy refusal, and INVO classifies it the same way.
239
+
240
+ **When INVO refuses an amount the SDK allowed**, catch `err.isAboveCardMaximum`. `err.message` carries the figure that was in force for that request, for example "Card purchases must be $100,000.00 or less." Do not retry it unchanged: lower the amount, split the sale, or ask INVO to raise the setting. The live figure for a tenant is also the `max_amount` of the hosted checkout's `validate-game` read, next to `min_amount`; read that if you want to show a limit in your own UI, and re-read it, because it can change under you. A velocity limit is a `429` with `err.retryAfter`, not this error.
241
+
242
+ **README: the minimum is $0.50.** The docs said only `0 < x <= 999.99` and left the floor unstated. They now state $0.50, which is what INVO advertises and what the card rail actually enforces. A $1.00 minimum was advertised by INVO's own checkout read until 2026-09-18 and was enforced nowhere; it is gone rather than enforced, because enforcing it would newly refuse charges between $0.50 and $0.99 that settle today.
243
+
244
+ No export was added, removed, renamed or retyped.
245
+
246
+ ## 3.11.0
247
+
248
+ ### Minor Changes
249
+
250
+ - The purchase status read, and the subscription fee is 7%.
251
+
252
+ **A buyer can always be told what happened to the money they paid.** `invo.checkout` (and the standalone `CheckoutClient`, for a page with no player token) reads `GET /api/checkout/sessions/<id>`, authenticated by the SESSION token; the id in the path is a label, not a credential. `getPurchaseStatus({ sessionId, sessionToken })` reads once; `waitForPurchase({ ..., intervalMs, timeoutMs, maxAttempts, signal, onUpdate })` polls until INVO says it is finished and returns that result. Six statuses, four of them terminal, plus `orderId`, `coinsCredited` / `transactionId` / `newBalance` on a credit, `reasonCode` + a player-safe `message` on a refusal, and both money figures (`amountChargedUsd`, `listedUsd`) so a buyer billed 206.29 for a 200 pack can be shown where the 6.29 went.
253
+
254
+ `terminal` is read off the response and is NEVER recomputed from `status`, so a status a later backend introduces cannot make this build decide a purchase finished, or finished well. A status it does not recognise is not terminal and is never a success. `paid_pending_credit` is deliberately not terminal at any age: INVO's reconciler recovers a stalled credit. A failed poll is not a failed purchase: network, timeout, 429 and 5xx are polled through; 401, 403 and 410 are raised at once (`isWrongSessionPurpose`, `isCheckoutSessionMismatch`, `isCheckoutSessionExpired`). On the cap `waitForPurchase` returns the last result it read rather than throwing, so the page keeps showing something true.
255
+
256
+ `CheckoutPurchaseStatus` is a widened union (`… | (string & {})`), not a literal one, and a tsc test pins that partner code storing or comparing an unknown status still compiles, which is the fix 3.10.0 had to make to `RefundResult` after the fact. It is named `Checkout…` because `PurchaseStatus` is already the direct `purchaseCurrency` result and is unchanged. New: `CheckoutClient`, `InvoClient.checkout`, `isPurchaseCredited` / `isPurchaseRefused` / `isPurchaseRefunded` / `isPurchaseExpired`, `nothingWasCharged` (true only where INVO said no money was taken; everything else, an unknown code included, happened after the card was charged, so never put a Try again on it), and the types `PurchaseStatusResult`, `PurchaseStatusInput`, `WaitForPurchaseInput`, `PurchaseRefusalReason`, `PurchaseCredited` / `PurchaseRefused` / `PurchaseRefunded` / `PurchaseExpired`, `CheckoutClientConfig`.
257
+
258
+ `createCheckout()` now also returns `sessionToken`, read from INVO's `session_token` field (backend commit `856fa266`) and falling back to the `checkout_url` query string only for a server that predates it, so nothing has to parse a URL to use the read. The two cannot disagree, and if a response ever carried both and they differed the field wins, because a query-key spelling is not a contract.
259
+
260
+ **Doc fix: INVO's subscription fee is 7% plus $0.30, not 10%** ($9.99 pays INVO $1.00 and you $8.99). Subscriptions became their own rate on 2026-09-17; item purchases stay at 10/90. No code change.
261
+
262
+ **Not included: withdrawals.** INVO's withdrawal request and history reads gained additive `kyc_hold`, `kyc_hold_reason` and `next_steps` fields on 2026-09-17. This package exposes no withdrawal surface at all, so there is nowhere for them to go, and adding one is a separate decision rather than part of a documentation pass.
263
+
264
+ **Fixed: the User-Agent version had drifted.** `SDK_VERSION` was left at `3.10.0` when 3.10.1 published, so every server call from 3.10.1 reported a version that was not the one running, and the test pinning it to `package.json` was failing on `main`. Back in step, and the pin is green.
265
+
266
+ ## 3.10.1
267
+
268
+ ### Patch Changes
269
+
270
+ - `linkDevice()` takes no arguments. The server mints the link id, so requiring one was wrong: callers had to invent a placeholder. The parameter stays optional and any value passed is still sent and ignored by the server, so code written against 3.10 keeps working unchanged. The README now also states that a tenant whose players enrol a passkey on the tenant's own domain MUST offer `linkDevice()`, because that credential can only be asserted on that tenant's origin, and that recovery is never the answer to `ENROLLMENT_REQUIRES_PROOF`.
271
+
272
+ ## 3.10.0
273
+
274
+ ### Minor Changes
275
+
276
+ - f66103c: Card-only subscriptions and subscription refund guardrails (INVO backend, 2026-09-17). Everything here is additive: no field, type or behaviour of an existing call was removed or renamed.
277
+
278
+ **Card-only subscriptions (behaviour change on INVO's side, no type changes).** A card subscription's card is now charged the full price every period; the member's coin wallet never pays for it and never moves. Steam subscriptions are unchanged (wallet first, Steam tops up the shortfall).
279
+
280
+ - `subscription.renewed` on the card rail: `funding.balance_applied_coins` is always `"0.00"`, `funding.card_charged_usd` is the price, `mint_order_id` is never `null`.
281
+ - Every paid card renewal also emits `purchase.completed` with `data.metadata.source === "subscription_renewal"`. Do not grant currency from it; `subscription.renewed` is the entitlement signal.
282
+ - A member with no saved card fails with `failure_code: "no_payment_method"` whatever their balance. New additive `failure_code`: `wallet_negative`.
283
+ - `walletOnly` is marked `@deprecated` (still accepted and returned): a wallet-only card subscription can never be paid (`failure_code: "wallet_only"`).
284
+ - `subscription.authentication_required`: `card_amount_usd` now equals `amount_due_usd` on card challenges.
285
+ - Doc fix: the `amountUsd` JSDoc now states the per-charge ceiling of `25000.00` (it still said `500.00`), and `SubscriptionExpiredData` no longer says `steam_containment` is sent.
286
+
287
+ **Subscription refund guardrails.**
288
+
289
+ - `subscriptions.refund` can now return a refund request. `RefundResult` stays a single interface (its `status` is typed `"refunded" | "pending_approval" | (string & {})`, so any string still assigns and compares); branch with the new `isRefundPendingApproval(r)` type guard, which narrows to `RefundPendingApproval`. `"pending_approval"` is the new HTTP 202: the refund would exceed the game's daily self-serve limit ($500 by default), nothing moved, and INVO reviews it as a refund request (`requestId`, `requestStatus`, `requestedAmountUsd`, `requestedAt`, `dailyCapUsd`, `executedTodayUsd`, `message`). Both carry every receipt field; the `request*` fields are optional on `RefundResult` and required on `RefundPendingApproval`. The status string is passed through from INVO unchanged.
290
+ - New optional result fields: `warnings` (`REASON_RECOMMENDED`, `REASON_TRUNCATED`), `subscriptionCanceled`, `subscriptionStatus`, `processingFeeUsd`, `processingFeeBasis`, `processingFeeBorneBy`, `processingFeeTransactionId`, `partnerTotalReversedUsd`, `initiation`, `refundRequestId`. `undefined` on receipts stored before the change.
291
+ - `reason` is documented as recommended now and required after a notice period. Refunds run within 30 days of the charge. A full refund cancels the subscription. Card-only periods are refunded in cash, partial included. The partner bears the card processor fee. INVO emails the member.
292
+ - New `InvoError` classifiers: `isRefundsNotEnabled` (403), `isRefundWindowClosed` (409), `isRefundRequestPending` (409), `isRefundRequestRejected` (409), `isConcurrentRequest` (409), `isRefundMismatch` (502), with body accessors `refundRequestId`, `decisionReason`, `periodChargedAt`, `refundWindowDays`, `refundWindowClosedAt`.
293
+ - New webhook types: `subscription.refund_requested`, `subscription.refund_approved`, `subscription.refund_rejected` (`SubscriptionRefundRequestData`, `SubscriptionRefundApprovedData`, `SubscriptionRefundRejectedData`). Additive fields on `subscription.refunded` (`refund.processing_fee_*`, `refund.partner_total_reversed_usd`, `initiation`, `refund_request_id`, `subscription_canceled`) and `subscription.canceled` (`cancel_cause: "full_refund"`).
294
+ - New exports: `isRefundPendingApproval`; types `RefundReceipt`, `RefundPendingApproval` (both extend `RefundResult`), `RefundWarning`, `RefundInitiation`, `RefundProcessingFeeBasis`.
295
+
296
+ **Compatibility.** Additive only. Code that compares `status` to any string, builds `RefundResult` mocks with a `string` status, or `extends`/`implements` `RefundResult` keeps compiling (pinned by a tsc test). `subscription.refunded`, `subscription.refund_approved` and, on a full refund, `subscription.canceled` are sent together and may arrive in any order.
297
+
298
+ README: the Subscriptions section states card-only funding, the renewal `purchase.completed` trap, the refund limits and the 202, the new events and classifiers, and "what did I earn" now subtracts `partner_total_reversed_usd`.
299
+
300
+ ## 3.9.0
301
+
302
+ ### Minor Changes
303
+
304
+ - The INVO-hosted card page is the recommended way to save a card for a subscription.
305
+
306
+ New on `invo.cards`:
307
+
308
+ - **`createSetupSession({ playerEmail, successUrl?, cancelUrl?, metadata? })`** ->
309
+ `{ sessionId, cardSetupUrl, expiresAt, raw }` (`POST /api/checkout/card-setup-sessions`,
310
+ game secret header). Mint a 10-minute link server-side, send the member to `cardSetupUrl`
311
+ (top-level, never framed), and read the saved card's `id` back from `cards.list`; it appears
312
+ there immediately, carries the off-session consent a subscription needs, and no event fires
313
+ for it. No browser code, no client secret, no card processor named anywhere, so INVO can change
314
+ processor without partners changing anything. Never auto-retried: each call mints a fresh link.
315
+ Script-scheme `successUrl` / `cancelUrl` values are refused before the network (`INVALID_INPUT`,
316
+ status 0), matching INVO's own rule.
317
+ - `beginSetup` / `confirmSetup` are now documented as the **processor-bound alternative**: they
318
+ hand back a `clientSecret` only the current processor's client library can consume, so a card
319
+ form built on them needs rework when INVO changes processor.
320
+
321
+ New error classifiers: `isPlayerNotFound` (404 `PLAYER_NOT_FOUND`: the card page never creates
322
+ players), `isInvalidPlayerEmail` (400 `INVALID_PLAYER_EMAIL`), `isInvalidInput` (`INVALID_INPUT`,
323
+ at status 0 from the SDK's own guards or 400 from INVO for a script-scheme URL).
324
+
325
+ Fixed: `subscriptions.get(id, { includePlayer: true })` never populated `player`. INVO puts
326
+ `player_email` / `player_name` on the subscription object itself, not in a separate block; they
327
+ are now surfaced as `subscription.playerEmail` / `subscription.playerName`, and `player` is
328
+ derived from them.
329
+
330
+ README: a "Cards for subscriptions" section a partner can follow start to finish (mint, send,
331
+ read the card back, subscribe, what each error means, the 10-minute session, no browser code).
332
+
333
+ README corrections that ride along in this release: `subscription.expired` no longer carries
334
+ `failure_code: "steam_containment"` (a balance is spendable in any title whatever rail bought
335
+ it, so the "wallet value that cannot be spent in this game" deferral is gone from the deferrals
336
+ paragraph and the event table); the Steam transfer-policy note now says it is a rule about
337
+ currency moving between titles, not about spending (an item purchase never fails on origin);
338
+ and "game" reads "title" in a few places so a platform tenant is not misled by the word.
339
+ Line endings: a `.gitattributes` (`* text=auto eol=lf`) keeps the packed README, CHANGELOG and
340
+ package.json LF on every checkout (3.9.0's first build packed CRLF from a Windows checkout).
341
+
342
+ ## 3.8.1
343
+
344
+ ### Patch Changes
345
+
346
+ - Subscription docs: the per-charge ceiling is 25000.00, not 500.00, and it is
347
+ per CHARGE rather than per month. An annual plan bills the whole year in one
348
+ go, so a $500 a month plan sold as a 12-month plan is a single $6,000 charge
349
+ and is chargeable. The old number quietly refused every annual plan above
350
+ $41.66 a month.
351
+
352
+ ## 3.8.0
353
+
354
+ ### Minor Changes
355
+
356
+ - Subscriptions are a first-class server surface, on both rails, with the card capture and the
357
+ sandbox clock tools beside them.
358
+
359
+ New on `InvoServer`:
360
+
361
+ - **`invo.subscriptions`**: `create` (card rail; charges the first period before answering,
362
+ idempotent on `clientRequestId`, a repeat is a typed `idempotentReplay: true` result),
363
+ `get`, `listForPlayer`, `cancel` (an already-terminal row is a 200 `alreadyCanceled`, never
364
+ thrown), `changeAmount` (staged for the next renewal), `setPaymentMethod`, `refund`
365
+ (idempotent; the receipt replays), `steamInit` and `steamFinalize` (Steam rail;
366
+ `alreadyProcessed` is a result, not an error).
367
+ - **`invo.cards`**: `beginSetup` / `confirmSetup` / `list`: the off-session card capture a
368
+ card subscription needs. The hosted checkout does not save a card for subscriptions.
369
+ - **`invo.sandbox.subscriptions`**: `advanceClock` / `forceRenewal` / `forceFailure` /
370
+ `forceAuthChallenge`. These post to `/subscriptions/<id>/...` **relative to the sandbox
371
+ base URL, not under `/api`**, and send `X-Sandbox-Clock-Key` from the new
372
+ `sandboxClockKey` config; a missing key throws before the network.
373
+
374
+ Typed results: `SubscriptionResult` (the subscription object with its TWO clocks,
375
+ `firstCharge` with `paidPeriodSeq`, `card`, `idempotentReplay`), `FirstCharge` (`paid` |
376
+ `requires_action` | `skipped_trial` | `failed` | `pending` | `pending_authorization`),
377
+ `SteamInitResult` (`steamOrderId` for the client callback, `amountCoins`, `pendingReuse`),
378
+ `CancelResult`, `ChangeAmountResult`, `RefundResult`, `CardSetupResult`, `SandboxClockResult`
379
+ (`engineStats`), and typed `data` for all seven `subscription.*` webhook events.
380
+
381
+ Error classifiers: `isActiveSubscriptionExists` (+ `existingSubscriptionId`),
382
+ `isIdempotentReplayMismatch` (+ `mismatchedFields`), `isSteamReauthorizationRequired`,
383
+ `isNotACardSubscription`, `isSteamChannelRequired`, `isSubscriptionTerminal`,
384
+ `isNotAuthorized`, `isSandboxClockUnauthorized`, `isSteamRefundNotSupported`, `isFlowPaused`,
385
+ `isGameNotLive`; `isSteamAuthorizationPending` now also covers the subscription 409.
386
+
387
+ Also: the server `User-Agent` version now derives from the package version (it had read
388
+ `3.0.0` since 3.0.0), pinned by a test.
389
+
390
+ ## 3.7.0
391
+
392
+ ### Minor Changes
393
+
394
+ - Device approval grant (RFC 8628) is now a first-class server surface — including **the
395
+ step that moves the money**.
396
+
397
+ An integrator followed the README, polled a grant to `approved`, and stopped. Nothing
398
+ moved: an approved grant is a _factor_, and the transaction sat at
399
+ `pending_pin_verification` until it expired and was refunded. The README's section ended
400
+ at the poll and neither package had a method for the step after it. Both halves of that
401
+ are fixed here.
402
+
403
+ New on `InvoServer` (all authenticate with the **player token** — on a console the game
404
+ server holds the token it minted, and the game secret is never sent):
405
+
406
+ - `beginDeviceApproval({ playerToken, transactionId, flow, channel? })` → the RFC 8628
407
+ §3.2 grant (`deviceCode`, `userCode`, `verificationUriComplete`, `expiresIn`,
408
+ `interval`, `channel`). `channel: "popup"` is refused before the network — it is
409
+ browser-only (`InvoClient.approveHosted`).
410
+ - `pollDeviceApproval({ playerToken, deviceCode })` → a typed outcome
411
+ (`authorization_pending` / `slow_down` / `approved` / `access_denied` /
412
+ `expired_token`), plus the `enrollment` object while a first-time phone waits on the
413
+ game screen. `invalid_grant` throws.
414
+ - `confirmDeviceEnrollment({ playerToken, deviceCode, decision })` → answers the
415
+ on-screen match-code prompt (`"approve"` | `"deny"`).
416
+ - **`approveWithDeviceCode({ playerToken, transactionId, flow, deviceCode })` — the money
417
+ step.** Routes by flow: `send` → `/api/sdk/send/{id}/approve`, `transfer` →
418
+ `/api/sdk/transfers/{id}/approve`, `send_receipt` →
419
+ `/api/sdk/send/{id}/confirm-receipt`, `transfer_receipt` →
420
+ `/api/sdk/transfers/{id}/confirm-receipt`. Never auto-retried.
421
+ - `completeDeviceApproval(...)` — convenience loop: polls honouring `interval` and
422
+ `slow_down`, surfaces the enrollment prompt, then calls `approveWithDeviceCode`.
423
+
424
+ **`TRANSACTION_NOT_PENDING` is a result, not a throw.** `approveWithDeviceCode` returns
425
+ `{ status: "not_pending", alreadySettled, currentStatus }` so "your earlier attempt
426
+ already landed" is distinguishable from a real refusal **without string-matching** — the
427
+ difference between "the guard worked" and "her currency is stuck". Every other refusal
428
+ stays a typed thrown `InvoError`.
429
+
430
+ `alreadySettled` is **flow-aware and fails closed**. The four endpoints gate on different
431
+ status sets — the sender approves accept `pending_pin_verification` /
432
+ `pending_verification`, the two receipt endpoints accept `pending_claim` / `verified` — so
433
+ a receipt settle landing on `pending_pin_verification` means the SENDER has not approved
434
+ yet (possibly held at a guardian 202). That is _before_ the step, not past it, and calling
435
+ it settled would tell a game to hand over goods for value never credited. It is an
436
+ allow-list per flow rather than a "not expired/failed" deny-list, so a status INVO adds
437
+ later answers `alreadySettled: false` with `currentStatus` set — go read the transaction —
438
+ instead of defaulting to "the money moved" in already-deployed copies of this SDK.
439
+
440
+ Older backend bodies that carried only the message ("Transaction not pending…", "…cannot
441
+ be confirmed…") with no machine code are matched too, but narrowly: HTTP 400, one of those
442
+ two phrases, **and** a readable `(current status: …)` / `(status: …)` clause. "cannot be
443
+ confirmed" is ordinary English, so a phrase match alone can never assert that money moved.
444
+
445
+ New `InvoError` predicates: `isTransactionNotPending`, `currentTransactionStatus`,
446
+ `isDeviceApprovalNotApproved`, `isDeviceApprovalAlreadyPending`,
447
+ `deviceApprovalExpiresAt`, `isSettleFault`, `errorRef`. The RFC 8628 §3.5 tokens are
448
+ promoted onto `err.code`.
449
+
450
+ Two safety fixes in `completeDeviceApproval`: `transactionId` is validated **before** the
451
+ loop (an empty id used to poll for minutes, let the player approve, and only then throw —
452
+ an approved grant with nothing settled), and the `respond` callable handed to
453
+ `onEnrollment` now resolves quietly for every "the prompt is moot" refusal
454
+ (`expired_token`, `invalid_grant`, and the two enrollment 409s) instead of rejecting. A
455
+ prompt on a TV routinely outlives its ten-minute grant, callers fire `respond` without
456
+ awaiting it, and an unhandled rejection exits a Node process.
457
+
458
+ README: the console section is rewritten around begin → show the QR → poll → **call
459
+ `approveWithDeviceCode`** → webhooks, with the supersede-vs-409 begin semantics corrected
460
+ and "consumed when used" replaced by _when_ the code is spent. A new top-level **Sends and
461
+ transfers, stage by stage** section covers both flows and both sides with a
462
+ call-order table, an error table, and a common-mistakes box led by "polling to `approved`
463
+ and stopping". The error tables now also carry the receipt-flow-only refusals a console
464
+ recipient meets (`receiver_not_enrolled_use_claim_code`, `not_intended_receiver`, the
465
+ phone-share 409, `RECIPIENT_IDENTITY_PENDING` / `_DECLINED`) and a warning that a settle
466
+ FAILURE is ambiguous about the money — INVO commits and then reads the transaction back to
467
+ build its 200, so a `*_FAILED` or a timeout can both describe money that already moved:
468
+ read the transaction status before telling the player it failed, and never auto-start a
469
+ replacement. SMS is now confined to a clearly-labelled legacy-fallback subsection.
470
+
471
+ ## 3.6.0
472
+
473
+ ### Minor Changes
474
+
475
+ - New: `InvoClient.approveHosted({ transactionId, flow })` — web games approve on INVO's
476
+ hosted identity page. The browser is the RFC 8628 client: with the player token it already
477
+ holds, the SDK calls `POST /api/sdk/approvals/device/begin` with `channel: "popup"` (INVO
478
+ records the page's `Origin` as the popup's opener), opens the hosted page in a popup
479
+ (synchronously, inside your click handler), polls `poll` honouring `interval` and
480
+ `slow_down` (+5 s), drives the INVO-branded match-code prompt from the poll's `enrollment`
481
+ object ("Set up INVO on iPhone? Code 48-27. Say Yes only if the phone you just
482
+ scanned/opened shows this code." → `confirm-enrollment`; `confirmed` shows "Finishing on
483
+ iPhone… / Stop it, wrong code"; a 409 already-decided takes it down quietly), and when the
484
+ poll says `approved` calls the flow's approve endpoint with the `device_code` —
485
+ `transfers/{id}/approve`, `send/{id}/approve`, `send/{id}/confirm-receipt`,
486
+ `transfers/{id}/confirm-receipt`. Resolves `{ status: "approved", approval }` (the same
487
+ `ApproveResult` / `ConfirmReceiptResult` the in-app calls return) or `denied` / `expired` /
488
+ `closed` / `blocked` / `redirected`; rejects with `InvoError` when the backend refuses.
489
+ `device_code` lives in the call's closure only — never on the result, never logged. The
490
+ page's `postMessage` is a wake-up that triggers an immediate poll (accepted only from the
491
+ hosted page's https origin and only from the popup the SDK opened), never a result. A
492
+ popup blocked by the browser resolves `blocked` before anything is started (default);
493
+ `popupBlocked: "redirect"` opts in to a full-tab redirect. A page sending
494
+ `Cross-Origin-Opener-Policy: same-origin` is detected and reported as `blocked` with a
495
+ hint. Your server does nothing new; its `device_approval.approved` webhook still fires.
496
+ In-app partner-domain passkeys are unchanged and remain supported. `onEnrollment(e,
497
+ respond)` + `renderPrompt:false` let a game draw its own prompt.
498
+
499
+ Docs: new "Web games — approving on INVO's hosted page" section; the console-flow poll
500
+ example now shows `match_code`. Test-only devDependency added: `happy-dom`.
501
+
502
+ Docs (hosted identity pages, Phase 7): the console section documents `channel` on
503
+ `begin` (`qr` default | `popup` — the browser must call `begin` itself, its https `Origin`
504
+ becomes the popup's opener, server-to-server callers are refused | `app_browser` — the
505
+ mobile plugins; the return scheme `invo-sdk-<game_id>` is derived server-side), the echoed
506
+ `channel` on the begin body, `recovery` on the poll's `enrollment` object, the hosted
507
+ passkey-recovery flow (screen confirm + emailed single-use link → old INVO passkeys
508
+ deactivated, `identity.passkey_reset` webhook, 24-hour `PASSKEY_RECOVERY_COOLDOWN` on
509
+ money out; receiving unaffected), the mobile auto-confirm note (`app_browser` enrolment is
510
+ confirmed by INVO, no prompt), and `ENROLLMENT_REQUIRES_PROOF` on the page. Sends &
511
+ transfers: guardian approval now goes by email first (`consent_channel` and
512
+ `resend_endpoint` on the raw 202 `guardian_approval` block; `decision_source: "email_link"`),
513
+ the once-per-approval `POST /api/sdk/approvals/guardian/{approvalId}/resend` `{channel:"sms"}`
514
+ contract (initiator's token; 403/409/410/503 codes), and phone-share / recipient-identity
515
+ consents on the same hosted page (unchanged 409 / 202 codes, `consent_channel` on the
516
+ phone-share body). Passkeys: the partner-domain freeze — new titles have nothing to verify
517
+ (`409 PARTNER_RP_FROZEN`; `WEBAUTHN_NOT_ENABLED_FOR_TENANT` is the expected state, use
518
+ `approveHosted`), tenants with a domain verified before the freeze keep it, removal is
519
+ irreversible. The "SMS first, then email" fallback sentence corrected to "email first, SMS
520
+ on request". Documentation only.
521
+
522
+ ### Patch Changes
523
+
524
+ - Docs: the device-approval page (RFC 8628, consoles / TVs / native Steam and desktop
525
+ clients) now enrols the player's INVO passkey on the **first** scan, and the proof is the
526
+ game screen: the phone says "confirm on your game screen", the game shows "Set up INVO on
527
+ this phone: iPhone?", the player presses Yes on the console, and the phone's biometric
528
+ creates the passkey and approves — no code to type, no SMS; every later scan is scan,
529
+ biometric, done. The "the player needs an INVO passkey" bullet is replaced accordingly.
530
+ Documents the two integrator-facing additions: the `enrollment` object
531
+ (`state` / `device_label` / `requested_at`) on the `authorization_pending` poll body while
532
+ a phone is waiting, and `POST /api/sdk/approvals/device/confirm-enrollment`
533
+ (`{device_code, decision: "approve" | "deny"}`, same auth as begin/poll; deny ends the
534
+ grant with `access_denied`), plus the backup email. Also documents two backend
535
+ behaviours: `begin` extends the transaction's own approval window past the code's expiry
536
+ (`transfer` / `send`), and `begin` may be called again for the same transaction once an
537
+ approved code's window has passed. Documentation only — no code or type changes; the
538
+ `begin`/`poll` endpoints, the `device_approval.approved` webhook and its `method` value
539
+ are unchanged.
540
+
541
+ Also on the send side: the claim SMS now carries a link to a hosted INVO claim page where
542
+ a recipient without the game collects with one email + an emailed code + their phone's
543
+ passkey (in-game claim unchanged; `transfer.received` fires the same); documents the
544
+ sender-token REST call `POST /api/sdk/send/{transactionId}/resend-claim` (30-second
545
+ cooldown, 10 per transaction per hour — no SDK method); and that an uncollected send is
546
+ still refunded at 24 hours but the sender is now emailed and the recipient texted, with
547
+ `transfer.claim_expired` / `transfer.refunded` as the source of truth. The `transfer.*`
548
+ rows were added to the event-types table.
549
+
550
+ - df2efe9: Docs: add an explicit per-platform verification/approval recommendation. The
551
+ "gold standard" section now spells out which method fits which client — a passkey
552
+ directly on mobile app/web and desktop web, and the QR device-approval flow
553
+ (RFC 8628) on consoles **and** on native Steam / desktop game clients (Mac &
554
+ Windows), where it is the embedded game client, not the OS, that can't invoke the
555
+ platform authenticator. Also documents the SMS-first-then-email fallback for
556
+ remote approvals with no passkey path. Documentation only — no code or type
557
+ changes; the `VerificationMethod` union and the device-approval REST flow are
558
+ unchanged.
559
+
560
+ All notable changes to `@invonetwork/web-sdk` are documented here. This project follows
561
+ [Semantic Versioning](https://semver.org/). Releases are managed with
562
+ [changesets](https://github.com/changesets/changesets).
563
+
564
+ ## [3.5.0] - 2026-09-01
565
+
566
+ **The Steam purchase flow is now first-class SDK surface: `steamPacks()`, `steamInitPurchase()`, `steamFinalizePurchase()`** — plus browser-based checkout for platforms where the Steam overlay does not render, a finalize-poller error taxonomy, and webhook `channel` typing. No breaking changes.
567
+
568
+ Until now the SDK only _steered away_ from Steam (`purchaseCurrency` fails fast on `rail: "steam"`); the dedicated endpoints had to be called by hand. All three are typed methods now, and the fail-fast message names them.
569
+
570
+ ### Added
571
+
572
+ - **`InvoServer.steamPacks(query?)`** — the pack catalogue. `currencyAmount` is per-player (VAT and the storefront's revenue share come out of the sticker before currency is derived — a $4.99 pack yields 34, not 50, units at $1 = 10). Render it verbatim; never compute currency from price and never cache one answer for all players.
573
+ - **`InvoServer.steamInitPurchase(input)`** — start the purchase. Idempotent on `purchaseReference` (retries, including manual retries after a 409, MUST reuse it). New authorization modes:
574
+ - `usersession: "client"` (default, unchanged): Steam overlay in-game. The SDK sends **no** `usersession` key at all in this mode, pinned by test, so existing behaviour cannot shift.
575
+ - `usersession: "web"`: for platforms where the overlay does not render (observed: Electron on macOS). Requires `playerIp` — the PLAYER's address, never your server's; refused client-side before the network without it. Returns `steamCheckoutUrl`: Steam's own hosted approval page, which must open as a **top-level tab** (it cannot be iframed). _Note: Steam's sandbox issues checkout URLs its production host will not serve, so web-session approval is provable only against production; the rest of the flow is identical to client-session._
576
+ - `metadata` — echoed on the `purchase.completed` webhook (`data.metadata`) — the way to correlate your own player/order ids. The Steam rail merges its own context keys (`steam_wallet_currency`, `steam_country`, `steam_account_status`, `vat_rate_pct`) into the echoed object; avoid those names in yours.
577
+ - **`InvoServer.steamFinalizePurchase({orderId})`** — capture + credit. Idempotent: a replay returns `alreadyProcessed: true` and never credits twice.
578
+ - **Finalize poller taxonomy on `InvoError`** — because _not every 409 means "not yet"_, and a poller that assumes so polls a dead order forever:
579
+ - `isSteamAuthorizationPending` — player has not approved yet (Steam reports `Init`). The normal wait state; poll again.
580
+ - `isSteamAuthorizationDead` — any settled status — `Cancelled`, `Failed`, `Refunded`, `Chargedback`, and every other non-Init outcome (pending is the CLOSED set: only `Init` means "not yet"). Stop; no later call can succeed.
581
+ - The two are mutually exclusive by construction, and a test pins that they can never both answer true.
582
+ - **`InvoError.isPartnerCreditUnavailable`** (`PARTNER_CREDIT_UNAVAILABLE`, 409) — the studio's settlement float cannot cover the purchase. Structure is fine; the money is not. Plain failure toast; do **not** hot-poll init (each attempt briefly re-reserves headroom), and reuse the same `purchaseReference` on manual retry.
583
+ - **`InvoError.isPartnerRailSuspended`** (`PARTNER_RAIL_SUSPENDED`, 409) — terminal from the game's seat. The umbrella `isPartnerSettlementUnavailable` still covers both.
584
+ - **`InvoError.isUnknownSteamPack`** (400) — re-fetch `steamPacks()`; the body's `valid_pack_ids` lists what exists.
585
+ - **`InvoError.isMissingPlayerIp`** (400) — always an integration bug on web sessions.
586
+ - **`PurchaseCompletedData.channel`** — which storefront the purchase came from (`"steam"` / `"ios"` / `"android"` / `"web"` / `"console"`), beside `rail`. `null` means a legacy game key: a real answer ("unattributed"), read it as one.
587
+
588
+ ### Changed
589
+
590
+ - `purchaseCurrency`'s `rail: "steam"` fail-fast message now names the real methods instead of vaguely citing "dedicated endpoints".
591
+
592
+ ## [3.4.0] - 2026-09-01
593
+
594
+ **A Steam title now bills through its OWN Steam application.** New error helpers;
595
+ no breaking changes to any existing method or type.
596
+
597
+ ### Why this is a real change and not a doc tidy
598
+
599
+ Steam pays whoever owns the Steam application. Until now, INVO documented a
600
+ single INVO-owned Steam app that billed every title on the network — so a studio
601
+ had nothing to register and the money reached them through INVO. That model is
602
+ gone. Each title sells through the studio's own Steam app, the money lands in
603
+ their own Steamworks account, and INVO issues the player's currency immediately
604
+ and settles with the studio afterwards against a payment method on file.
605
+
606
+ If you shipped against 3.3.0 or earlier and your Steam integration works today,
607
+ nothing in your code needs to change. What changes is the **studio's** one-time
608
+ setup, and the errors you may now see if they have not done it.
609
+
610
+ ### Added
611
+
612
+ - `InvoError.isSteamNotConfigured` — the title has no Steam application
613
+ registered with INVO yet (`STEAM_NOT_CONFIGURED`, 503).
614
+ - `InvoError.isPartnerBillingNotSetUp` — the studio has not finished INVO billing
615
+ setup (`PARTNER_BILLING_NOT_SET_UP`, 409).
616
+ - `InvoError.isPartnerSettlementUnavailable` — settlement suspended or over
617
+ limit (`PARTNER_RAIL_SUSPENDED` / `PARTNER_CREDIT_UNAVAILABLE`, 409). Show a
618
+ neutral "purchases are unavailable right now": it is not the player's problem.
619
+ - `InvoError.isSteamAppChanged` — the order was started against a different
620
+ Steam application than the title is configured for now (`STEAM_APP_CHANGED`,
621
+ 409). Only reachable if a studio swaps apps mid-flight.
622
+
623
+ All four are refused **before the player is charged**, which is the point.
624
+
625
+ ### Changed
626
+
627
+ - README: the Steam section now documents the studio's Steamworks setup
628
+ (microtransactions enabled, a publisher-GROUP Web API key that includes the
629
+ app, appid + key entered in the INVO dashboard, payment method on file).
630
+ - README: removed the claim that no Steam-side registration was required.
631
+
632
+ ## [3.3.0] - 2026-08-31
633
+
634
+ **Documentation only. No code changes, no API changes.**
635
+
636
+ Documents **Device Approval** — passkey step-up for consoles, TVs and any device
637
+ with no browser. It is the OAuth 2.0 Device Authorization Grant
638
+ ([RFC 8628](https://datatracker.ietf.org/doc/html/rfc8628)), so a standard
639
+ client library understands the responses.
640
+
641
+ - The device shows a short code and a QR (`verification_uri_complete`); the
642
+ player approves on their phone; your **server** polls
643
+ `POST /api/sdk/approvals/device/poll` until it hears back.
644
+ - **One approval authorises one transaction.** Unlike the plain RFC 8628 grant,
645
+ which authorises a _client_, an INVO device code is bound to the transaction
646
+ you named and is consumed when used — it cannot approve anything else and
647
+ cannot be reused.
648
+ - `user_code` is meant to be seen; `device_code` is not. Poll from your backend.
649
+ - Subscribe to `device_approval.approved` to learn the moment an approval lands
650
+ instead of waiting for the next poll. Polling still works alone.
651
+ - Available to every title with nothing to configure — the constraint is a
652
+ property of the _device_, not the game, so a title with a website and a
653
+ console build uses the normal ceremony in the browser and this one on console.
654
+ - Currency purchases on a console go through that console's store, as the
655
+ platform holder requires; this flow is for approving transfers and sends.
656
+
657
+ Minor rather than patch because it documents a new API surface. The snippets are
658
+ pinned by a test against this file, for the same reason the Steam ones are: a
659
+ REST flow with no SDK method behind it is the one thing no other test can see.
660
+
661
+ ## [3.2.3] - 2026-08-28
662
+
663
+ **Documentation only. No code changes, no API changes.** Corrects two errors in
664
+ the 3.2.2 Steam snippets that made them fail if copied.
665
+
666
+ - **Base path.** The snippets said `/api/enhanced-purchase/...`. The routes are
667
+ mounted at **`/api/currency-purchases/...`** -- `enhanced_purchase_api` is the
668
+ module name, not the mount point. Copying 3.2.2 returned `404 Resource not
669
+ found`, which reads like the Steam rail is unavailable rather than like a
670
+ wrong URL.
671
+ - **Auth header.** The snippets sent `X-Game-Secret`. The header is
672
+ **`X-Game-Secret-Key`**, as it is everywhere else in this document. An unknown
673
+ header is ignored, so the request arrived unauthenticated.
674
+
675
+ Both were confined to the Steam section added in 3.2.2; every other snippet was
676
+ correct. The Steam flow itself is unchanged -- pack catalogue, `pack_id`,
677
+ VAT-aware amounts, all exactly as 3.2.2 describes.
678
+
679
+ The paths and header are now pinned by a test against this file, because the
680
+ Steam section is the one snippet with no SDK method behind it and so was the one
681
+ thing no test could see.
682
+
683
+ ## [3.2.2] - 2026-08-28
684
+
685
+ **Documentation only. No code changes, no API changes.**
686
+
687
+ Steam currency purchases now work on a **pack model**, and this documents it. The
688
+ 3.2.1 notes described an earlier design that has been replaced -- read this
689
+ instead.
690
+
691
+ - **INVO owns the Steam pack catalogue.** You do not set prices and you never
692
+ send an amount. Fetch `GET /steam/packs?steamid=...`, render it, and pass a
693
+ `pack_id` to `/steam/init-purchase`. An amount is refused with
694
+ `400 UNKNOWN_STEAM_PACK`.
695
+ - **The price is identical everywhere; the currency inside is not.** Steam prices
696
+ are VAT-inclusive wherever VAT is collected, so more of a fixed price goes to
697
+ tax in a high-VAT country -- the same $9.99 pack yields 69 units in the US and
698
+ 58 in France.
699
+ - **Always pass `steamid`** when fetching the catalogue. Without it amounts are
700
+ quoted with no VAT deducted, so a store promises more than the purchase
701
+ delivers. Do not cache one catalogue for all players.
702
+ - A Steam-distributed title may only sell currency on the `steam` rail
703
+ (`409 STEAM_PURCHASE_LAYER_REQUIRED`), and a locked Steam account is refused up
704
+ front (`409 STEAM_ACCOUNT_LOCKED`).
705
+
706
+ Steam remains a server-to-server REST flow rather than an SDK method, because the
707
+ purchase is authorised inside the Steam client and your game relays that.
708
+
709
+ ## [3.2.1] - 2026-08-28
710
+
711
+ **Documentation only. No code changes, no API changes.**
712
+
713
+ Documents two things about the Steam rail that the SDK does not change but every
714
+ Steam integration has to handle:
715
+
716
+ - **Currency for a Steam-distributed title must be bought on the `steam` rail.**
717
+ Any other rail is refused with `409 STEAM_PURCHASE_LAYER_REQUIRED`. This is a
718
+ platform requirement and it applies across every storefront the title ships on,
719
+ because a player's balance is shared between them.
720
+ - **The player is charged more than the value you request.** Steam's platform
721
+ commission is priced into the charge rather than absorbed, so the Steam
722
+ init-purchase response now carries `charged_usd` alongside `value_usd`. Show
723
+ `charged_usd` in your store. The currency the player receives is unchanged, so a
724
+ pack is worth the same in-game on every rail, and the rate is configuration --
725
+ read the response rather than hard-coding a multiplier.
726
+
727
+ ## [3.2.0] — 2026-08-24
728
+
729
+ **Storefront keys.** A game that ships on more than one storefront now gets one SDK
730
+ key per storefront -- `steam`, `ios`, `android`, `web`, `console` -- all valid at the
731
+ same time, and the key determines the payment rail. Construct one client per key and
732
+ use whichever matches where the player is buying. **Additive: no behavior changes, no
733
+ API removals.** A single existing key keeps working exactly as it does today, `rail`
734
+ included, with no deadline and no migration.
735
+
736
+ Three new typed error predicates for refusals this SDK previously surfaced only as a
737
+ raw `code` string:
738
+
739
+ - `InvoError.isRailChannelMismatch` -- the `rail` you sent disagrees with the storefront key
740
+ you authenticated with (400). The fix is to stop sending `rail`; the key already
741
+ determines it. INVO refuses rather than silently overriding, because overriding
742
+ would bill a player through a route you did not ask for.
743
+ - `InvoError.isSteamRailNotEntitled` -- a Steam purchase was attempted for a title INVO has
744
+ not registered as distributed on Steam (403). Holding a `steam` storefront key does
745
+ not by itself register the title.
746
+ - `InvoError.isSteamPurchaseLayerRequired` -- a title distributed on Steam tried to sell currency
747
+ on a non-Steam rail (409). Use the dedicated Steam purchase flow.
748
+
749
+ Also in this release: the 3-D Secure completion method's documentation no longer names
750
+ a payment processor. INVO does not name processors in developer-facing surfaces, and
751
+ this line had been an exception to that for some time.
752
+
753
+ Also in 3.2.0: **provider-neutral error codes.** INVO stamps a neutral alias
754
+ (`error_code_public`) beside any machine code that carries a payment
755
+ processor's name. This SDK previously read only the raw code, so a partner
756
+ branching on `err.code` had to hard-code a vendor name INVO's own public
757
+ documentation is not allowed to print. `err.code` is now the neutral alias when
758
+ one exists (`STRIPE_ERROR` becomes `PROCESSOR_ERROR`), and the literal wire value stays reachable on
759
+ `err.rawCode` for anyone already matching it. Refund reads prefer
760
+ `processor_refund_reference` over the vendor-named field, with a fallback.
761
+
762
+ **Storefront keys are still server-side keys.** A storefront key names where the
763
+ _purchase_ came from, not where the key lives. It belongs in your backend exactly like
764
+ your original key -- never in a game client, an app bundle, or browser code.
765
+
766
+ ## [3.1.0] — 2026-08-04
767
+
768
+ **Passkeys are the gold standard; the SMS-PIN path is deprecated.** This release makes INVO's
769
+ authentication guidance explicit in the two places developers actually look — the README and IDE
770
+ autocomplete. **No behavior changes, no API removals, no runtime warnings.** Upgrading and
771
+ changing nothing produces byte-identical runtime behavior.
772
+
773
+ A passkey is a phishing-resistant, origin-bound WebAuthn assertion. An SMS PIN is a shared secret
774
+ on a channel exposed to SIM swap and interception. They were documented as interchangeable
775
+ verification options; they are not, and the docs said so in a way that produced PIN-first
776
+ integrations.
777
+
778
+ ### Added — error-contract classifiers
779
+
780
+ Three 403s that previously arrived as a generic `InvoError` (correct `status`/`code`/`message`,
781
+ but no typed branch) now have classifiers:
782
+
783
+ - **`err.isSourceGameNotLive`** — the caller's OWN game is in testing. Self-serve: switch it to
784
+ Live in the console (Game Settings → Status).
785
+ - **`err.isTargetGameNotLive`** — the DESTINATION game is in testing. Usually another
786
+ developer's game, so the caller **cannot** fix it. **Deliberately distinct** from the source
787
+ case: collapsing them into one "not live" branch yields a "go fix it" CTA that dead-ends half
788
+ the time.
789
+ - **`err.gameStatus`** — the `game_status` field from either refusal (e.g. `"testing"`).
790
+ - **`err.isWebauthnNotEnabledForTenant`** — tenant has no verified WebAuthn RP ID. **This is
791
+ configuration state, not a failure**: fall back to the SMS/in-app path instead of surfacing an
792
+ error. Currently the common case — 4/23 sandbox and **0/3 production** tenants are configured.
793
+
794
+ Note the backend splits field names across these: the `*_GAME_NOT_LIVE` pair uses
795
+ `error_code`/`message`, while `WEBAUTHN_NOT_ENABLED_FOR_TENANT` uses `code`/`error`. The SDK
796
+ already read both, so `err.code` is populated either way — the new tests pin both shapes.
797
+
798
+ ### Clarified — the SDK does not, and did not, collapse non-2xx into transport errors
799
+
800
+ Following a report of a `403` being debugged as a network outage: verified end-to-end that a
801
+ non-2xx always surfaces with its real `status`, `code`, and `message`, and that `status: 0` is
802
+ reserved for a genuine absence of an HTTP response. **No fix was needed in the SDK** — the loss
803
+ happened in an integration-layer catch-all. Added regression tests pinning the behavior, plus a
804
+ README section (**"`.status === 0` means 'no HTTP response' — and nothing else"**) showing the
805
+ anti-pattern and the correct handler, and a note that `409` is a retryable not-ready state
806
+ rather than a failure.
807
+
808
+ ### Deprecated
809
+
810
+ - **`InvoServer.verifySmsTransfer` / `InvoServer.verifySmsSend`** — marked `@deprecated`. They
811
+ still work exactly as before and still hit the same endpoints. A **future major version will
812
+ remove them**; no date is committed yet. Keep them only as a genuine last resort for users who
813
+ cannot enroll a passkey (unsupported device, no platform authenticator) or who decline.
814
+ **Migration:** when `initiateSend`/`initiateTransfer` returns `verificationMethod: "sms"`, read
815
+ it as _"this sender has no passkey"_ — prompt `InvoClient.enrollPasskey()` and then
816
+ `InvoClient.approveSend` / `approveTransfer`, instead of routing to a PIN pad.
817
+
818
+ ### Changed (documentation only)
819
+
820
+ - New README section — **"Passkeys are the gold standard — don't build on SMS"** — with the
821
+ do/don't table, the deprecation notice, and an explicit list of the OTP surfaces that are
822
+ **not** discouraged.
823
+ - `VerificationMethod`, `InitiateResult.verificationMethod` and `SmsVerifyResult` doc comments
824
+ reframed: `"in_app"` and `"sms"` are no longer presented as peer options.
825
+ - "Before you go live" now stresses configuring RP ID / origins _before_ launch, since an
826
+ unconfigured tenant silently drops every sender onto the deprecated path.
827
+ - **New "Prerequisite: passkeys are dark until your tenant verifies a domain" subsection.**
828
+ Recommending passkeys without saying what unlocks them would send developers straight into a
829
+ `403` on their first `enrollPasskey()` call — with 0/3 prod tenants configured, that is
830
+ currently _everyone_. The deprecation carries no removal date for the same reason.
831
+ - Stability section corrected — it still claimed `2.0.0` was the only major, which `3.0.0`
832
+ made false.
833
+ - Design doc: `docs/features/passkey-first-authentication.md`.
834
+
835
+ ### Not affected — still recommended
836
+
837
+ `enrollmentBegin`/`enrollmentVerify`, `recoveryBegin`/`recoveryComplete`, and
838
+ `phoneShareInitiate`/`phoneShareApprove` all involve a one-time code but are the on-ramp _to_ a
839
+ passkey (or phone-ownership consent), not a substitute for one. They are **not** deprecated.
840
+
841
+ ### Upgrade note
842
+
843
+ The only way this release can surface in a pipeline is a lint rule that treats `@deprecated`
844
+ usage as an error (e.g. `deprecation/deprecation` with `--max-warnings 0`). That is a lint-level
845
+ signal, not a build or runtime break, and it is the intended notice.
846
+
847
+ ## [3.0.0] — 2026-07-20
848
+
849
+ **BREAKING — the Platform Commerce card leg moved to INVO's hosted checkout.** The backend now
850
+ hosts the entire card flow (card fields, Apple Pay / Google Pay, billing-address collection,
851
+ 3-D Secure) on its own checkout page, so the browser card-element surface shipped in 2.5.x is
852
+ gone. Card sales are simpler AND safer: server creates → buyer pays on `checkoutUrl` → fulfill
853
+ on the `platform_commerce.purchased` webhook. Note: the card leg is pending final enablement on
854
+ the backend (sandbox payment test) — the balance leg is fully live.
855
+
856
+ ### Migration from 2.5.x (card leg only — balance/status/refund/webhooks unchanged)
857
+
858
+ - `platformCommerce.purchase({ fundingSource: "card" })`: **remove `billingAddress`** (the type
859
+ is gone; the hosted page collects it) and optionally pass `successUrl` / `cancelUrl` /
860
+ `metadata`. The result now carries `checkoutUrl` / `sessionId` / `expiresAt` (unix seconds) /
861
+ `idempotentReplay` — **`clientSecret` no longer exists.**
862
+ - Browser: **`confirmCardPayment` and `mountCardPayment` are removed** (with all card-element
863
+ types and the `commercePublishableKey` config). Replace with a redirect
864
+ (`location.href = checkoutUrl`) or the new optional embed:
865
+ `invo.platformCommerce.mountCheckout(el, checkoutUrl, { onComplete })` — an iframe plus an
866
+ origin-checked listener for the page's `INVO_CHECKOUT_COMPLETE` message.
867
+ - Card duplicates no longer 409: retrying `purchase` with the same `clientRequestId` **replays
868
+ the same checkout session** (`idempotentReplay: true`), so a lost response is recoverable.
869
+
870
+ ### Added
871
+
872
+ - `PlatformPurchaseInput.successUrl/cancelUrl/metadata`; result fields
873
+ `sessionId/checkoutUrl/expiresAt/idempotentReplay`.
874
+ - `InvoClient.platformCommerce.mountCheckout(el, checkoutUrl, opts)` → `{ iframe, destroy() }`.
875
+ - `err.isAboveCardMaximum` (`ABOVE_CARD_MAXIMUM`, card > $999.99) + client-side card USD
876
+ bounds fail-fast ($0.50–$999.99).
877
+ - Card `requires_payment` responses without a `checkout_url` fail closed (`INVALID_RESPONSE`).
878
+
879
+ ### Removed
880
+
881
+ - `confirmCardPayment`, `mountCardPayment`, `commercePublishableKey`, `BillingAddress`, and the
882
+ card-element/processor types + the runtime CDN script loader (no more processor touchpoints
883
+ in this SDK at all).
884
+
885
+ ## [2.5.1] — 2026-07-20
886
+
887
+ Hardening patch from a second, independent post-release audit (correctness vs the backend
888
+ blueprint + security red-team) of the 2.5.0 Platform Commerce feature. No API breaks.
889
+
890
+ ### Fixed
891
+
892
+ - **Card-confirm script loader could hang forever on retry.** After a transient CDN failure
893
+ (or a pre-existing processor `<script>` tag whose events already fired), the next
894
+ `mountCardPayment`/`confirmCardPayment` attached listeners to a dead tag and never settled —
895
+ checkout silently dead until page reload. The loader now removes failed tags and polls
896
+ (bounded, 10s) when a tag pre-exists.
897
+ - **Orphaned card element on submit-lookup failure.** `confirmCardPayment` now destroys the
898
+ mounted Payment Element before rethrowing when the `submit` selector can't be resolved
899
+ (previously a retry stacked a second live card iframe).
900
+ - **Billing-address validation errors no longer echo the submitted values** (cardholder PII
901
+ could otherwise land in logs/Sentry); optional billing fields (`name`/`line2`/`state`) are
902
+ now type-checked.
903
+ - **`playerPhone` on `platformCommerce.purchase` is now E.164-validated** — this endpoint can
904
+ create the player identity, so a national-format phone must never reach the wire.
905
+ - **`err.isInsufficientBalance` now also classifies the zero-balance 400** ("Player has no
906
+ balance in this tenant", which carries only `current_balance`).
907
+ - **Breaker-open 503 keeps its human message** (`err.code === "service_unavailable"`, message
908
+ no longer collapses to the bare token).
909
+ - **Webhook types:** `platform_commerce.refunded` `player_email` is nullable + `identity_id`
910
+ added; (2.5.0 already made card-leg `total_price` optional on `purchased`).
911
+ - **Refund result surfaces `newBalance`** (balance leg) **and `processorRefundId`** (card leg)
912
+ instead of leaving them `raw`-only.
913
+ - Platform-commerce error tests now assert the REAL backend envelopes
914
+ (`{status,error_code,message}` / bare `{message}`), not idealized shapes.
915
+
916
+ ### Docs
917
+
918
+ - Card-leg lost-response caveat on `purchase` (duplicate 409 can strand a `clientSecret`-less
919
+ pending order — reconcile via webhook/`getStatus`, retry with a NEW `clientRequestId`).
920
+ - `confirmCardPayment`: bank-redirect return-leg guidance + remount-after-decline note;
921
+ `CardPaymentResult.raw` log-redaction note.
922
+
923
+ ## [2.5.0] — 2026-07-20
924
+
925
+ **Platform Commerce (ecommerce).** A new flow for **platform** tenants (non-game apps: vertical
926
+ video, creator merch, marketplace) to sell items funded by **INVO balance or a real card**, with
927
+ INVO as merchant of record and full refunds. This is **distinct from item purchase** — that is a
928
+ _game_ tenant spending a player's _existing game currency_ on an _in-game_ item (balance only, no
929
+ card, no refund). Additive; only platform tenants can call it (a game tenant gets `403
930
+ NOT_A_PLATFORM_TENANT`). (Backend handoff: BE-PIP-009 `PLATFORM_COMMERCE_SDK.md`.)
931
+
932
+ - **Server** (`InvoServer.platformCommerce`, mirrored in the Python SDK as
933
+ `server.platform_commerce`):
934
+ - `purchase(input)` — `fundingSource: "balance"` settles synchronously (`status:"success"`);
935
+ `"card"` returns `status:"requires_payment"` + a `clientSecret` and **requires a
936
+ `billingAddress`**. Idempotent on `clientRequestId`.
937
+ - `getStatus(orderId)` — `completed` | `pending_payment` | `refunded`.
938
+ - `refund({ orderId | clientRequestId, reason? })` — INVO retains its fee; a second refund
939
+ throws `409` (`err.isAlreadyRefunded`).
940
+ - **Browser** (`InvoClient.platformCommerce`):
941
+ - `confirmCardPayment(clientSecret, { mount, publishableKey?, returnUrl?, submit? })` — mounts
942
+ the card element and confirms; returns `{ status: "succeeded" | "requires_action" |
943
+ "processing" | "failed" }`. The processor JS is **lazy-loaded from its CDN — no bundled
944
+ dependency**; pass its publishable key (or set `commercePublishableKey` on the client config).
945
+ - `mountCardPayment(clientSecret, opts)` — the primitive: `{ element, confirm(), destroy() }`
946
+ to confirm from your own Pay button.
947
+ - **Webhooks:** new typed `platform_commerce.purchased` / `platform_commerce.refunded` events.
948
+ **Fulfill card orders on `platform_commerce.purchased`, never on the browser confirmation.**
949
+ - **New `InvoError` classifiers:** `isNotPlatformTenant` (403), `isAmountBelowMinimum`,
950
+ `isBelowCardMinimum` (card < $0.50), `isAlreadyRefunded` (409).
951
+ - Docs: README now leads the flow list with an explicit **item purchase vs Platform Commerce**
952
+ contrast; new "Platform Commerce (ecommerce)" section.
953
+
954
+ ## [2.4.1] — 2026-07-10
955
+
956
+ Docs only, no code change — corrects stale README prose that the 2.4.0 publish still carried:
957
+ the status line led with an old version, and the Stability section still cited the `2.0.0`
958
+ `playerPhone` requirement as the standing breaking change (2.2.0 relaxed it back to optional).
959
+ Republished so the package-bundled README is accurate.
960
+
961
+ ## [2.4.0] — 2026-07-10
962
+
963
+ **Steam transfer policy.** Steam-purchased currency is locked to Steam titles; the backend now
964
+ enforces this at transfer/send initiate and annotates destinations. Additive, and inert until a
965
+ title is flagged Steam-distributed. (Design doc: `docs/features/steam-transfer-policy.md`.)
966
+
967
+ - New `InvoError` classifiers on `initiateSend`/`initiateTransfer` 409s:
968
+ `isSteamValueNonTransferable` (with `steamTransferableMax` / `steamOriginAmount` — decimal
969
+ strings) and `isNonSteamValueIntoSteamBlocked`. Surface `err.message` verbatim.
970
+ - New `DestinationGame.acceptsSteamOriginValue` (maps `accepts_steam_origin_value`; `false` when
971
+ omitted) — disable non-Steam destinations for a player holding Steam value so they never hit
972
+ the 409.
973
+
974
+ No breaking changes.
975
+
976
+ ## [2.3.0] — 2026-07-07
977
+
978
+ **Claim-time phone-share approval.** The backend closed a security gap: claiming/collecting a
979
+ phone-routed transfer now authorizes the collecting identity against the receiver phone before
980
+ crediting. So `confirmReceiptSend`/`confirmReceiptTransfer` and `claimTransfer`/`claimCurrency`
981
+ can now return the phone-share `409 PHONE_SHARE_APPROVAL_REQUIRED` (previously only
982
+ registration/mint did). The existing `InvoError.isPhoneShareApprovalRequired` already classifies
983
+ it — no consumer code must change — but:
984
+
985
+ - New **`InvoError.phoneShareLast4`** surfaces the `phone_last4` from the 409 body for the UI
986
+ ("we texted the phone ending 1234").
987
+ - `isPhoneShareApprovalRequired` docs + the `confirmReceipt*`/claim method docs + README now
988
+ spell out the claim-time path: it's **not a failure** — the funds are held and the phone owner
989
+ is texted; show `err.message` verbatim, then **retry the same call** once approved (it succeeds
990
+ idempotently); on denial/expiry the sender is refunded.
991
+
992
+ Additive, no breaking changes; affects all rails' claim paths (transfer, currency send, amazon).
993
+
994
+ ## [2.2.0] — 2026-07-07
995
+
996
+ **Backend reconciliation** — a full audit of the SDK against the live backend surfaced three
997
+ places the SDK didn't match reality. All changes are backward-compatible (relaxing required
998
+ inputs / adding surface); no working call breaks.
999
+
1000
+ - **`mintPlayerToken` no longer requires `playerPhone`.** `/api/sdk/player-token` is a
1001
+ session-token mint for an **existing** player (looked up by email) — not a registration call.
1002
+ It reads only `player_email` and ignores `player_phone`. The 2.0.0 hard E.164 requirement was
1003
+ a bug: it could **block a valid token mint for an existing email-only player**. `playerPhone`
1004
+ is now optional and validated only if provided. Phone stays enforced where it matters — the
1005
+ sender's phone on `initiateSend`/`initiateTransfer`, and at player creation.
1006
+ - **Send by phone alone.** `receiverPlayerEmail` (send) and `targetPlayerEmail` (transfer) are
1007
+ now **optional** — you can send to a recipient's phone; they supply their email at claim
1008
+ (claim still requires it, since that's where the recipient establishes identity).
1009
+ - **`getPlayerBalance` is by email only.** There is no by-`playerId` balance route on the
1010
+ backend, so passing `playerId` threw a confusing 404. It now throws a clear `INVALID_INPUT`
1011
+ pointing you to `InvoClient.getBalance()` (client-side) or `playerEmail` (server-side).
1012
+ - **New `InvoError.isUserVerificationRequired`** for the `WEBAUTHN_UV_REQUIRED` (401) approve
1013
+ failure — re-run the passkey ceremony requiring UV.
1014
+ - Fixed `iterateItemPurchaseHistory` to read the backend's `total_count` pagination key (was
1015
+ `total`; the loop already terminated via the short-page guard, so behavior is unchanged).
1016
+
1017
+ **Migration:** none required. If you were passing `playerPhone` to `mintPlayerToken` it still
1018
+ works; you can now also omit it. Replace any `getPlayerBalance({ playerId })` with an email
1019
+ lookup or `InvoClient.getBalance()`.
1020
+
1021
+ ## [2.1.2] — 2026-07-07
1022
+
1023
+ **Hosted-checkout reconciliation** (the create-session API contract is unchanged; the hosted
1024
+ page was rebuilt). Additive + docs only.
1025
+
1026
+ - `createCheckout` now surfaces `expiresInSeconds` (the `checkout_url` token TTL, e.g. 900) as
1027
+ a first-class field on `CreateCheckoutResult` — previously only on `.raw`.
1028
+ - README: the `platform` rail is described as cards + Apple Pay / Google Pay / Link +
1029
+ international billing (no app-store commission), and the checkout note now says reloading the
1030
+ URL after a completed payment is idempotent (an already-complete success screen), not an
1031
+ error. No API/signature changes.
1032
+
1033
+ ## [2.1.1] — 2026-07-06
1034
+
1035
+ **Security & correctness hardening** from a full audit + red-team of both SDKs. No API changes;
1036
+ upgrade recommended.
1037
+
1038
+ - **Fail closed on HTTP redirects (security).** The transport now sends `redirect:"manual"` and
1039
+ throws `UNEXPECTED_REDIRECT` on any 3xx instead of following it. Previously a redirect from
1040
+ the API host could cause the game-secret header to be re-sent to an unvalidated URL (matches
1041
+ the Python SDK fix, where the leak also covered the player token and an `http://` downgrade).
1042
+ - **`retryAfter` no longer treats a blank `retry_after` as `0`.** An empty/whitespace
1043
+ `retry_after` string used to become `0` (`Number("")===0`) — an immediate, no-backoff retry.
1044
+ It's now correctly `undefined`, in both `InvoError.retryAfter` and the retry layer.
1045
+ - **Whitespace OTP codes rejected client-side.** `recoveryComplete`/`enrollmentVerify` now
1046
+ reject a whitespace-only `code` before the network call, so it can't burn an attempt against
1047
+ the attempt-capped endpoints (parity with the Python SDK).
1048
+ - **Webhook verify uses `crypto.timingSafeEqual`** on the sync path (parity with Python's
1049
+ `hmac.compare_digest`); the runtime-agnostic async/edge path keeps its string compare.
1050
+ - **WebAuthn option mappers fail cleanly.** A malformed `register/begin` body now throws
1051
+ `WEBAUTHN_OPTIONS_MALFORMED` (an `InvoError`) instead of a raw `TypeError`.
1052
+
1053
+ ## [2.1.0] — 2026-07-02
1054
+
1055
+ **Passkey recovery ("lost or replaced my passkey").** Deleting a passkey on the device never
1056
+ tells the server the key is gone, so re-enrollment was dead-ended by the anti-takeover gate
1057
+ (`ENROLLMENT_REQUIRES_PROOF`) with nothing left to prove possession with. The backend shipped
1058
+ a self-serve, possession-proofed recovery flow; this release wires the client side.
1059
+
1060
+ - `InvoClient.recoveryBegin()` — sends a one-time code to the phone/email on file
1061
+ (`{ status: "sent", channels }`); `InvoClient.recoveryComplete(code)` — deactivates the
1062
+ stale server-side passkey and authorizes a fresh enrollment
1063
+ (`{ status: "recovered", deactivatedCount, next }`). Then retry the same `enrollPasskey()`.
1064
+ - New `InvoError` classifiers: `isEnrollmentCodeInvalid`, `isPasskeyRecoveryCooldown`, and
1065
+ `retryAfterAt` (the ISO timestamp on the 403 cooldown — distinct from the numeric
1066
+ `retryAfter` throttle field). Bare `no_channel_on_file` / `rate_limited` error tokens are
1067
+ now promoted to `err.code`.
1068
+ - **24-hour money cooldown surfaced:** a recovery-enrolled passkey logs in and collects
1069
+ funds immediately, but `approveSend`/`approveTransfer` throw 403
1070
+ `PASSKEY_RECOVERY_COOLDOWN` for 24h (SIM-swap protection). Branch on
1071
+ `isPasskeyRecoveryCooldown`, show the pause message with `retryAfterAt`, don't retry-loop.
1072
+ - README: recovery subsection under Passkeys, incl. the password-manager cleanup tip for
1073
+ "there is a problem saving your passkey" (stale orphan entry).
1074
+
1075
+ Additive, no breaking changes. Routes require SDK verification enabled for the tenant
1076
+ (dark 503 otherwise).
1077
+
1078
+ ## [2.0.0] — 2026-07-02
1079
+
1080
+ **BREAKING — `mintPlayerToken` now requires `playerPhone` (E.164).** Requested by the INVO
1081
+ backend after a live incident: a player registered email-only couldn't receive a cross-game
1082
+ transfer (incoming transfers are matched by phone) and never got the account-linking consent
1083
+ SMS (also phone-triggered). The network identity is derived from **email + phone together**,
1084
+ so the phone must be present on the FIRST registration call — attaching it later changes the
1085
+ identity and forces device re-enrollment.
1086
+
1087
+ - `mintPlayerToken({ playerEmail, playerPhone })` — `playerPhone` is required and validated
1088
+ as E.164 (`+15555550100`: leading `+`, country code, digits only) before any network call;
1089
+ the body now posts `player_phone` alongside `player_email`.
1090
+ - **Pending approval is surfaced, not an error to swallow:** minting with a phone that
1091
+ already belongs to another INVO account (same person, new email) throws the existing
1092
+ `isPhoneShareApprovalRequired` 409 — the phone holder got a consent SMS. New
1093
+ `InvoError.phoneShareApprovalId` exposes the `approval_id` from the 409 body for the
1094
+ `phoneShareApprove` OTP fallback. Docs updated to cover the registration path (previously
1095
+ documented for claims only).
1096
+ - README: new "Player registration (email + phone, required)" section; examples updated
1097
+ (`proxy-server.ts` token route now rejects a phoneless actor with a clear 400).
1098
+
1099
+ **Migration:** collect the player's phone in your enrollment UI before the first
1100
+ `mintPlayerToken` call and pass it as `playerPhone` in E.164. Handle the
1101
+ `isPhoneShareApprovalRequired` error as a "pending approval" UI state.
1102
+
1103
+ ## [1.2.1] — 2026-07-01
1104
+
1105
+ **Fix — browser "Illegal invocation".** The SDK invoked its fetch as `this.fetchImpl(...)`,
1106
+ so the browser's native `fetch` ran with the wrong `this` and threw
1107
+ `TypeError: Illegal invocation` — breaking every browser `InvoClient` read
1108
+ (balance/destinations/pending) and the passkey ceremonies when using the default global
1109
+ `fetch` (retries then made it slow on top). The fetch impl is now bound to `globalThis`
1110
+ (harmless for a custom `fetch`). No API change. Node/tests were unaffected, which is why it
1111
+ slipped through — added a `this`-sensitive regression test.
1112
+
1113
+ ## [1.2.0] — 2026-07-01
1114
+
1115
+ Two more server-side capabilities on `InvoServer`.
1116
+
1117
+ - **Phone-share OTP handshake** — `phoneShareInitiate` / `phoneShareApprove` / `phoneShareStatus`
1118
+ resolve a `409 PHONE_SHARE_APPROVAL_REQUIRED`. Unauthenticated (phone-owner-driven — no game
1119
+ secret, no player token), relayed by a partner backend; after approve, re-issue the identical
1120
+ original request (the grant is server-side + auto-consumed). Adds
1121
+ `InvoError.isPhoneShareAlreadyApproved`.
1122
+ - **Server-side `getDestinations`** — game-secret variant of the browser
1123
+ `InvoClient.getDestinations`; pass `{ sourceGameId, direction }` (default `"transfer"`), rows
1124
+ share the same `DestinationGame` shape.
1125
+
1126
+ ## [1.1.0] — 2026-07-01
1127
+
1128
+ Four additive server-side flows on `InvoServer` (the SMS-PIN / claim-code / status /
1129
+ guardian paths partners still need alongside the passkey path).
1130
+
1131
+ - **SMS-PIN completion** — `verifySmsTransfer` / `verifySmsSend` (for `verificationMethod: "sms"`).
1132
+ - **Claim-by-code** — `claimTransfer` / `claimCurrency`, incl. the `needsAccountSelection`
1133
+ multi-account disambiguation (a `200` with `candidates`, not an error).
1134
+ - **Status reads** — `getTransferStatus` / `getSendStatus` (surface `verificationState`).
1135
+ - **Guardian approval-status poll** — `getGuardianApprovalStatus` (poll a hold to `state`).
1136
+ - New typed results (`SmsVerifyResult`, `ClaimResult`, `TransactionStatusResult`,
1137
+ `GuardianApprovalStatusResult`) + `InvoError.isPhoneShareApprovalRequired`.
1138
+
1139
+ ## [1.0.0] — 2026-07-01
1140
+
1141
+ **1.0 — stable.** The public API is now covered by a stability commitment: it follows
1142
+ semver and no breaking change ships without a major bump + migration note. This is a
1143
+ milestone release, **not a breaking change** — code on `0.8.x` continues to work unchanged.
1144
+
1145
+ Also in this release (docs + DX):
1146
+
1147
+ - **Integration modes** documented — **browser-direct** (default) and **behind your proxy**
1148
+ (keep the INVO player token server-side via a custom `baseUrl`/`fetch`; no CORS or
1149
+ security-posture change). Plus a token-bootstrap example and a CORS + RP-ID/origins
1150
+ go-live checklist.
1151
+ - `linkDevice` called out as the lowest-risk first adoption (additive, no refactor).
1152
+
1153
+ ## [0.8.0] — 2026-07-01
1154
+
1155
+ Completes the **discovery layer** for send/transfer UIs.
1156
+
1157
+ - **`InvoClient.getBalance()`** (browser, player-token, `GET /api/sdk/balance`) — the
1158
+ player's balances for the token's game: `balances[]` (`currencyId`, `currencyName`,
1159
+ `currencySymbol`/`currencySymbolUrl` (nullable), `availableBalance`/`reservedBalance`/
1160
+ `totalBalance` as decimal strings) plus `totalValue` / `currencyCount` / `hasFunds`. A
1161
+ player who hasn't transacted here yet returns an empty `balances` array (a `200`, not an
1162
+ error); `404 GAME_NOT_FOUND` throws.
1163
+ - **`InvoServer.getLinkedIdentities({ playerEmail | playerPhone })`** (server-only,
1164
+ game-secret) — a player's linked wallet identities (game-scoped). Provide one identifier
1165
+ (phone wins if both); no in-game match returns `notFound: true` with empty `emails`
1166
+ instead of throwing. **Returns first-party PII — never expose to the browser.**
1167
+
1168
+ ## [0.7.0] — 2026-07-01
1169
+
1170
+ Start of the **discovery layer** for send/transfer UIs.
1171
+
1172
+ - **`InvoClient.getDestinations({ direction })`** — one player-token call
1173
+ (`GET /api/sdk/destinations`) returns every game the player can send/transfer to, with
1174
+ all display metadata **inline** (game name, icon, currency name/symbol, min/max transfer
1175
+ limits) — no per-game lookup. Includes source game/currency info and `transferMode`
1176
+ (`universal`/`linked` + `linkedGameIds`).
1177
+ - _(Coming in 0.7.x: `getBalance` single-game player-token read; `getLinkedIdentities`
1178
+ server-side.)_
1179
+
1180
+ ## [0.6.0] — 2026-07-01
1181
+
1182
+ Three additive browser flows for partner front-ends, built to the live backend contracts.
1183
+
1184
+ - **`InvoClient.getPendingCollect()`** — the player's own pending-to-collect list
1185
+ (player-token `GET /api/sdk/transfers/pending`), PII-free. Each row's `kind`
1186
+ (`identity_gate` → `approve*`, `receiving_confirm` → `confirmReceipt*`) tells you the
1187
+ action; typed fields incl. `held` / `holdReason` / `stepUpRequired`.
1188
+ - **First-enrollment OTP grant** — `enrollmentBegin()` / `enrollmentVerify(code)` for
1189
+ `ENROLLMENT_REQUIRES_AUTHORIZATION` (send OTP to phone+email, verify, then retry the
1190
+ same `enrollPasskey()` — the server grant is auto-consumed). New `InvoError` helpers
1191
+ `isEnrollmentAuthorizationRequired` / `isEnrollmentProofRequired`.
1192
+ - **Typed approve/confirm holds** — `approve*`/`confirmReceipt*` now surface a typed
1193
+ `holdReason` (from `error_code ?? code`) on HTTP 202 holds, plus `risk` /
1194
+ `guardianApproval` / `pollEndpoint` on approve. `RECIPIENT_IDENTITY_PENDING` correctly
1195
+ surfaces on confirm-receipt. Success carries no `holdReason`.
1196
+
1197
+ ## [0.5.0] — 2026-07-01
1198
+
1199
+ Support partner `metadata` end-to-end on the purchase flow (additive, backward-compatible).
1200
+
1201
+ - **`PurchaseCompletedData.metadata?`** — the `purchase.completed` webhook now echoes your
1202
+ metadata back (all rails); `event.data.metadata` is typed.
1203
+ - **`purchaseCurrency`** now accepts and forwards `metadata` (the direct `/purchase-currency`
1204
+ endpoint accepts it too, matching `createCheckout`).
1205
+
1206
+ ## [0.4.2] — 2026-06-30
1207
+
1208
+ Fixes from an independent line-by-line audit against the live backend.
1209
+
1210
+ - **`linkDevice` now works.** `device/link/webauthn/begin` returns a wrapped
1211
+ `{ link_id, options }` body (challenge nested under `options`) and binds the
1212
+ challenge to a server-generated `link_id`. The client now unwraps `options` and
1213
+ echoes the server's `link_id` to `/complete` (it previously threw on an undefined
1214
+ challenge and sent the wrong id).
1215
+ - **`InvoError.code` is now populated for the direct purchase rail + guardian flows.**
1216
+ `errorFromResponse` reads `error_code` (SecureErrorHandler + `/purchase-currency`)
1217
+ in addition to `code`, and promotes known no-code tokens (`flow_paused`,
1218
+ `spending_limit_exceeded`, `receiver_not_enrolled_use_claim_code`) to `.code`. Fixes
1219
+ `isDuplicateRequest` on the direct rail.
1220
+ - **Guardian/minor routing.** The 202 guardian body also carries
1221
+ `verification_method:"sms"`; the SDK now suppresses it (reports
1222
+ `verificationMethod: undefined`) so a guardian-pending minor isn't routed into the
1223
+ SMS-PIN UI. README example reordered to branch on `guardianApproval` first.
1224
+
1225
+ ## [0.4.1] — 2026-06-30
1226
+
1227
+ Docs only — replaced the README's internal-leaking "Deployment prerequisites"
1228
+ (backend flag names, DB columns, gating mechanics) with a partner-facing
1229
+ "Before you go live"; republished so the npm page README is current.
1230
+
1231
+ ## [0.4.0] — 2026-06-30
1232
+
1233
+ Additive release — more server reads, edge-ready webhooks, cancellation, and tooling.
1234
+
1235
+ - **`getInboundPending({ playerEmail | playerPhone })`** — live, unclaimed inbound
1236
+ sends/transfers for a player (the source of truth behind the "you have X to collect"
1237
+ badge; pairs with `transfer.claim_pending`).
1238
+ - **`verifyWebhookAsync`** — Web Crypto variant of `verifyWebhook` that runs on
1239
+ Cloudflare Workers / Deno / Vercel+Netlify Edge / Bun / browsers; and
1240
+ **`createWebhookHandler`** — a zero-dep Fetch-API `(Request) => Promise<Response>`
1241
+ webhook route handler (Next.js App Router, Workers, Deno, Hono, Bun).
1242
+ - **`iterateItemPurchaseHistory`** — async iterator that pages through a player's
1243
+ full item-purchase history.
1244
+ - **Per-call `AbortSignal`** — every method accepts an optional `{ signal }`; an
1245
+ aborted call throws `InvoError` code `ABORTED` and is never retried.
1246
+ - **Tooling**: ESLint (+ lint in CI), changesets release automation, `SECURITY.md`,
1247
+ and `CODEOWNERS`.
1248
+
1249
+ ## [0.3.0] — 2026-06-30
1250
+
1251
+ Additive release — new server capabilities plus transport resilience/observability.
1252
+
1253
+ - **Webhook verification** (`/server`): `verifyWebhook(rawBody, signatureHeader, secret | secrets, opts?)`
1254
+ — constant-time HMAC-SHA256 over `${t}.${rawBody}`, 5-minute replay window,
1255
+ multi-secret rotation; returns a typed `InvoWebhookEvent` discriminated union
1256
+ (`purchase.*`, `item.purchased`, `transfer.*`, `payout.status_changed`, `webhook.test`).
1257
+ Throws `InvoError` (`WEBHOOK_SIGNATURE_INVALID` / `WEBHOOK_TIMESTAMP_EXPIRED` /
1258
+ `WEBHOOK_MALFORMED` / `WEBHOOK_SECRET_MISSING`). Server-only; the browser bundle
1259
+ stays crypto-free. Independently security-audited.
1260
+ - **`getPlayerBalance({ playerEmail | playerId })`** (`/server`): typed `player` / `balances` / `summary`.
1261
+ - **Automatic retries**: network errors/timeouts, `429` (honoring `retry_after`), and
1262
+ `5xx` are retried with exponential backoff + jitter. New config `maxRetries`
1263
+ (default 2, `0` disables) and `retryBaseDelayMs` (default 250).
1264
+ - **Observability hooks**: optional `onRequest` / `onResponse` / `onError` on both
1265
+ entries (best-effort/non-throwing); `InvoError.requestId` carries the backend
1266
+ request id for support/tracing.
1267
+ - **Typed reads**: `confirmPayment` → `ConfirmPaymentResult`; `getOrderDetails` /
1268
+ `getItemOrderDetails` → `OrderDetailsResult`; `getItemPurchaseHistory` →
1269
+ `ItemHistoryResult` (previously untyped `Record`). All keep `raw`.
1270
+ - **Light validation**: `mintPlayerToken` and `createCheckout` require a non-blank
1271
+ `playerEmail` (throws `INVALID_INPUT` before the network call).
1272
+ - **License**: `package.json` `license` is now `SEE LICENSE IN LICENSE` (was
1273
+ `UNLICENSED`); `LICENSE` rewritten as an explicit install-and-use grant for
1274
+ building INVO integrations.
1275
+
1276
+ ## [0.2.1] — 2026-06-30
1277
+
1278
+ Docs only — no code change (republished so the npm page README is current).
1279
+
1280
+ - Rewrote the README into a complete integration/deployment guide: capability
1281
+ overview, architecture, deployment prerequisites, per-flow sections (currency
1282
+ purchase, item purchase, sends, transfers, passkeys), webhooks, errors, and a
1283
+ full API reference for both entries.
1284
+ - Added INVO console onboarding: `https://console.invo.network` (production) and
1285
+ `https://dev.console.invo.network` (testing/sandbox), mapped to their API base URLs.
1286
+
1287
+ ## [0.2.0] — 2026-06-30
1288
+
1289
+ Adds **item purchase** (spend existing game currency on an in-game item, §4.8) — an
1290
+ additive, server-only surface.
1291
+
1292
+ - `InvoServer` (`/server`): `purchaseItem`, `getItemPurchaseHistory`, `getItemOrderDetails`.
1293
+ - Server-side, game-secret auth — no passkey, no real money, no payment rail (it's a
1294
+ balance debit). Grant the item off the `item.purchased` webhook.
1295
+ - Client-side guards: required fields (trim-checked), `itemQuantity` integer `1..1000`,
1296
+ prices `> 0` and `<= 999999.99` (magnitude-safe 2-decimal check), and
1297
+ `totalPrice == unitPrice × itemQuantity (±0.01)` compared in integer cents.
1298
+ - Load-bearing response fields (`transaction_id`, `order_id`) throw `INVALID_RESPONSE`
1299
+ if missing on a 200.
1300
+ - `InvoError` helpers: `isInsufficientBalance` (gated to 400; not the `429` throttle),
1301
+ `isDuplicateRequest` (409), `retryAfter` (numeric or string `retry_after`); all
1302
+ null-safe against non-JSON error bodies.
1303
+ - Independently audited (2 agents) against handoff doc §4.8/§6/§8; contract verified,
1304
+ error-classification edge cases fixed.
1305
+
1306
+ ## [0.1.0] — 2026-06-30
1307
+
1308
+ Initial scaffold.
1309
+
1310
+ - `InvoServer` (`/server`): `mintPlayerToken`, `initiateSend`, `initiateTransfer`,
1311
+ `createCheckout`, `purchaseCurrency`, `confirmPayment`, `getOrderDetails`.
1312
+ - Client-side purchase guards (§4.7): USD amount `0 < x ≤ 999.99`, required
1313
+ `purchaseReference`, and `rail:"steam"` rejected before the network call
1314
+ (`INVALID_INPUT` / `MISSING_PURCHASE_REFERENCE` / `WRONG_RAIL_ENDPOINT`).
1315
+ - `InvoClient` (browser): `enrollPasskey`, `approveSend`/`approveTransfer`,
1316
+ `confirmReceiptSend`/`confirmReceiptTransfer`, and `linkDevice` for the
1317
+ interchangeable-methods flow (§4.6).
1318
+ - Optional `refreshToken` hook: transparently re-mints and retries once on
1319
+ `SDK_TOKEN_EXPIRED` (§11.2).
1320
+ - Shared: typed `InvoError`, isomorphic HTTP client, WebAuthn JSON⇄binary helpers.
1321
+ - Tests: HTTP layer, server request mapping + purchase guards, browser client
1322
+ flows (enroll/approve/link/token-refresh), and WebAuthn serialization.
1323
+ - Contracts extracted + auditor-verified against the INVO backend.
1324
+
1325
+ ### Hardening (independent red-team pass)
1326
+
1327
+ - **Guardian/minor `202` path no longer mismapped to `verificationMethod:"sms"`** —
1328
+ `initiateSend`/`initiateTransfer` now return `verificationMethod: undefined` and a
1329
+ `guardianApproval` block on the guardian path, so callers don't route into the
1330
+ PIN UI by mistake (§4.3).
1331
+ - `usdAmount` validation tightened: rejects non-plain-decimal strings
1332
+ (`"0x10"`, `"1e2"`, whitespace) and >2 decimal places before any network call.
1333
+ - Load-bearing response fields (`token`, `checkout_url`) now throw `INVALID_RESPONSE`
1334
+ instead of silently surfacing as empty strings.
1335
+ - `getOrderDetails` requires at least one of `orderId`/`transactionId`.
1336
+ - Token refresh now re-runs the **whole** passkey ceremony on `SDK_TOKEN_EXPIRED`
1337
+ (never replays a single-use assertion) and single-flights concurrent refreshes.
1338
+ - `baseUrl` must be `https://` (localhost exempt) so the token/secret can't travel
1339
+ in cleartext.
1340
+ - Published tarball excludes sourcemaps (no proprietary source shipped).