@invonetwork/web-sdk 0.4.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/README.md +2 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/server.cjs +1 -0
- package/dist/server.d.cts +4 -2
- package/dist/server.d.ts +4 -2
- package/dist/server.js +1 -0
- package/dist/{types-CBMLNwbe.d.cts → types-CZdmipNK.d.cts} +2 -0
- package/dist/{types-CBMLNwbe.d.ts → types-CZdmipNK.d.ts} +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,15 @@ All notable changes to `@invonetwork/web-sdk` are documented here. This project
|
|
|
4
4
|
[Semantic Versioning](https://semver.org/). Releases are managed with
|
|
5
5
|
[changesets](https://github.com/changesets/changesets).
|
|
6
6
|
|
|
7
|
+
## [0.5.0] — 2026-07-01
|
|
8
|
+
|
|
9
|
+
Support partner `metadata` end-to-end on the purchase flow (additive, backward-compatible).
|
|
10
|
+
|
|
11
|
+
- **`PurchaseCompletedData.metadata?`** — the `purchase.completed` webhook now echoes your
|
|
12
|
+
metadata back (all rails); `event.data.metadata` is typed.
|
|
13
|
+
- **`purchaseCurrency`** now accepts and forwards `metadata` (the direct `/purchase-currency`
|
|
14
|
+
endpoint accepts it too, matching `createCheckout`).
|
|
15
|
+
|
|
7
16
|
## [0.4.2] — 2026-06-30
|
|
8
17
|
|
|
9
18
|
Fixes from an independent line-by-line audit against the live backend.
|
package/README.md
CHANGED
|
@@ -183,6 +183,7 @@ const purchase = await server.purchaseCurrency({
|
|
|
183
183
|
purchaseReference: crypto.randomUUID(), // idempotency key, required
|
|
184
184
|
rail: "platform",
|
|
185
185
|
paymentMethodId: "pm_...", // a tokenized payment method
|
|
186
|
+
metadata: { yourOrderId: "ord_42" }, // echoed back on the purchase.completed webhook
|
|
186
187
|
});
|
|
187
188
|
// purchase.status:
|
|
188
189
|
// "success" → captured, purchase.newBalance updated
|
|
@@ -369,7 +370,7 @@ export const POST = createWebhookHandler({
|
|
|
369
370
|
|
|
370
371
|
| Event | Fires for | Use it to |
|
|
371
372
|
|---|---|---|
|
|
372
|
-
| `purchase.completed` | every currency-purchase rail | grant currency (payload: `transaction_id, order_id, player_email, identity_id, usd_amount, currency_amount, currency_name, new_balance, rail`) |
|
|
373
|
+
| `purchase.completed` | every currency-purchase rail | grant currency (payload: `transaction_id, order_id, player_email, identity_id, usd_amount, currency_amount, currency_name, new_balance, rail, metadata`) — `metadata` echoes what you passed to `createCheckout`/`purchaseCurrency` |
|
|
373
374
|
| `purchase.failed` / `purchase.disputed` | `platform` rail only | handle failures/disputes |
|
|
374
375
|
| `purchase.refunded` | `game` / `steam` rails | handle refunds |
|
|
375
376
|
| `item.purchased` | every item purchase | **grant the in-game item** (payload includes `transaction_id, order_id, player_email, identity_id, item_id, item_name, item_quantity, unit_price, total_price, currency_name, new_balance, fee_breakdown`) |
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ClientConfig, a as CallOptions, A as ApproveResult, b as ConfirmReceiptResult, L as LinkDeviceResult } from './types-
|
|
2
|
-
export { I as InvoError, c as InvoErrorInfo, d as InvoHooks, e as InvoRequestInfo, f as InvoResponseInfo, R as Rail, V as VerificationMethod } from './types-
|
|
1
|
+
import { C as ClientConfig, a as CallOptions, A as ApproveResult, b as ConfirmReceiptResult, L as LinkDeviceResult } from './types-CZdmipNK.cjs';
|
|
2
|
+
export { I as InvoError, c as InvoErrorInfo, d as InvoHooks, e as InvoRequestInfo, f as InvoResponseInfo, R as Rail, V as VerificationMethod } from './types-CZdmipNK.cjs';
|
|
3
3
|
|
|
4
4
|
declare class InvoClient {
|
|
5
5
|
private readonly http;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ClientConfig, a as CallOptions, A as ApproveResult, b as ConfirmReceiptResult, L as LinkDeviceResult } from './types-
|
|
2
|
-
export { I as InvoError, c as InvoErrorInfo, d as InvoHooks, e as InvoRequestInfo, f as InvoResponseInfo, R as Rail, V as VerificationMethod } from './types-
|
|
1
|
+
import { C as ClientConfig, a as CallOptions, A as ApproveResult, b as ConfirmReceiptResult, L as LinkDeviceResult } from './types-CZdmipNK.js';
|
|
2
|
+
export { I as InvoError, c as InvoErrorInfo, d as InvoHooks, e as InvoRequestInfo, f as InvoResponseInfo, R as Rail, V as VerificationMethod } from './types-CZdmipNK.js';
|
|
3
3
|
|
|
4
4
|
declare class InvoClient {
|
|
5
5
|
private readonly http;
|
package/dist/server.cjs
CHANGED
|
@@ -631,6 +631,7 @@ var InvoServer = class {
|
|
|
631
631
|
if (input.savedCardId) body["saved_card_id"] = input.savedCardId;
|
|
632
632
|
if (input.playerName) body["player_name"] = input.playerName;
|
|
633
633
|
if (input.playerPhone) body["player_phone"] = input.playerPhone;
|
|
634
|
+
if (input.metadata) body["metadata"] = input.metadata;
|
|
634
635
|
const raw = await this.http.post(
|
|
635
636
|
"/api/currency-purchases/purchase-currency",
|
|
636
637
|
body,
|
package/dist/server.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as InvoError, S as ServerConfig, a as CallOptions, P as PlayerToken, g as InitiateSendInput, h as InitiateResult, i as InitiateTransferInput, j as CreateCheckoutInput, k as CreateCheckoutResult, l as PurchaseInput, m as PurchaseResult, n as ConfirmPaymentResult, O as OrderDetailsResult, o as PurchaseItemInput, p as PurchaseItemResult, q as ItemHistoryQuery, r as ItemHistoryResult, s as ItemOrderQuery, t as PlayerBalanceQuery, u as PlayerBalanceResult, v as InboundPendingQuery, w as InboundPendingResult } from './types-
|
|
2
|
-
export { x as CurrencyBalance, y as InboundPendingItem, c as InvoErrorInfo, d as InvoHooks, e as InvoRequestInfo, f as InvoResponseInfo, R as Rail, V as VerificationMethod } from './types-
|
|
1
|
+
import { I as InvoError, S as ServerConfig, a as CallOptions, P as PlayerToken, g as InitiateSendInput, h as InitiateResult, i as InitiateTransferInput, j as CreateCheckoutInput, k as CreateCheckoutResult, l as PurchaseInput, m as PurchaseResult, n as ConfirmPaymentResult, O as OrderDetailsResult, o as PurchaseItemInput, p as PurchaseItemResult, q as ItemHistoryQuery, r as ItemHistoryResult, s as ItemOrderQuery, t as PlayerBalanceQuery, u as PlayerBalanceResult, v as InboundPendingQuery, w as InboundPendingResult } from './types-CZdmipNK.cjs';
|
|
2
|
+
export { x as CurrencyBalance, y as InboundPendingItem, c as InvoErrorInfo, d as InvoHooks, e as InvoRequestInfo, f as InvoResponseInfo, R as Rail, V as VerificationMethod } from './types-CZdmipNK.cjs';
|
|
3
3
|
|
|
4
4
|
interface VerifyWebhookOptions {
|
|
5
5
|
/** Max age of the signed timestamp, in seconds. Default 300 (5 min). */
|
|
@@ -25,6 +25,8 @@ interface PurchaseCompletedData {
|
|
|
25
25
|
currency_name: string;
|
|
26
26
|
new_balance: string;
|
|
27
27
|
rail: string;
|
|
28
|
+
/** The metadata you passed to createCheckout/purchaseCurrency, echoed back (all rails). */
|
|
29
|
+
metadata?: Record<string, unknown>;
|
|
28
30
|
[key: string]: unknown;
|
|
29
31
|
}
|
|
30
32
|
interface PurchaseEventData {
|
package/dist/server.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as InvoError, S as ServerConfig, a as CallOptions, P as PlayerToken, g as InitiateSendInput, h as InitiateResult, i as InitiateTransferInput, j as CreateCheckoutInput, k as CreateCheckoutResult, l as PurchaseInput, m as PurchaseResult, n as ConfirmPaymentResult, O as OrderDetailsResult, o as PurchaseItemInput, p as PurchaseItemResult, q as ItemHistoryQuery, r as ItemHistoryResult, s as ItemOrderQuery, t as PlayerBalanceQuery, u as PlayerBalanceResult, v as InboundPendingQuery, w as InboundPendingResult } from './types-
|
|
2
|
-
export { x as CurrencyBalance, y as InboundPendingItem, c as InvoErrorInfo, d as InvoHooks, e as InvoRequestInfo, f as InvoResponseInfo, R as Rail, V as VerificationMethod } from './types-
|
|
1
|
+
import { I as InvoError, S as ServerConfig, a as CallOptions, P as PlayerToken, g as InitiateSendInput, h as InitiateResult, i as InitiateTransferInput, j as CreateCheckoutInput, k as CreateCheckoutResult, l as PurchaseInput, m as PurchaseResult, n as ConfirmPaymentResult, O as OrderDetailsResult, o as PurchaseItemInput, p as PurchaseItemResult, q as ItemHistoryQuery, r as ItemHistoryResult, s as ItemOrderQuery, t as PlayerBalanceQuery, u as PlayerBalanceResult, v as InboundPendingQuery, w as InboundPendingResult } from './types-CZdmipNK.js';
|
|
2
|
+
export { x as CurrencyBalance, y as InboundPendingItem, c as InvoErrorInfo, d as InvoHooks, e as InvoRequestInfo, f as InvoResponseInfo, R as Rail, V as VerificationMethod } from './types-CZdmipNK.js';
|
|
3
3
|
|
|
4
4
|
interface VerifyWebhookOptions {
|
|
5
5
|
/** Max age of the signed timestamp, in seconds. Default 300 (5 min). */
|
|
@@ -25,6 +25,8 @@ interface PurchaseCompletedData {
|
|
|
25
25
|
currency_name: string;
|
|
26
26
|
new_balance: string;
|
|
27
27
|
rail: string;
|
|
28
|
+
/** The metadata you passed to createCheckout/purchaseCurrency, echoed back (all rails). */
|
|
29
|
+
metadata?: Record<string, unknown>;
|
|
28
30
|
[key: string]: unknown;
|
|
29
31
|
}
|
|
30
32
|
interface PurchaseEventData {
|
package/dist/server.js
CHANGED
|
@@ -382,6 +382,7 @@ var InvoServer = class {
|
|
|
382
382
|
if (input.savedCardId) body["saved_card_id"] = input.savedCardId;
|
|
383
383
|
if (input.playerName) body["player_name"] = input.playerName;
|
|
384
384
|
if (input.playerPhone) body["player_phone"] = input.playerPhone;
|
|
385
|
+
if (input.metadata) body["metadata"] = input.metadata;
|
|
385
386
|
const raw = await this.http.post(
|
|
386
387
|
"/api/currency-purchases/purchase-currency",
|
|
387
388
|
body,
|
|
@@ -176,6 +176,8 @@ interface PurchaseInput {
|
|
|
176
176
|
savedCardId?: string;
|
|
177
177
|
playerName?: string;
|
|
178
178
|
playerPhone?: string;
|
|
179
|
+
/** Arbitrary metadata echoed back on the purchase.completed webhook (data.metadata). */
|
|
180
|
+
metadata?: Record<string, unknown>;
|
|
179
181
|
}
|
|
180
182
|
type PurchaseStatus = "success" | "requires_action" | "pending_payment";
|
|
181
183
|
interface PurchaseResult {
|
|
@@ -176,6 +176,8 @@ interface PurchaseInput {
|
|
|
176
176
|
savedCardId?: string;
|
|
177
177
|
playerName?: string;
|
|
178
178
|
playerPhone?: string;
|
|
179
|
+
/** Arbitrary metadata echoed back on the purchase.completed webhook (data.metadata). */
|
|
180
|
+
metadata?: Record<string, unknown>;
|
|
179
181
|
}
|
|
180
182
|
type PurchaseStatus = "success" | "requires_action" | "pending_payment";
|
|
181
183
|
interface PurchaseResult {
|
package/package.json
CHANGED