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