@invonetwork/web-sdk 3.13.0 → 3.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +56 -11
- package/dist/{chunk-NJIZMM4H.js → chunk-BLY4NUMG.js} +46 -3
- package/dist/index.cjs +35 -0
- package/dist/index.d.cts +2 -17
- package/dist/index.d.ts +2 -17
- package/dist/index.js +3 -2
- package/dist/server.cjs +65 -4
- package/dist/server.d.cts +58 -6
- package/dist/server.d.ts +58 -6
- package/dist/server.js +24 -6
- package/dist/{types-DUo5NAzj.d.cts → types-CD83iV3D.d.cts} +147 -3
- package/dist/{types-DUo5NAzj.d.ts → types-CD83iV3D.d.ts} +147 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.14.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 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.
|
|
8
|
+
|
|
9
|
+
## 3.14.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 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.
|
|
14
|
+
|
|
3
15
|
## 3.13.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
First-party TypeScript SDK for integrating **INVO** into partner **web** platforms (storefronts, web games, dashboards). It wraps INVO's web money flows behind a typed, versioned API — the web analog of the Unity/Unreal plugins.
|
|
4
4
|
|
|
5
|
-
> **Status:** `v3.
|
|
5
|
+
> **Status:** `v3.14.1`, stable, published on npm. The backend it wraps is **live** on sandbox + production. The API is covered by a [stability commitment](#stability): no breaking changes without a major bump. Recent highlights: **3.14.0** adds `credited` / `reasonCode` on `confirmPayment()` and `steamFinalizePurchase()`, Merchant of Record receipt fields, Platform Commerce card refunds in parts, and updates the **[tiers](#tiers)**: subscription card charges are now **4% + $0.30** on Open and **5% + $0.50** on Merchant of Record, international card and currency conversion costs on subscriptions pass through at cost, chargeback handling by tier, and Merchant of Record is applied for from the console; **3.13.0** documents the two **[tiers](#tiers)** (Open by default, Merchant of Record by application), adds **[INVO's card fee on coin purchases](#invos-card-fee-quote-show-acknowledge)** (3.5% + $0.30): `quoteCurrencyPurchase()`, `acknowledgedTotalUsd` on `purchaseCurrency()`, the new `processingFeeUsd` / `feeTakenFrom` / `coinsCredited` / `chargeTotalUsd` fields and `err.isAmountBelowFee` / `err.isQuoteStale`, states the coin refund rule (only unspent coins), and adds **[paid trials](#paid-trials)** on card subscriptions (`trialAmountUsd`, the disclosed trial consent fields, `is_trial` / `expire_cause` on the events, `err.isPaymentMethodRequired` and the `isTrialAmount*` helpers); **3.12.0** removes the SDK's own card maximum (INVO's is a runtime setting, $100,000.00 by default); **3.11.0** adds the **[purchase status read](#did-the-purchase-go-through-the-status-read)**, where `invo.checkout.getPurchaseStatus()` / `waitForPurchase()` (and the standalone `CheckoutClient`) answer what happened to a hosted-checkout purchase in six words, four of them terminal, so a buyer is never shown a page that closes on nothing; stopping is decided by INVO's `terminal` and never re-derived from `status`, `nothingWasCharged()` says when a **Try again** is safe, `createCheckout()` now also returns `sessionToken`, and the subscription fee is corrected to **7% + $0.30** (it is its own rate; item purchases stay at 10/90); **3.10.0** documents **card-only subscriptions** (the card pays the full price every period, the coin wallet never pays; `walletOnly` deprecated; new `failure_code` `wallet_negative`; a renewal's `purchase.completed` is not a purchase) and the **[subscription refund limits](#refunds)**: `subscriptions.refund` can now return a 202 `pending_approval` refund request (`isRefundPendingApproval`), with `warnings`, the processor fee you bear, `subscriptionCanceled` (a full refund cancels), new classifiers (`isRefundsNotEnabled`, `isRefundWindowClosed`, `isRefundRequestPending`, `isRefundRequestRejected`, `isConcurrentRequest`, `isRefundMismatch`) and typed `subscription.refund_requested` / `refund_approved` / `refund_rejected` events, all additive; **3.9.0** adds the **[INVO-hosted card page for subscriptions](#cards-for-subscriptions)**, `invo.cards.createSetupSession`: mint a 10-minute link server-side, send the member to it, read the card back from `cards.list`, with no browser code and no card processor named anywhere (`beginSetup`/`confirmSetup` remain as the processor-bound alternative), plus the `isPlayerNotFound`, `isInvalidPlayerEmail` and `isInvalidInput` classifiers and a fix that makes `includePlayer` reads actually surface `playerEmail`/`playerName`; **3.8.0** adds **[Subscriptions](#subscriptions-recurring-billing)** as a first-class server surface on both rails — `invo.subscriptions.create/get/listForPlayer/cancel/changeAmount/setPaymentMethod/refund/steamInit/steamFinalize`, the off-session card capture (`invo.cards.beginSetup/confirmSetup/list`), the sandbox clock tools (`invo.sandbox.subscriptions.*`, which post to `/subscriptions/<id>/...` **relative to the sandbox base, not under `/api`**, with the new `sandboxClockKey`), typed `data` for all seven `subscription.*` webhook events, and eleven new error classifiers; **3.7.0** makes the **device approval grant a first-class SDK surface** — `beginDeviceApproval`, `pollDeviceApproval`, `confirmDeviceEnrollment` and, the step that actually moves the money, **`approveWithDeviceCode`** (plus the optional `completeDeviceApproval` loop); a grant that is polled to `approved` and left there settles **nothing**, which is the failure this release exists to make impossible, and `TRANSACTION_NOT_PENDING` now comes back as a typed `status: "not_pending"` result with `alreadySettled` rather than a thrown error you would have to string-match; **3.4.0** documents that a Steam title now bills through **its own Steam application** — the studio registers their appid + publisher Web API key and keeps a payment method on file, because Valve pays the studio and INVO settles afterwards (new `isSteamNotConfigured`, `isPartnerBillingNotSetUp`, `isPartnerSettlementUnavailable`, `isSteamAppChanged` error helpers); **3.2.3** corrects the base path and auth header in the Steam snippets (`/api/currency-purchases`, `X-Game-Secret-Key`) — 3.2.2 published both wrong, and copying them returned a 404; **3.2.x** documents **Steam currency purchases on a pack model** — INVO owns the catalogue, you pass a `pack_id` and never a price, and the currency inside a pack varies by country because Steam prices are VAT-inclusive; **3.1.0** makes the authentication guidance explicit — **[passkeys are the gold standard](#passkeys-are-the-gold-standard-dont-build-on-sms)** and the SMS-PIN completion (`verifySmsTransfer`/`verifySmsSend`) is **deprecated and being phased out** (documentation only — no behavior change, no runtime warnings); **3.0.0** moves the Platform Commerce card leg to **INVO's hosted checkout** — the server `purchase()` now returns a `checkoutUrl` and the browser just sends the buyer there (redirect or `mountCheckout` iframe); the 2.5.x card-element surface (`confirmCardPayment`/`mountCardPayment`, `billingAddress`, `commercePublishableKey`) is **removed** — see the [CHANGELOG](CHANGELOG.md) migration note; **2.5.0** added **Platform Commerce** (ecommerce) — a platform tenant selling items funded by balance **or** card, with `invo.platformCommerce.purchase/getStatus/refund` (server) and the `platform_commerce.*` webhooks; **2.4.0** adds Steam transfer-policy handling (`isSteamValueNonTransferable`/`isNonSteamValueIntoSteamBlocked` + `DestinationGame.acceptsSteamOriginValue`); **2.3.0** surfaces the claim-time phone-share `409` on `confirmReceipt*`/`claim*` (+ `err.phoneShareLast4`). Full history in the [CHANGELOG](CHANGELOG.md).
|
|
6
6
|
> Canonical partner reference: **https://docs.invo.network/docs/currency-purchase** and **https://docs.invo.network/docs/game-developer-integration**.
|
|
7
7
|
|
|
8
8
|
## What it does
|
|
@@ -296,10 +296,17 @@ Every INVO developer account is on one of two tiers. The SDK calls are the same
|
|
|
296
296
|
| Who the seller is | **you** | **INVO** |
|
|
297
297
|
| Tax on sales | **you** are responsible for it; INVO collects none | **INVO** calculates, collects and remits it |
|
|
298
298
|
| Card purchase of coins | 3.5% + $0.30 | 5% + $0.30 |
|
|
299
|
-
| Subscriptions |
|
|
299
|
+
| Subscriptions | 4% + $0.30 per card charge | 5% + $0.50 per card charge |
|
|
300
|
+
| Chargebacks | the disputed amount comes out of your share; on subscription charges the dispute fee is passed through too | INVO manages the dispute and pays the dispute fee; the disputed amount comes out of your share and is restored if INVO wins |
|
|
300
301
|
| Item purchases (coins spent on an item) | 10% | 10% |
|
|
301
302
|
|
|
302
|
-
On both tiers every card charge runs on INVO's card rail and INVO pays you out, as today. Merchant of Record is applied for per developer account, not per game, and INVO reviews each application. Full details: https://docs.invo.network/docs/tiers/
|
|
303
|
+
On both tiers every card charge runs on INVO's card rail and INVO pays you out, as today. On subscription card charges made on a card issued outside the United States, or needing a currency conversion, the extra processing cost is passed through to you at INVO's actual cost, reported separately from INVO's fee. On Merchant of Record, if your chargeback rate (disputed card charges divided by successful card charges in a calendar month) goes above 0.75%, dispute fees on your subscription charges pass through to you as on Open and INVO reviews your approval. Merchant of Record is applied for per developer account, not per game, from the Selling & Tax page in your INVO console, and INVO reviews each application. Full details: https://docs.invo.network/docs/tiers/
|
|
304
|
+
|
|
305
|
+
**What the tier changes in what the SDK returns** (all additive):
|
|
306
|
+
|
|
307
|
+
- **`tax_treatment`** on an Open account's card sales reads `"partner_responsible"` (you are the seller; INVO charged no tax). It appears as `breakdown.taxTreatment` on `quoteCurrencyPurchase()` and `tax_treatment` on the `purchase.completed` webhook. Tax amounts stay `"0.00"`. Treat an unknown value as informational.
|
|
308
|
+
- **Receipts (Merchant of Record only).** INVO issues a receipt for every card sale and a refund receipt for every card refund, and emails it to the buyer when the buyer's email is known; the number is always issued (a pending refund's number follows once it settles) and always reaches you. The number and link reach you as `receiptNumber` / `receiptUrl` on `purchaseCurrency()`, `getOrderDetails()` (from `GET /order-details`, which returns `receipt_number` / `receipt_url`), `CheckoutClient.getPurchaseStatus()` (once `credited`), `platformCommerce.getStatus()` and a paid `firstCharge`, and as `receipt_number` / `receipt_url` on the `purchase.completed`, `platform_commerce.purchased` and `subscription.renewed` webhooks. The refund webhooks (`purchase.refunded`, `platform_commerce.refunded`, `subscription.refunded`) carry the refund receipt's. On Open, and on storefront rails, the fields are absent. Anyone with a `receiptUrl` can read the receipt.
|
|
309
|
+
- **Chargeback reserve (Merchant of Record only).** Part of your share of each card-funded sale (Platform Commerce card sales, card subscription charges) is held, by default 10% for 90 days (terms may differ per account), then released automatically. It affects your withdrawable balance, not anything this SDK returns: see https://docs.invo.network/docs/tiers/ for the balance fields.
|
|
303
310
|
|
|
304
311
|
## Currency purchase (real money in)
|
|
305
312
|
|
|
@@ -515,7 +522,8 @@ const init = await server.steamInitPurchase({
|
|
|
515
522
|
|
|
516
523
|
// 4. Finalize: INVO re-checks the authorization with Steam, captures, credits.
|
|
517
524
|
const done = await server.steamFinalizePurchase({ orderId: init.orderId });
|
|
518
|
-
// -> { status: "success", newBalance, alreadyProcessed }
|
|
525
|
+
// -> { status: "success", newBalance, alreadyProcessed, credited }
|
|
526
|
+
// credited === true means the currency is in; see "credited: did the coins arrive?" above.
|
|
519
527
|
```
|
|
520
528
|
|
|
521
529
|
**The price is identical everywhere; the currency inside is not.** Steam prices are
|
|
@@ -584,11 +592,33 @@ const purchase = await server.purchaseCurrency({
|
|
|
584
592
|
// purchase.status:
|
|
585
593
|
// "success" → captured, purchase.newBalance updated
|
|
586
594
|
// "requires_action" → 3-D Secure: run the client action with purchase.clientSecret,
|
|
587
|
-
// then call server.confirmPayment({ paymentIntentId })
|
|
595
|
+
// then call server.confirmPayment({ paymentIntentId }) and read `credited`
|
|
588
596
|
// "pending_payment" → redirect the browser to purchase.paymentUrl (game rail)
|
|
589
597
|
```
|
|
590
598
|
`rail: "steam"` is rejected here (`WRONG_RAIL_ENDPOINT`) — Steam uses its own in-client flow. Reconcile with `server.getOrderDetails({ orderId })`. Most browser integrations should use hosted checkout instead.
|
|
591
599
|
|
|
600
|
+
#### `credited`: did the coins arrive?
|
|
601
|
+
|
|
602
|
+
`confirmPayment()` and `steamFinalizePurchase()` keep `status: "success"` whenever the **payment** succeeded. That alone does not prove the coins were added, so both results carry `credited` and `reasonCode` (backends from 2026-09-24):
|
|
603
|
+
|
|
604
|
+
```ts
|
|
605
|
+
const c = await server.confirmPayment({ paymentIntentId });
|
|
606
|
+
if (c.credited === true) {
|
|
607
|
+
// the coins are in: show "purchase complete"
|
|
608
|
+
} else if (c.credited === false && c.reasonCode?.startsWith("CREDIT_REFUSED_")) {
|
|
609
|
+
// e.g. "CREDIT_REFUSED_MINT_CEILING": the money was taken and no coins were added.
|
|
610
|
+
// INVO is alerted. Do NOT ask the buyer to pay again; show support with the order id.
|
|
611
|
+
} else if (c.credited === false && c.reasonCode) {
|
|
612
|
+
// "REFUNDED" or "CHARGEBACK_LOST": the payment went back to the buyer.
|
|
613
|
+
} else if (c.credited === false) {
|
|
614
|
+
// reasonCode === null: the credit is still being finished. Poll getOrderDetails until "completed".
|
|
615
|
+
} else {
|
|
616
|
+
// credited === undefined: an older backend. Fall back to the order status.
|
|
617
|
+
}
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
Show "purchase complete" only when `credited` is `true`. `alreadyProcessed` is also `true` whenever the call added nothing (a refused credit included), so do not read success from it.
|
|
621
|
+
|
|
592
622
|
### INVO's card fee: quote, show, acknowledge
|
|
593
623
|
|
|
594
624
|
A card purchase of coins carries INVO's card fee: **3.5% + $0.30** of the price on the Open [tier](#tiers), never less than the card cost. The hosted checkout adds it to the total on its own page, so there is nothing to do there. `purchaseCurrency` charges in the same request it is called, so it cannot show the buyer anything first. You choose what happens by what you send:
|
|
@@ -744,6 +774,19 @@ const ref = await server.platformCommerce.refund({ orderId: r.orderId, reason: "
|
|
|
744
774
|
// A second refund of the same order throws 409 (err.isAlreadyRefunded) — treat as already done.
|
|
745
775
|
```
|
|
746
776
|
|
|
777
|
+
**Card sales refunded in parts.** A card refund normally returns the whole charge in one go, and the result is as above. A sale ends up refunded in parts only when part of the charge was already refunded outside INVO's API: the next `refund()` records that existing refund and moves no new money (`ref.adopted === true`, `ref.partialRefund === true`, `ref.refundedTotalUsd`, `ref.chargeTotalUsd`, `ref.remainingUsd`; the order stays `completed`). Every figure is then that refund's own share, and `partialRefund` / `refundedTotalUsd` / `chargeTotalUsd` appear on each part (`partialRefund: false` on the last); on a one-shot full refund none of the parts keys appear; `adopted: true` can still appear if the call recorded an existing full refund.
|
|
778
|
+
|
|
779
|
+
```ts
|
|
780
|
+
// Refund what is left, on purpose:
|
|
781
|
+
await server.platformCommerce.refund({ orderId, refundRemaining: true });
|
|
782
|
+
// Within 120 s of the order's last refund, also confirmAdditionalRefund: true.
|
|
783
|
+
```
|
|
784
|
+
|
|
785
|
+
- `err.isRefundRemainingRequiresConfirmation` (409 `REFUND_REMAINING_REQUIRES_CONFIRMATION`): send `refundRemaining: true`; `refunded_total_usd` / `remaining_usd` are on `err.body`. Nothing moved.
|
|
786
|
+
- `err.isRefundRecentlyIssued` (409 `REFUND_RECENTLY_ISSUED`): a refund of this order was applied in the last 120 seconds. Re-read the order; send `confirmAdditionalRefund: true` to refund anyway.
|
|
787
|
+
- `err.isRefundNotCompleted` (502 `REFUND_NOT_COMPLETED`): the card refund failed, was canceled or still needs an action. Nothing was recorded; retry (a refund that was in fact created is recorded on the retry, never issued twice).
|
|
788
|
+
- `platform_commerce.refunded` for a sale refunded in parts also carries `partial_refund`, `refunded_total_usd` and `charge_total_usd` (`refunded_amount` is that refund's own amount); a one-shot full refund sends none of them.
|
|
789
|
+
|
|
747
790
|
- **Idempotency on `clientRequestId`:** a duplicate BALANCE purchase throws `409` (`err.isDuplicateRequest`); a duplicate CARD purchase **replays the same checkout session** (`r.idempotentReplay === true`, same URL — never a second charge), so a lost card-leg response is safely recovered by retrying with the *same* `clientRequestId`.
|
|
748
791
|
- INVO fee: **3.5% flat** (balance) · **3.5% + $0.30** (card). Too-small amounts throw `err.isAmountBelowMinimum` / `err.isBelowCardMinimum` (card < $0.50); a card total over INVO's maximum single card charge comes back as `err.isAboveCardMaximum` (400) with the live figure in `err.message`.
|
|
749
792
|
- Client-side validation (missing fields, bad funding source, quantity outside `1..1000`, total ≠ unit×qty, card total under $0.50, non-E.164 `playerPhone`) throws **before** any network call. The card **maximum** is deliberately not among them: see [The card maximum is INVO's, not the SDK's](#the-card-maximum-is-invos-not-the-sdks).
|
|
@@ -762,7 +805,7 @@ A subscription is a standing agreement, created by **your server**, under which
|
|
|
762
805
|
|
|
763
806
|
Each period INVO works out what the period is worth in coins (card: price × the currency's coins-per-USD rate, 10 per USD by default; Steam: what the price buys through Steam for the member's country) and splits it between INVO's platform fee and your revenue. Every figure is reported on the `subscription.renewed` event.
|
|
764
807
|
|
|
765
|
-
- **Card rail: card only (since 2026-09-17).** The card is charged the full price every period, whatever the member's coin wallet holds. The coins that charge buys are minted and spent in the same step, so **the wallet never pays for a card subscription and never moves**. There is no shortfall, no rounding and no minimum top-up. INVO's fee is
|
|
808
|
+
- **Card rail: card only (since 2026-09-17).** The card is charged the full price every period, whatever the member's coin wallet holds. The coins that charge buys are minted and spent in the same step, so **the wallet never pays for a card subscription and never moves**. There is no shortfall, no rounding and no minimum top-up. INVO's fee is 4% plus $0.30 on Open (5% plus $0.50 on Merchant of Record), on the full price ($9.99 pays INVO $0.70 and you $9.29 on Open). Subscriptions are their own rate: item purchases stay at 10/90.
|
|
766
809
|
- **Steam rail: unchanged.** INVO spends the member's wallet first and tops up from Steam for the shortfall only.
|
|
767
810
|
- **Save a card before `subscriptions.create`.** A member with coins but no saved card is still subscribed (the create succeeds), but the first charge fails with `failureCode: "no_payment_method"` and the subscription enters dunning. Coins never pay it. A [paid trial](#paid-trials) is stricter: without a usable saved card it is refused (`400 PAYMENT_METHOD_REQUIRED`) and nothing is created.
|
|
768
811
|
- **`walletOnly` is deprecated.** It is still accepted and returned, but a `walletOnly: true` card subscription never charges a card and so can never be paid: every charge fails with `failure_code: "wallet_only"` and it lapses to `expired`. Do not send it on new integrations.
|
|
@@ -2087,6 +2130,8 @@ export const POST = createWebhookHandler({
|
|
|
2087
2130
|
| `subscription.refund_requested` / `subscription.refund_approved` / `subscription.refund_rejected` | a refund over the game's daily self-serve limit became a request / INVO approved it (sent together with `subscription.refunded`, and `subscription.canceled` on a full refund, in any order) / INVO rejected it | track the request (`request_id, status, subscription_id, item_id, period_seq, client_request_id, amount_usd, reason, requested_at, daily_cap_usd, executed_today_usd, player_email, identity_id, metadata`; approved adds `decided_at, transaction_id`; rejected adds `decided_at, decision_reason`) |
|
|
2088
2131
|
| `transfer.received` / `transfer.claim_expired` / `transfer.refunded` | sends & transfers | reconcile claim state — credited to the recipient (by any claim path, the hosted claim page included) / not collected within 24h / returned to the sender |
|
|
2089
2132
|
|
|
2133
|
+
On a Merchant of Record account, `purchase.completed`, `platform_commerce.purchased` and `subscription.renewed` for a card sale also carry `receipt_number` and `receipt_url` (the receipt INVO issued to the buyer), and `purchase.refunded`, `platform_commerce.refunded` and `subscription.refunded` carry the refund receipt's. Absent on Open. `purchase.completed` also carries `tax_treatment` (`"partner_responsible"` on Open).
|
|
2134
|
+
|
|
2090
2135
|
Don't block waiting on `purchase.failed` for the `game`/`steam` rails — they only emit `completed`/`refunded`. Reconcile off `*.completed` + the status endpoints. For Platform Commerce **card** orders, fulfill on `platform_commerce.purchased`, not the browser confirmation.
|
|
2091
2136
|
|
|
2092
2137
|
---
|
|
@@ -2208,15 +2253,15 @@ try {
|
|
|
2208
2253
|
| `initiateTransfer(input)` | `{ transactionId, verificationMethod, guardianApproval?, raw }` |
|
|
2209
2254
|
| `createCheckout(input)` | `{ sessionId, checkoutUrl, sessionToken?, expiresAt, expiresInSeconds, raw }`, where `sessionToken` is INVO's own `session_token` field (falling back to the `checkoutUrl` query string on a backend that predates it) and is the credential for the [status read](#did-the-purchase-go-through-the-status-read) |
|
|
2210
2255
|
| `quoteCurrencyPurchase({ playerEmail, usdAmount, country?, subdivision? })` | `CurrencyPurchaseQuote`: `{ totalUsd, amountCents, subtotalUsd, processingFeeUsd, coins, currencyName, breakdown, ifUnacknowledged, raw }`; moves no money; send `totalUsd` back as `acknowledgedTotalUsd` (see [INVO's card fee](#invos-card-fee-quote-show-acknowledge)) |
|
|
2211
|
-
| `purchaseCurrency(input)` | `{ status, clientSecret?, paymentIntentId?, paymentUrl?, transactionId?, orderId?, newBalance?, processingFeeUsd?, feeTakenFrom?, coinsCredited?, chargeTotalUsd?, raw }`; optional `acknowledgedTotalUsd` input |
|
|
2212
|
-
| `confirmPayment({ paymentIntentId, orderId? })` | `{ status, transactionId?, newBalance?, raw }` |
|
|
2213
|
-
| `getOrderDetails({ orderId? \| transactionId? })` | `{ order, financialSummary, statusTimeline, raw }
|
|
2256
|
+
| `purchaseCurrency(input)` | `{ status, clientSecret?, paymentIntentId?, paymentUrl?, transactionId?, orderId?, newBalance?, processingFeeUsd?, feeTakenFrom?, coinsCredited?, chargeTotalUsd?, receiptNumber?, receiptUrl?, raw }`; optional `acknowledgedTotalUsd` input; `receiptNumber` / `receiptUrl` on Merchant of Record only |
|
|
2257
|
+
| `confirmPayment({ paymentIntentId, orderId? })` | `{ status, transactionId?, newBalance?, credited?, reasonCode?, raw }`; report success only on `credited: true` |
|
|
2258
|
+
| `getOrderDetails({ orderId? \| transactionId? })` | `{ order, financialSummary, statusTimeline, receiptNumber?, receiptUrl?, raw }`; the receipt fields on a Merchant of Record currency purchase only |
|
|
2214
2259
|
| `purchaseItem(input)` | `{ status, transactionId, orderId, newBalance, previousBalance, currencyName, financialBreakdown?, raw }` — **game** tenant spending game currency on an in-game item |
|
|
2215
2260
|
| `getItemPurchaseHistory({ playerEmail, limit?, offset? })` | `{ history, pagination, raw }` |
|
|
2216
2261
|
| `getItemOrderDetails({ orderId? \| transactionId? \| clientRequestId? })` | `{ order, financialSummary, statusTimeline, raw }` |
|
|
2217
2262
|
| `platformCommerce.purchase(input)` | `{ status, fundingSource, orderId?, transactionId?, newBalance?, financialBreakdown?, sessionId?, checkoutUrl?, expiresAt?, amountUsd?, idempotentReplay?, raw }` — **ecommerce** (platform tenant); `balance` settles now, `card` returns a hosted-checkout `checkoutUrl` |
|
|
2218
|
-
| `platformCommerce.getStatus(orderId)` | `{ orderId, status, gameCurrencyAmount?, usdAmount?, paymentMethod?, createdAt?, raw }` |
|
|
2219
|
-
| `platformCommerce.refund({ orderId? \| clientRequestId?, reason? })` | `{ status, orderId?, fundingSource?, refundedAmount?, amountUnit?, feeRetained?, raw }
|
|
2263
|
+
| `platformCommerce.getStatus(orderId)` | `{ orderId, status, gameCurrencyAmount?, usdAmount?, paymentMethod?, createdAt?, receiptNumber?, receiptUrl?, raw }` |
|
|
2264
|
+
| `platformCommerce.refund({ orderId? \| clientRequestId?, reason?, refundRemaining?, confirmAdditionalRefund? })` | `{ status, orderId?, fundingSource?, refundedAmount?, amountUnit?, feeRetained?, partialRefund?, adopted?, refundedTotalUsd?, chargeTotalUsd?, remainingUsd?, raw }`; pass **exactly one** id; INVO keeps its fee; `partialRefund`, `refundedTotalUsd`, `chargeTotalUsd`, `remainingUsd` only on a card sale refunded in parts; `adopted` whenever the call recorded an existing refund (a full one included) |
|
|
2220
2265
|
| `subscriptions.create(input)` | `SubscriptionResult` — `{ status, idempotentReplay, subscription, card, firstCharge, warning?, raw }`; **card rail**, charges the first period before answering; branch on `firstCharge.status` (`paid` \| `requires_action` \| `skipped_trial` \| `failed` \| `pending`); `trialAmountUsd` makes a [paid trial](#paid-trials); idempotent on `clientRequestId` (a repeat is `idempotentReplay: true`, never thrown) |
|
|
2221
2266
|
| `subscriptions.get(id, { includePlayer? })` | `{ subscription, player?, raw }`: `subscription.paidThrough` is the entitlement boundary; `currentPeriodEnd` is only the billing window; `includePlayer: true` adds `subscription.playerEmail` / `subscription.playerName` (INVO puts them on the object; `player` is derived from them) |
|
|
2222
2267
|
| `subscriptions.listForPlayer(playerEmail, { status?, limit?, offset?, includePlayer? })` | `{ playerEmail, subscriptions, pagination: { totalCount, limit, offset, hasMore }, raw }` — newest first; `status: "live"` expands to the four live statuses |
|
|
@@ -415,8 +415,34 @@ var InvoError = class _InvoError extends Error {
|
|
|
415
415
|
* success, not a failure to retry-loop.
|
|
416
416
|
*/
|
|
417
417
|
get isAlreadyRefunded() {
|
|
418
|
+
if (this.isRefundRemainingRequiresConfirmation || this.isRefundRecentlyIssued) return false;
|
|
418
419
|
return this.code === "ALREADY_REFUNDED" || this.status === 409 && /already\s+refunded/i.test(this.message);
|
|
419
420
|
}
|
|
421
|
+
/**
|
|
422
|
+
* Platform Commerce card sale already refunded in part (409
|
|
423
|
+
* `REFUND_REMAINING_REQUIRES_CONFIRMATION`): nothing moved. Retry with
|
|
424
|
+
* `refundRemaining: true` to refund the rest; `refunded_total_usd` and `remaining_usd` are
|
|
425
|
+
* on `err.body`.
|
|
426
|
+
*/
|
|
427
|
+
get isRefundRemainingRequiresConfirmation() {
|
|
428
|
+
return this.code === "REFUND_REMAINING_REQUIRES_CONFIRMATION";
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* A Platform Commerce refund of this order was applied in the last 120 seconds (409
|
|
432
|
+
* `REFUND_RECENTLY_ISSUED`): nothing moved. Re-read the order; send
|
|
433
|
+
* `confirmAdditionalRefund: true` to refund anyway.
|
|
434
|
+
*/
|
|
435
|
+
get isRefundRecentlyIssued() {
|
|
436
|
+
return this.code === "REFUND_RECENTLY_ISSUED";
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* The Platform Commerce card refund failed, was canceled or still needs an action (502
|
|
440
|
+
* `REFUND_NOT_COMPLETED`): nothing was recorded. Retry; a refund that was in fact created
|
|
441
|
+
* is found and recorded on the retry, never issued twice.
|
|
442
|
+
*/
|
|
443
|
+
get isRefundNotCompleted() {
|
|
444
|
+
return this.code === "REFUND_NOT_COMPLETED";
|
|
445
|
+
}
|
|
420
446
|
/**
|
|
421
447
|
* True when an approve / confirm-receipt was refused because the transaction is no
|
|
422
448
|
* longer awaiting that step (`TRANSACTION_NOT_PENDING`, 400). `approveWithDeviceCode`
|
|
@@ -1052,6 +1078,23 @@ function toDestinationsResult(raw, direction) {
|
|
|
1052
1078
|
};
|
|
1053
1079
|
}
|
|
1054
1080
|
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1081
|
+
// src/shared/receipt-fields.ts
|
|
1082
|
+
function creditFields(raw) {
|
|
1083
|
+
const c = raw["credited"];
|
|
1084
|
+
if (c === true) return { credited: true };
|
|
1085
|
+
if (c === false) {
|
|
1086
|
+
const r = raw["reason_code"];
|
|
1087
|
+
return { credited: false, reasonCode: r == null ? null : String(r) };
|
|
1088
|
+
}
|
|
1089
|
+
return {};
|
|
1090
|
+
}
|
|
1091
|
+
function receiptFields(raw) {
|
|
1092
|
+
const n = raw["receipt_number"];
|
|
1093
|
+
if (typeof n !== "string" || n === "") return {};
|
|
1094
|
+
const u = raw["receipt_url"];
|
|
1095
|
+
return typeof u === "string" && u !== "" ? { receiptNumber: n, receiptUrl: u } : { receiptNumber: n };
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
export { Http, InvoError, assertSecureBaseUrl, creditFields, receiptFields, toDestinationsResult };
|
|
1099
|
+
//# sourceMappingURL=chunk-BLY4NUMG.js.map
|
|
1100
|
+
//# sourceMappingURL=chunk-BLY4NUMG.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -417,8 +417,34 @@ var InvoError = class _InvoError extends Error {
|
|
|
417
417
|
* success, not a failure to retry-loop.
|
|
418
418
|
*/
|
|
419
419
|
get isAlreadyRefunded() {
|
|
420
|
+
if (this.isRefundRemainingRequiresConfirmation || this.isRefundRecentlyIssued) return false;
|
|
420
421
|
return this.code === "ALREADY_REFUNDED" || this.status === 409 && /already\s+refunded/i.test(this.message);
|
|
421
422
|
}
|
|
423
|
+
/**
|
|
424
|
+
* Platform Commerce card sale already refunded in part (409
|
|
425
|
+
* `REFUND_REMAINING_REQUIRES_CONFIRMATION`): nothing moved. Retry with
|
|
426
|
+
* `refundRemaining: true` to refund the rest; `refunded_total_usd` and `remaining_usd` are
|
|
427
|
+
* on `err.body`.
|
|
428
|
+
*/
|
|
429
|
+
get isRefundRemainingRequiresConfirmation() {
|
|
430
|
+
return this.code === "REFUND_REMAINING_REQUIRES_CONFIRMATION";
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* A Platform Commerce refund of this order was applied in the last 120 seconds (409
|
|
434
|
+
* `REFUND_RECENTLY_ISSUED`): nothing moved. Re-read the order; send
|
|
435
|
+
* `confirmAdditionalRefund: true` to refund anyway.
|
|
436
|
+
*/
|
|
437
|
+
get isRefundRecentlyIssued() {
|
|
438
|
+
return this.code === "REFUND_RECENTLY_ISSUED";
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* The Platform Commerce card refund failed, was canceled or still needs an action (502
|
|
442
|
+
* `REFUND_NOT_COMPLETED`): nothing was recorded. Retry; a refund that was in fact created
|
|
443
|
+
* is found and recorded on the retry, never issued twice.
|
|
444
|
+
*/
|
|
445
|
+
get isRefundNotCompleted() {
|
|
446
|
+
return this.code === "REFUND_NOT_COMPLETED";
|
|
447
|
+
}
|
|
422
448
|
/**
|
|
423
449
|
* True when an approve / confirm-receipt was refused because the transaction is no
|
|
424
450
|
* longer awaiting that step (`TRANSACTION_NOT_PENDING`, 400). `approveWithDeviceCode`
|
|
@@ -1738,6 +1764,14 @@ async function runHostedApproval(opts, api, deps = {}) {
|
|
|
1738
1764
|
});
|
|
1739
1765
|
}
|
|
1740
1766
|
|
|
1767
|
+
// src/shared/receipt-fields.ts
|
|
1768
|
+
function receiptFields(raw) {
|
|
1769
|
+
const n = raw["receipt_number"];
|
|
1770
|
+
if (typeof n !== "string" || n === "") return {};
|
|
1771
|
+
const u = raw["receipt_url"];
|
|
1772
|
+
return typeof u === "string" && u !== "" ? { receiptNumber: n, receiptUrl: u } : { receiptNumber: n };
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1741
1775
|
// src/shared/purchase-status.ts
|
|
1742
1776
|
function str(v) {
|
|
1743
1777
|
return typeof v === "string" ? v : v === null || v === void 0 ? null : String(v);
|
|
@@ -1759,6 +1793,7 @@ function toPurchaseStatusResult(raw, sessionId) {
|
|
|
1759
1793
|
amountChargedUsd: str(raw["amount_charged_usd"]),
|
|
1760
1794
|
listedUsd: str(raw["listed_usd"]),
|
|
1761
1795
|
currencyName: str(raw["currency_name"]),
|
|
1796
|
+
...receiptFields(raw),
|
|
1762
1797
|
raw
|
|
1763
1798
|
};
|
|
1764
1799
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as ApproveResult, C as ConfirmReceiptResult, P as PurchaseStatusResult, a as PurchaseCredited, b as PurchaseExpired, c as PurchaseRefunded, d as PurchaseRefused, e as CheckoutClientConfig, H as Http, f as PurchaseStatusInput, g as CallOptions, W as WaitForPurchaseInput, M as MountCheckoutOptions, h as CheckoutMountHandle, i as ClientConfig, L as LinkDeviceResult, j as PendingCollectResult, D as DestinationsQuery, k as DestinationsResult, B as BalanceResult, E as EnrollmentBeginResult, l as EnrollmentVerifyResult, R as RecoveryBeginResult, m as RecoveryCompleteResult } from './types-
|
|
2
|
-
export { n as BalanceRow, o as CheckoutPurchaseStatus, p as DestinationGame, I as InvoError, q as InvoErrorInfo, r as InvoHooks, s as InvoRequestInfo, t as InvoResponseInfo, u as PendingCollectItem, v as PurchaseRefusalReason, w as Rail, V as VerificationMethod } from './types-
|
|
1
|
+
import { A as ApproveResult, C as ConfirmReceiptResult, P as PurchaseStatusResult, a as PurchaseCredited, b as PurchaseExpired, c as PurchaseRefunded, d as PurchaseRefused, e as CheckoutClientConfig, H as Http, f as PurchaseStatusInput, g as CallOptions, W as WaitForPurchaseInput, M as MountCheckoutOptions, h as CheckoutMountHandle, i as ClientConfig, L as LinkDeviceResult, j as PendingCollectResult, D as DestinationsQuery, k as DestinationsResult, B as BalanceResult, E as EnrollmentBeginResult, l as EnrollmentVerifyResult, R as RecoveryBeginResult, m as RecoveryCompleteResult } from './types-CD83iV3D.cjs';
|
|
2
|
+
export { n as BalanceRow, o as CheckoutPurchaseStatus, p as DestinationGame, I as InvoError, q as InvoErrorInfo, r as InvoHooks, s as InvoRequestInfo, t as InvoResponseInfo, u as PendingCollectItem, v as PurchaseRefusalReason, w as Rail, V as VerificationMethod } from './types-CD83iV3D.cjs';
|
|
3
3
|
|
|
4
4
|
/** The four device-approval flows (`begin.flow`). */
|
|
5
5
|
type HostedFlow = "transfer" | "send" | "send_receipt" | "transfer_receipt";
|
|
@@ -94,21 +94,6 @@ interface ApproveHostedOptions {
|
|
|
94
94
|
signal?: AbortSignal;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
/**
|
|
98
|
-
* The purchase status read: mapping and the guards that go with it.
|
|
99
|
-
*
|
|
100
|
-
* WHY THE ENDPOINT EXISTS. A hosted checkout used to be able to charge a buyer in full,
|
|
101
|
-
* refuse the credit, answer `200` on every route, and close the page on nothing: no coins,
|
|
102
|
-
* no error, no receipt. `GET /api/checkout/sessions/<id>` is INVO's fix for that silence.
|
|
103
|
-
* It always has something true to say, including the case where INVO has the buyer's money
|
|
104
|
-
* and the buyer does not have their coins.
|
|
105
|
-
*
|
|
106
|
-
* ONE RULE RUNS THROUGH THIS FILE: `terminal` is INVO's answer, never ours. It is read
|
|
107
|
-
* straight off the response and never recomputed from `status`, so a status a future
|
|
108
|
-
* backend introduces cannot make a build pinned to this release decide a purchase
|
|
109
|
-
* finished, or finished WELL, on its own.
|
|
110
|
-
*/
|
|
111
|
-
|
|
112
97
|
/**
|
|
113
98
|
* The purchase was charged and the coins are in the balance. Show `coinsCredited`,
|
|
114
99
|
* `currencyName` and `newBalance` when it is not null, and close on the buyer's action
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as ApproveResult, C as ConfirmReceiptResult, P as PurchaseStatusResult, a as PurchaseCredited, b as PurchaseExpired, c as PurchaseRefunded, d as PurchaseRefused, e as CheckoutClientConfig, H as Http, f as PurchaseStatusInput, g as CallOptions, W as WaitForPurchaseInput, M as MountCheckoutOptions, h as CheckoutMountHandle, i as ClientConfig, L as LinkDeviceResult, j as PendingCollectResult, D as DestinationsQuery, k as DestinationsResult, B as BalanceResult, E as EnrollmentBeginResult, l as EnrollmentVerifyResult, R as RecoveryBeginResult, m as RecoveryCompleteResult } from './types-
|
|
2
|
-
export { n as BalanceRow, o as CheckoutPurchaseStatus, p as DestinationGame, I as InvoError, q as InvoErrorInfo, r as InvoHooks, s as InvoRequestInfo, t as InvoResponseInfo, u as PendingCollectItem, v as PurchaseRefusalReason, w as Rail, V as VerificationMethod } from './types-
|
|
1
|
+
import { A as ApproveResult, C as ConfirmReceiptResult, P as PurchaseStatusResult, a as PurchaseCredited, b as PurchaseExpired, c as PurchaseRefunded, d as PurchaseRefused, e as CheckoutClientConfig, H as Http, f as PurchaseStatusInput, g as CallOptions, W as WaitForPurchaseInput, M as MountCheckoutOptions, h as CheckoutMountHandle, i as ClientConfig, L as LinkDeviceResult, j as PendingCollectResult, D as DestinationsQuery, k as DestinationsResult, B as BalanceResult, E as EnrollmentBeginResult, l as EnrollmentVerifyResult, R as RecoveryBeginResult, m as RecoveryCompleteResult } from './types-CD83iV3D.js';
|
|
2
|
+
export { n as BalanceRow, o as CheckoutPurchaseStatus, p as DestinationGame, I as InvoError, q as InvoErrorInfo, r as InvoHooks, s as InvoRequestInfo, t as InvoResponseInfo, u as PendingCollectItem, v as PurchaseRefusalReason, w as Rail, V as VerificationMethod } from './types-CD83iV3D.js';
|
|
3
3
|
|
|
4
4
|
/** The four device-approval flows (`begin.flow`). */
|
|
5
5
|
type HostedFlow = "transfer" | "send" | "send_receipt" | "transfer_receipt";
|
|
@@ -94,21 +94,6 @@ interface ApproveHostedOptions {
|
|
|
94
94
|
signal?: AbortSignal;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
/**
|
|
98
|
-
* The purchase status read: mapping and the guards that go with it.
|
|
99
|
-
*
|
|
100
|
-
* WHY THE ENDPOINT EXISTS. A hosted checkout used to be able to charge a buyer in full,
|
|
101
|
-
* refuse the credit, answer `200` on every route, and close the page on nothing: no coins,
|
|
102
|
-
* no error, no receipt. `GET /api/checkout/sessions/<id>` is INVO's fix for that silence.
|
|
103
|
-
* It always has something true to say, including the case where INVO has the buyer's money
|
|
104
|
-
* and the buyer does not have their coins.
|
|
105
|
-
*
|
|
106
|
-
* ONE RULE RUNS THROUGH THIS FILE: `terminal` is INVO's answer, never ours. It is read
|
|
107
|
-
* straight off the response and never recomputed from `status`, so a status a future
|
|
108
|
-
* backend introduces cannot make a build pinned to this release decide a purchase
|
|
109
|
-
* finished, or finished WELL, on its own.
|
|
110
|
-
*/
|
|
111
|
-
|
|
112
97
|
/**
|
|
113
98
|
* The purchase was charged and the coins are in the balance. Show `coinsCredited`,
|
|
114
99
|
* `currencyName` and `newBalance` when it is not null, and close on the buyer's action
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InvoError, assertSecureBaseUrl, Http, toDestinationsResult } from './chunk-
|
|
2
|
-
export { InvoError } from './chunk-
|
|
1
|
+
import { InvoError, assertSecureBaseUrl, Http, toDestinationsResult, receiptFields } from './chunk-BLY4NUMG.js';
|
|
2
|
+
export { InvoError } from './chunk-BLY4NUMG.js';
|
|
3
3
|
|
|
4
4
|
// src/shared/webauthn.ts
|
|
5
5
|
function malformedOptions(field) {
|
|
@@ -706,6 +706,7 @@ function toPurchaseStatusResult(raw, sessionId) {
|
|
|
706
706
|
amountChargedUsd: str(raw["amount_charged_usd"]),
|
|
707
707
|
listedUsd: str(raw["listed_usd"]),
|
|
708
708
|
currencyName: str(raw["currency_name"]),
|
|
709
|
+
...receiptFields(raw),
|
|
709
710
|
raw
|
|
710
711
|
};
|
|
711
712
|
}
|
package/dist/server.cjs
CHANGED
|
@@ -419,8 +419,34 @@ var InvoError = class _InvoError extends Error {
|
|
|
419
419
|
* success, not a failure to retry-loop.
|
|
420
420
|
*/
|
|
421
421
|
get isAlreadyRefunded() {
|
|
422
|
+
if (this.isRefundRemainingRequiresConfirmation || this.isRefundRecentlyIssued) return false;
|
|
422
423
|
return this.code === "ALREADY_REFUNDED" || this.status === 409 && /already\s+refunded/i.test(this.message);
|
|
423
424
|
}
|
|
425
|
+
/**
|
|
426
|
+
* Platform Commerce card sale already refunded in part (409
|
|
427
|
+
* `REFUND_REMAINING_REQUIRES_CONFIRMATION`): nothing moved. Retry with
|
|
428
|
+
* `refundRemaining: true` to refund the rest; `refunded_total_usd` and `remaining_usd` are
|
|
429
|
+
* on `err.body`.
|
|
430
|
+
*/
|
|
431
|
+
get isRefundRemainingRequiresConfirmation() {
|
|
432
|
+
return this.code === "REFUND_REMAINING_REQUIRES_CONFIRMATION";
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* A Platform Commerce refund of this order was applied in the last 120 seconds (409
|
|
436
|
+
* `REFUND_RECENTLY_ISSUED`): nothing moved. Re-read the order; send
|
|
437
|
+
* `confirmAdditionalRefund: true` to refund anyway.
|
|
438
|
+
*/
|
|
439
|
+
get isRefundRecentlyIssued() {
|
|
440
|
+
return this.code === "REFUND_RECENTLY_ISSUED";
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* The Platform Commerce card refund failed, was canceled or still needs an action (502
|
|
444
|
+
* `REFUND_NOT_COMPLETED`): nothing was recorded. Retry; a refund that was in fact created
|
|
445
|
+
* is found and recorded on the retry, never issued twice.
|
|
446
|
+
*/
|
|
447
|
+
get isRefundNotCompleted() {
|
|
448
|
+
return this.code === "REFUND_NOT_COMPLETED";
|
|
449
|
+
}
|
|
424
450
|
/**
|
|
425
451
|
* True when an approve / confirm-receipt was refused because the transaction is no
|
|
426
452
|
* longer awaiting that step (`TRANSACTION_NOT_PENDING`, 400). `approveWithDeviceCode`
|
|
@@ -1056,8 +1082,25 @@ function toDestinationsResult(raw, direction) {
|
|
|
1056
1082
|
};
|
|
1057
1083
|
}
|
|
1058
1084
|
|
|
1085
|
+
// src/shared/receipt-fields.ts
|
|
1086
|
+
function creditFields(raw) {
|
|
1087
|
+
const c = raw["credited"];
|
|
1088
|
+
if (c === true) return { credited: true };
|
|
1089
|
+
if (c === false) {
|
|
1090
|
+
const r = raw["reason_code"];
|
|
1091
|
+
return { credited: false, reasonCode: r == null ? null : String(r) };
|
|
1092
|
+
}
|
|
1093
|
+
return {};
|
|
1094
|
+
}
|
|
1095
|
+
function receiptFields(raw) {
|
|
1096
|
+
const n = raw["receipt_number"];
|
|
1097
|
+
if (typeof n !== "string" || n === "") return {};
|
|
1098
|
+
const u = raw["receipt_url"];
|
|
1099
|
+
return typeof u === "string" && u !== "" ? { receiptNumber: n, receiptUrl: u } : { receiptNumber: n };
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1059
1102
|
// src/version.ts
|
|
1060
|
-
var SDK_VERSION = "3.
|
|
1103
|
+
var SDK_VERSION = "3.14.1";
|
|
1061
1104
|
|
|
1062
1105
|
// src/shared/types.ts
|
|
1063
1106
|
function isRefundPendingApproval(r) {
|
|
@@ -1334,6 +1377,7 @@ function toOrderDetails(raw) {
|
|
|
1334
1377
|
order: raw["order"] ?? {},
|
|
1335
1378
|
financialSummary: raw["financial_summary"] ?? {},
|
|
1336
1379
|
statusTimeline: raw["status_timeline"] ?? null,
|
|
1380
|
+
...receiptFields(raw),
|
|
1337
1381
|
raw
|
|
1338
1382
|
};
|
|
1339
1383
|
}
|
|
@@ -1714,6 +1758,7 @@ var PlatformCommerceServer = class {
|
|
|
1714
1758
|
usdAmount: raw["usd_amount"] ?? null,
|
|
1715
1759
|
paymentMethod: raw["payment_method"],
|
|
1716
1760
|
createdAt: raw["created_at"],
|
|
1761
|
+
...receiptFields(raw),
|
|
1717
1762
|
raw
|
|
1718
1763
|
};
|
|
1719
1764
|
}
|
|
@@ -1737,6 +1782,8 @@ var PlatformCommerceServer = class {
|
|
|
1737
1782
|
if (hasOrder) body["order_id"] = input.orderId;
|
|
1738
1783
|
else body["client_request_id"] = input.clientRequestId;
|
|
1739
1784
|
if (input.reason) body["reason"] = input.reason;
|
|
1785
|
+
if (input.refundRemaining === true) body["refund_remaining"] = true;
|
|
1786
|
+
if (input.confirmAdditionalRefund === true) body["confirm_additional_refund"] = true;
|
|
1740
1787
|
const raw = await this.http.post(
|
|
1741
1788
|
"/api/platform-commerce/refund",
|
|
1742
1789
|
body,
|
|
@@ -1762,6 +1809,12 @@ var PlatformCommerceServer = class {
|
|
|
1762
1809
|
// alongside the vendor-named one for exactly this reason.
|
|
1763
1810
|
processorRefundId: raw["processor_refund_reference"] ?? raw["stripe_refund_id"],
|
|
1764
1811
|
feeRetained: raw["fee_retained"] === true,
|
|
1812
|
+
// Refunds in parts only (absent on a one-shot full refund).
|
|
1813
|
+
...typeof raw["partial_refund"] === "boolean" ? { partialRefund: raw["partial_refund"] } : {},
|
|
1814
|
+
...raw["adopted"] === true ? { adopted: true } : {},
|
|
1815
|
+
...raw["refunded_total_usd"] != null ? { refundedTotalUsd: String(raw["refunded_total_usd"]) } : {},
|
|
1816
|
+
...raw["charge_total_usd"] != null ? { chargeTotalUsd: String(raw["charge_total_usd"]) } : {},
|
|
1817
|
+
...raw["remaining_usd"] != null ? { remainingUsd: String(raw["remaining_usd"]) } : {},
|
|
1765
1818
|
raw
|
|
1766
1819
|
};
|
|
1767
1820
|
}
|
|
@@ -1947,6 +2000,7 @@ function toFirstCharge(row) {
|
|
|
1947
2000
|
confirmationUrl: nullableString(r["confirmation_url"]),
|
|
1948
2001
|
expiresAt: nullableString(r["expires_at"]),
|
|
1949
2002
|
message: nullableString(r["message"]),
|
|
2003
|
+
...receiptFields(r),
|
|
1950
2004
|
raw: r
|
|
1951
2005
|
};
|
|
1952
2006
|
}
|
|
@@ -2944,7 +2998,7 @@ var InvoServer = class {
|
|
|
2944
2998
|
* - rail "game": returns status "pending_payment" + paymentUrl (redirect the browser).
|
|
2945
2999
|
* - rail "steam": NOT a browser flow — the backend returns WRONG_RAIL_ENDPOINT.
|
|
2946
3000
|
*
|
|
2947
|
-
* INVO's card fee (3.5% + $0.30, never less than the card cost). Two shapes, chosen by
|
|
3001
|
+
* INVO's card fee (3.5% + $0.30 on Open, 5% + $0.30 on Merchant of Record, never less than the card cost). Two shapes, chosen by
|
|
2948
3002
|
* what you send:
|
|
2949
3003
|
* - with `acknowledgedTotalUsd` (the `totalUsd` from {@link quoteCurrencyPurchase}): the
|
|
2950
3004
|
* card is charged that total and the coins are priced off `usdAmount`. A total that no
|
|
@@ -3009,6 +3063,7 @@ var InvoServer = class {
|
|
|
3009
3063
|
feeTakenFrom: optionalDecimalString(raw["fee_taken_from"]),
|
|
3010
3064
|
coinsCredited: optionalDecimalString(raw["coins_credited"]),
|
|
3011
3065
|
chargeTotalUsd: optionalDecimalString(raw["charge_total_usd"]),
|
|
3066
|
+
...receiptFields(raw),
|
|
3012
3067
|
raw
|
|
3013
3068
|
};
|
|
3014
3069
|
}
|
|
@@ -3017,7 +3072,7 @@ var InvoServer = class {
|
|
|
3017
3072
|
* creates nothing, so it is safe to call on every price render (`POST
|
|
3018
3073
|
* /api/currency-purchases/quote`, authenticated by your game secret like the purchase).
|
|
3019
3074
|
*
|
|
3020
|
-
* INVO's card fee on a coin purchase is 3.5% + $0.30 of the price, never less than the
|
|
3075
|
+
* INVO's card fee on a coin purchase is 3.5% + $0.30 of the price on the Open tier (5% + $0.30 on Merchant of Record), never less than the
|
|
3021
3076
|
* card cost. `totalUsd` is the price plus that fee (plus any tax, when you pass `country`):
|
|
3022
3077
|
* $10.00 quotes a $10.65 total. Show the player `totalUsd`, then send the same figure back
|
|
3023
3078
|
* as `acknowledgedTotalUsd` on {@link purchaseCurrency}; the card is charged exactly that
|
|
@@ -3046,7 +3101,11 @@ var InvoServer = class {
|
|
|
3046
3101
|
);
|
|
3047
3102
|
return toCurrencyPurchaseQuote(raw);
|
|
3048
3103
|
}
|
|
3049
|
-
/**
|
|
3104
|
+
/**
|
|
3105
|
+
* Complete the card-rail 3-D Secure step after the client finished card action.
|
|
3106
|
+
* `status: "success"` means the payment succeeded; tell the buyer the purchase is complete
|
|
3107
|
+
* only when `credited` is `true` (see {@link ConfirmPaymentResult.credited}).
|
|
3108
|
+
*/
|
|
3050
3109
|
async confirmPayment(input, opts) {
|
|
3051
3110
|
const body = { payment_intent_id: input.paymentIntentId };
|
|
3052
3111
|
if (input.orderId) body["order_id"] = input.orderId;
|
|
@@ -3061,6 +3120,7 @@ var InvoServer = class {
|
|
|
3061
3120
|
status: String(raw["status"] ?? ""),
|
|
3062
3121
|
transactionId: raw["transaction_id"],
|
|
3063
3122
|
newBalance: raw["new_balance"] ?? null,
|
|
3123
|
+
...creditFields(raw),
|
|
3064
3124
|
raw
|
|
3065
3125
|
};
|
|
3066
3126
|
}
|
|
@@ -3224,6 +3284,7 @@ var InvoServer = class {
|
|
|
3224
3284
|
transactionId: raw["transaction_id"] ?? void 0,
|
|
3225
3285
|
newBalance: raw["new_balance"] ?? null,
|
|
3226
3286
|
alreadyProcessed: raw["already_processed"] === true,
|
|
3287
|
+
...creditFields(raw),
|
|
3227
3288
|
raw
|
|
3228
3289
|
};
|
|
3229
3290
|
}
|