@invonetwork/web-sdk 0.3.0 → 0.4.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 +21 -1
- package/README.md +33 -2
- package/dist/{chunk-DV3WZGMH.js → chunk-EEWOAUXO.js} +28 -10
- package/dist/index.cjs +74 -36
- package/dist/index.d.cts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +50 -30
- package/dist/server.cjs +210 -39
- package/dist/server.d.cts +78 -19
- package/dist/server.d.ts +78 -19
- package/dist/server.js +185 -34
- package/dist/{types-CBkoUymV.d.cts → types-CBMLNwbe.d.cts} +32 -1
- package/dist/{types-CBkoUymV.d.ts → types-CBMLNwbe.d.ts} +32 -1
- package/package.json +9 -1
package/dist/server.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as ServerConfig, P as PlayerToken,
|
|
2
|
-
export {
|
|
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-CBMLNwbe.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-CBMLNwbe.cjs';
|
|
3
3
|
|
|
4
4
|
interface VerifyWebhookOptions {
|
|
5
5
|
/** Max age of the signed timestamp, in seconds. Default 300 (5 min). */
|
|
@@ -94,15 +94,54 @@ type InvoWebhookEvent = (WebhookBase & {
|
|
|
94
94
|
data: Record<string, unknown>;
|
|
95
95
|
});
|
|
96
96
|
/**
|
|
97
|
-
* Verify an Invo webhook and return the parsed, typed event.
|
|
97
|
+
* Verify an Invo webhook and return the parsed, typed event. **Synchronous; uses
|
|
98
|
+
* `node:crypto`** — for non-Node runtimes (Cloudflare Workers, Deno, Vercel/Netlify
|
|
99
|
+
* Edge, Bun edge) use {@link verifyWebhookAsync}.
|
|
98
100
|
*
|
|
99
|
-
* @param rawBody The exact raw request body (
|
|
101
|
+
* @param rawBody The exact raw request body (bytes or string) — never a re-serialized object.
|
|
100
102
|
* @param signatureHeader The `X-Invo-Signature` header value.
|
|
101
|
-
* @param secret Your signing secret, or an array
|
|
102
|
-
* @throws InvoError (status 0)
|
|
103
|
-
* WEBHOOK_SIGNATURE_INVALID | WEBHOOK_MALFORMED
|
|
103
|
+
* @param secret Your signing secret, or an array (to accept old + new during rotation).
|
|
104
|
+
* @throws InvoError (status 0): WEBHOOK_SIGNATURE_MISSING | WEBHOOK_SECRET_MISSING |
|
|
105
|
+
* WEBHOOK_TIMESTAMP_EXPIRED | WEBHOOK_SIGNATURE_INVALID | WEBHOOK_MALFORMED.
|
|
104
106
|
*/
|
|
105
107
|
declare function verifyWebhook(rawBody: string | Uint8Array, signatureHeader: string | null | undefined, secret: string | string[], opts?: VerifyWebhookOptions): InvoWebhookEvent;
|
|
108
|
+
/**
|
|
109
|
+
* Cross-runtime async variant of {@link verifyWebhook}. Uses the Web Crypto API
|
|
110
|
+
* (`crypto.subtle`) instead of `node:crypto`, so it works on Cloudflare Workers,
|
|
111
|
+
* Deno, Vercel/Netlify Edge, Bun, and modern browsers (as well as Node ≥ 18).
|
|
112
|
+
* Same arguments, errors, and return value — just `await` it.
|
|
113
|
+
*/
|
|
114
|
+
declare function verifyWebhookAsync(rawBody: string | Uint8Array, signatureHeader: string | null | undefined, secret: string | string[], opts?: VerifyWebhookOptions): Promise<InvoWebhookEvent>;
|
|
115
|
+
interface WebhookHandlerOptions {
|
|
116
|
+
/** Signing secret, or an array to accept old + new during rotation. */
|
|
117
|
+
secret: string | string[];
|
|
118
|
+
/** Called with the verified, typed event after the signature passes. De-dupe on
|
|
119
|
+
* `ctx.idempotencyKey`. Throw to return a 500 (Invo will retry). */
|
|
120
|
+
onEvent: (event: InvoWebhookEvent, ctx: {
|
|
121
|
+
idempotencyKey: string | null;
|
|
122
|
+
request: Request;
|
|
123
|
+
}) => void | Promise<void>;
|
|
124
|
+
/** Optional: handle a verification failure. Return a Response to override the default 400. */
|
|
125
|
+
onError?: (error: InvoError, request: Request) => void | Response | Promise<void | Response>;
|
|
126
|
+
/** Replay tolerance (seconds). Default 300. */
|
|
127
|
+
toleranceSec?: number;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Build a webhook route handler from the Fetch API `(Request) => Promise<Response>` —
|
|
131
|
+
* works in Next.js App Router route handlers, Cloudflare Workers, Deno, Hono, and Bun.
|
|
132
|
+
* It reads the raw body, verifies with {@link verifyWebhookAsync}, and on success calls
|
|
133
|
+
* `onEvent` with the typed event and the idempotency key (de-dupe is yours). Verification
|
|
134
|
+
* failures return `400`; a throwing `onEvent` returns `500` so Invo retries.
|
|
135
|
+
*
|
|
136
|
+
* ```ts
|
|
137
|
+
* // app/invo/webhooks/route.ts (Next.js)
|
|
138
|
+
* export const POST = createWebhookHandler({
|
|
139
|
+
* secret: process.env.INVO_WEBHOOK_SECRET!,
|
|
140
|
+
* onEvent: async (event, { idempotencyKey }) => { await grantValue(event); },
|
|
141
|
+
* });
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
declare function createWebhookHandler(opts: WebhookHandlerOptions): (request: Request) => Promise<Response>;
|
|
106
145
|
|
|
107
146
|
declare class InvoServer {
|
|
108
147
|
private readonly http;
|
|
@@ -111,16 +150,16 @@ declare class InvoServer {
|
|
|
111
150
|
/** Mint a short-lived, game-scoped player token to hand to the browser InvoClient. */
|
|
112
151
|
mintPlayerToken(input: {
|
|
113
152
|
playerEmail: string;
|
|
114
|
-
}): Promise<PlayerToken>;
|
|
153
|
+
}, opts?: CallOptions): Promise<PlayerToken>;
|
|
115
154
|
/** Initiate a cross-game currency SEND. Inspect result.verificationMethod. */
|
|
116
|
-
initiateSend(input: InitiateSendInput): Promise<InitiateResult>;
|
|
155
|
+
initiateSend(input: InitiateSendInput, opts?: CallOptions): Promise<InitiateResult>;
|
|
117
156
|
/** Initiate a cross-game TRANSFER. Inspect result.verificationMethod. */
|
|
118
|
-
initiateTransfer(input: InitiateTransferInput): Promise<InitiateResult>;
|
|
157
|
+
initiateTransfer(input: InitiateTransferInput, opts?: CallOptions): Promise<InitiateResult>;
|
|
119
158
|
/** Create a hosted checkout session (the recommended purchase path). Open the
|
|
120
159
|
* returned checkoutUrl in a WebView/redirect or an iframe; the INVO-hosted page
|
|
121
160
|
* handles cards, saved cards, and 3-D Secure. Crediting is server-side via the
|
|
122
161
|
* purchase.completed webhook. */
|
|
123
|
-
createCheckout(input: CreateCheckoutInput): Promise<CreateCheckoutResult>;
|
|
162
|
+
createCheckout(input: CreateCheckoutInput, opts?: CallOptions): Promise<CreateCheckoutResult>;
|
|
124
163
|
/**
|
|
125
164
|
* Direct purchase via the rail selector. Use when you need a specific rail.
|
|
126
165
|
* - rail "platform" (default): standard card. May return status "requires_action"
|
|
@@ -128,17 +167,17 @@ declare class InvoServer {
|
|
|
128
167
|
* - rail "game": returns status "pending_payment" + paymentUrl (redirect the browser).
|
|
129
168
|
* - rail "steam": NOT a browser flow — the backend returns WRONG_RAIL_ENDPOINT.
|
|
130
169
|
*/
|
|
131
|
-
purchaseCurrency(input: PurchaseInput): Promise<PurchaseResult>;
|
|
170
|
+
purchaseCurrency(input: PurchaseInput, opts?: CallOptions): Promise<PurchaseResult>;
|
|
132
171
|
/** Complete the Stripe-rail 3-D Secure step after the client finished card action. */
|
|
133
172
|
confirmPayment(input: {
|
|
134
173
|
paymentIntentId: string;
|
|
135
174
|
orderId?: string;
|
|
136
|
-
}): Promise<ConfirmPaymentResult>;
|
|
175
|
+
}, opts?: CallOptions): Promise<ConfirmPaymentResult>;
|
|
137
176
|
/** Fetch purchase status (order + financial summary + timeline). */
|
|
138
177
|
getOrderDetails(query: {
|
|
139
178
|
orderId?: string;
|
|
140
179
|
transactionId?: string;
|
|
141
|
-
}): Promise<OrderDetailsResult>;
|
|
180
|
+
}, opts?: CallOptions): Promise<OrderDetailsResult>;
|
|
142
181
|
/**
|
|
143
182
|
* Buy an in-game item by SPENDING the player's existing game currency (§4.8).
|
|
144
183
|
* No real money, no payment rail, no passkey — it's a balance debit, authenticated
|
|
@@ -147,15 +186,35 @@ declare class InvoServer {
|
|
|
147
186
|
* (err.isInsufficientBalance; required_amount/current_balance on err.body). Grant the
|
|
148
187
|
* item to your inventory off the `item.purchased` webhook, not just this response.
|
|
149
188
|
*/
|
|
150
|
-
purchaseItem(input: PurchaseItemInput): Promise<PurchaseItemResult>;
|
|
189
|
+
purchaseItem(input: PurchaseItemInput, opts?: CallOptions): Promise<PurchaseItemResult>;
|
|
151
190
|
/** Paginated item-purchase history for a player (§4.8 companion read). */
|
|
152
|
-
getItemPurchaseHistory(query: ItemHistoryQuery): Promise<ItemHistoryResult>;
|
|
191
|
+
getItemPurchaseHistory(query: ItemHistoryQuery, opts?: CallOptions): Promise<ItemHistoryResult>;
|
|
153
192
|
/** Look up one item order by EXACTLY ONE of orderId | transactionId | clientRequestId
|
|
154
193
|
* (§4.8). Use clientRequestId for saga/recovery: "did this purchase actually complete?" */
|
|
155
|
-
getItemOrderDetails(query: ItemOrderQuery): Promise<OrderDetailsResult>;
|
|
194
|
+
getItemOrderDetails(query: ItemOrderQuery, opts?: CallOptions): Promise<OrderDetailsResult>;
|
|
195
|
+
/**
|
|
196
|
+
* Async iterator over a player's entire item-purchase history — pages through
|
|
197
|
+
* `getItemPurchaseHistory` (limit/offset) until exhausted, yielding one row at a time.
|
|
198
|
+
*
|
|
199
|
+
* ```ts
|
|
200
|
+
* for await (const row of invo.iterateItemPurchaseHistory({ playerEmail })) { … }
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
iterateItemPurchaseHistory(query: {
|
|
204
|
+
playerEmail: string;
|
|
205
|
+
pageSize?: number;
|
|
206
|
+
}, opts?: CallOptions): AsyncGenerator<Record<string, unknown>, void, unknown>;
|
|
156
207
|
/** Read a player's currency balances, by email or playerId (game-secret). */
|
|
157
|
-
getPlayerBalance(query: PlayerBalanceQuery): Promise<PlayerBalanceResult>;
|
|
208
|
+
getPlayerBalance(query: PlayerBalanceQuery, opts?: CallOptions): Promise<PlayerBalanceResult>;
|
|
209
|
+
/**
|
|
210
|
+
* List LIVE, unclaimed inbound sends/transfers addressed to a player at YOUR game —
|
|
211
|
+
* the source of truth for a "you have X to collect" badge. Pass the player's email
|
|
212
|
+
* or phone. Match `toPhone` to the logged-in player (don't require `toIdentityId`,
|
|
213
|
+
* which is null when the phone maps to more than one of your players). Pairs with the
|
|
214
|
+
* `transfer.claim_pending` webhook (the webhook is the wake-up; this is the list).
|
|
215
|
+
*/
|
|
216
|
+
getInboundPending(query: InboundPendingQuery, opts?: CallOptions): Promise<InboundPendingResult>;
|
|
158
217
|
private toInitiateResult;
|
|
159
218
|
}
|
|
160
219
|
|
|
161
|
-
export { ConfirmPaymentResult, CreateCheckoutInput, CreateCheckoutResult, InitiateResult, InitiateSendInput, InitiateTransferInput, InvoServer, type InvoWebhookEvent, ItemHistoryQuery, ItemHistoryResult, ItemOrderQuery, type ItemPurchasedData, OrderDetailsResult, PlayerBalanceQuery, PlayerBalanceResult, PlayerToken, type PurchaseCompletedData, type PurchaseEventData, PurchaseInput, PurchaseItemInput, PurchaseItemResult, PurchaseResult, ServerConfig, type TransferEventData, type VerifyWebhookOptions, verifyWebhook };
|
|
220
|
+
export { CallOptions, ConfirmPaymentResult, CreateCheckoutInput, CreateCheckoutResult, InboundPendingQuery, InboundPendingResult, InitiateResult, InitiateSendInput, InitiateTransferInput, InvoError, InvoServer, type InvoWebhookEvent, ItemHistoryQuery, ItemHistoryResult, ItemOrderQuery, type ItemPurchasedData, OrderDetailsResult, PlayerBalanceQuery, PlayerBalanceResult, PlayerToken, type PurchaseCompletedData, type PurchaseEventData, PurchaseInput, PurchaseItemInput, PurchaseItemResult, PurchaseResult, ServerConfig, type TransferEventData, type VerifyWebhookOptions, type WebhookHandlerOptions, createWebhookHandler, verifyWebhook, verifyWebhookAsync };
|
package/dist/server.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as ServerConfig, P as PlayerToken,
|
|
2
|
-
export {
|
|
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-CBMLNwbe.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-CBMLNwbe.js';
|
|
3
3
|
|
|
4
4
|
interface VerifyWebhookOptions {
|
|
5
5
|
/** Max age of the signed timestamp, in seconds. Default 300 (5 min). */
|
|
@@ -94,15 +94,54 @@ type InvoWebhookEvent = (WebhookBase & {
|
|
|
94
94
|
data: Record<string, unknown>;
|
|
95
95
|
});
|
|
96
96
|
/**
|
|
97
|
-
* Verify an Invo webhook and return the parsed, typed event.
|
|
97
|
+
* Verify an Invo webhook and return the parsed, typed event. **Synchronous; uses
|
|
98
|
+
* `node:crypto`** — for non-Node runtimes (Cloudflare Workers, Deno, Vercel/Netlify
|
|
99
|
+
* Edge, Bun edge) use {@link verifyWebhookAsync}.
|
|
98
100
|
*
|
|
99
|
-
* @param rawBody The exact raw request body (
|
|
101
|
+
* @param rawBody The exact raw request body (bytes or string) — never a re-serialized object.
|
|
100
102
|
* @param signatureHeader The `X-Invo-Signature` header value.
|
|
101
|
-
* @param secret Your signing secret, or an array
|
|
102
|
-
* @throws InvoError (status 0)
|
|
103
|
-
* WEBHOOK_SIGNATURE_INVALID | WEBHOOK_MALFORMED
|
|
103
|
+
* @param secret Your signing secret, or an array (to accept old + new during rotation).
|
|
104
|
+
* @throws InvoError (status 0): WEBHOOK_SIGNATURE_MISSING | WEBHOOK_SECRET_MISSING |
|
|
105
|
+
* WEBHOOK_TIMESTAMP_EXPIRED | WEBHOOK_SIGNATURE_INVALID | WEBHOOK_MALFORMED.
|
|
104
106
|
*/
|
|
105
107
|
declare function verifyWebhook(rawBody: string | Uint8Array, signatureHeader: string | null | undefined, secret: string | string[], opts?: VerifyWebhookOptions): InvoWebhookEvent;
|
|
108
|
+
/**
|
|
109
|
+
* Cross-runtime async variant of {@link verifyWebhook}. Uses the Web Crypto API
|
|
110
|
+
* (`crypto.subtle`) instead of `node:crypto`, so it works on Cloudflare Workers,
|
|
111
|
+
* Deno, Vercel/Netlify Edge, Bun, and modern browsers (as well as Node ≥ 18).
|
|
112
|
+
* Same arguments, errors, and return value — just `await` it.
|
|
113
|
+
*/
|
|
114
|
+
declare function verifyWebhookAsync(rawBody: string | Uint8Array, signatureHeader: string | null | undefined, secret: string | string[], opts?: VerifyWebhookOptions): Promise<InvoWebhookEvent>;
|
|
115
|
+
interface WebhookHandlerOptions {
|
|
116
|
+
/** Signing secret, or an array to accept old + new during rotation. */
|
|
117
|
+
secret: string | string[];
|
|
118
|
+
/** Called with the verified, typed event after the signature passes. De-dupe on
|
|
119
|
+
* `ctx.idempotencyKey`. Throw to return a 500 (Invo will retry). */
|
|
120
|
+
onEvent: (event: InvoWebhookEvent, ctx: {
|
|
121
|
+
idempotencyKey: string | null;
|
|
122
|
+
request: Request;
|
|
123
|
+
}) => void | Promise<void>;
|
|
124
|
+
/** Optional: handle a verification failure. Return a Response to override the default 400. */
|
|
125
|
+
onError?: (error: InvoError, request: Request) => void | Response | Promise<void | Response>;
|
|
126
|
+
/** Replay tolerance (seconds). Default 300. */
|
|
127
|
+
toleranceSec?: number;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Build a webhook route handler from the Fetch API `(Request) => Promise<Response>` —
|
|
131
|
+
* works in Next.js App Router route handlers, Cloudflare Workers, Deno, Hono, and Bun.
|
|
132
|
+
* It reads the raw body, verifies with {@link verifyWebhookAsync}, and on success calls
|
|
133
|
+
* `onEvent` with the typed event and the idempotency key (de-dupe is yours). Verification
|
|
134
|
+
* failures return `400`; a throwing `onEvent` returns `500` so Invo retries.
|
|
135
|
+
*
|
|
136
|
+
* ```ts
|
|
137
|
+
* // app/invo/webhooks/route.ts (Next.js)
|
|
138
|
+
* export const POST = createWebhookHandler({
|
|
139
|
+
* secret: process.env.INVO_WEBHOOK_SECRET!,
|
|
140
|
+
* onEvent: async (event, { idempotencyKey }) => { await grantValue(event); },
|
|
141
|
+
* });
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
declare function createWebhookHandler(opts: WebhookHandlerOptions): (request: Request) => Promise<Response>;
|
|
106
145
|
|
|
107
146
|
declare class InvoServer {
|
|
108
147
|
private readonly http;
|
|
@@ -111,16 +150,16 @@ declare class InvoServer {
|
|
|
111
150
|
/** Mint a short-lived, game-scoped player token to hand to the browser InvoClient. */
|
|
112
151
|
mintPlayerToken(input: {
|
|
113
152
|
playerEmail: string;
|
|
114
|
-
}): Promise<PlayerToken>;
|
|
153
|
+
}, opts?: CallOptions): Promise<PlayerToken>;
|
|
115
154
|
/** Initiate a cross-game currency SEND. Inspect result.verificationMethod. */
|
|
116
|
-
initiateSend(input: InitiateSendInput): Promise<InitiateResult>;
|
|
155
|
+
initiateSend(input: InitiateSendInput, opts?: CallOptions): Promise<InitiateResult>;
|
|
117
156
|
/** Initiate a cross-game TRANSFER. Inspect result.verificationMethod. */
|
|
118
|
-
initiateTransfer(input: InitiateTransferInput): Promise<InitiateResult>;
|
|
157
|
+
initiateTransfer(input: InitiateTransferInput, opts?: CallOptions): Promise<InitiateResult>;
|
|
119
158
|
/** Create a hosted checkout session (the recommended purchase path). Open the
|
|
120
159
|
* returned checkoutUrl in a WebView/redirect or an iframe; the INVO-hosted page
|
|
121
160
|
* handles cards, saved cards, and 3-D Secure. Crediting is server-side via the
|
|
122
161
|
* purchase.completed webhook. */
|
|
123
|
-
createCheckout(input: CreateCheckoutInput): Promise<CreateCheckoutResult>;
|
|
162
|
+
createCheckout(input: CreateCheckoutInput, opts?: CallOptions): Promise<CreateCheckoutResult>;
|
|
124
163
|
/**
|
|
125
164
|
* Direct purchase via the rail selector. Use when you need a specific rail.
|
|
126
165
|
* - rail "platform" (default): standard card. May return status "requires_action"
|
|
@@ -128,17 +167,17 @@ declare class InvoServer {
|
|
|
128
167
|
* - rail "game": returns status "pending_payment" + paymentUrl (redirect the browser).
|
|
129
168
|
* - rail "steam": NOT a browser flow — the backend returns WRONG_RAIL_ENDPOINT.
|
|
130
169
|
*/
|
|
131
|
-
purchaseCurrency(input: PurchaseInput): Promise<PurchaseResult>;
|
|
170
|
+
purchaseCurrency(input: PurchaseInput, opts?: CallOptions): Promise<PurchaseResult>;
|
|
132
171
|
/** Complete the Stripe-rail 3-D Secure step after the client finished card action. */
|
|
133
172
|
confirmPayment(input: {
|
|
134
173
|
paymentIntentId: string;
|
|
135
174
|
orderId?: string;
|
|
136
|
-
}): Promise<ConfirmPaymentResult>;
|
|
175
|
+
}, opts?: CallOptions): Promise<ConfirmPaymentResult>;
|
|
137
176
|
/** Fetch purchase status (order + financial summary + timeline). */
|
|
138
177
|
getOrderDetails(query: {
|
|
139
178
|
orderId?: string;
|
|
140
179
|
transactionId?: string;
|
|
141
|
-
}): Promise<OrderDetailsResult>;
|
|
180
|
+
}, opts?: CallOptions): Promise<OrderDetailsResult>;
|
|
142
181
|
/**
|
|
143
182
|
* Buy an in-game item by SPENDING the player's existing game currency (§4.8).
|
|
144
183
|
* No real money, no payment rail, no passkey — it's a balance debit, authenticated
|
|
@@ -147,15 +186,35 @@ declare class InvoServer {
|
|
|
147
186
|
* (err.isInsufficientBalance; required_amount/current_balance on err.body). Grant the
|
|
148
187
|
* item to your inventory off the `item.purchased` webhook, not just this response.
|
|
149
188
|
*/
|
|
150
|
-
purchaseItem(input: PurchaseItemInput): Promise<PurchaseItemResult>;
|
|
189
|
+
purchaseItem(input: PurchaseItemInput, opts?: CallOptions): Promise<PurchaseItemResult>;
|
|
151
190
|
/** Paginated item-purchase history for a player (§4.8 companion read). */
|
|
152
|
-
getItemPurchaseHistory(query: ItemHistoryQuery): Promise<ItemHistoryResult>;
|
|
191
|
+
getItemPurchaseHistory(query: ItemHistoryQuery, opts?: CallOptions): Promise<ItemHistoryResult>;
|
|
153
192
|
/** Look up one item order by EXACTLY ONE of orderId | transactionId | clientRequestId
|
|
154
193
|
* (§4.8). Use clientRequestId for saga/recovery: "did this purchase actually complete?" */
|
|
155
|
-
getItemOrderDetails(query: ItemOrderQuery): Promise<OrderDetailsResult>;
|
|
194
|
+
getItemOrderDetails(query: ItemOrderQuery, opts?: CallOptions): Promise<OrderDetailsResult>;
|
|
195
|
+
/**
|
|
196
|
+
* Async iterator over a player's entire item-purchase history — pages through
|
|
197
|
+
* `getItemPurchaseHistory` (limit/offset) until exhausted, yielding one row at a time.
|
|
198
|
+
*
|
|
199
|
+
* ```ts
|
|
200
|
+
* for await (const row of invo.iterateItemPurchaseHistory({ playerEmail })) { … }
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
iterateItemPurchaseHistory(query: {
|
|
204
|
+
playerEmail: string;
|
|
205
|
+
pageSize?: number;
|
|
206
|
+
}, opts?: CallOptions): AsyncGenerator<Record<string, unknown>, void, unknown>;
|
|
156
207
|
/** Read a player's currency balances, by email or playerId (game-secret). */
|
|
157
|
-
getPlayerBalance(query: PlayerBalanceQuery): Promise<PlayerBalanceResult>;
|
|
208
|
+
getPlayerBalance(query: PlayerBalanceQuery, opts?: CallOptions): Promise<PlayerBalanceResult>;
|
|
209
|
+
/**
|
|
210
|
+
* List LIVE, unclaimed inbound sends/transfers addressed to a player at YOUR game —
|
|
211
|
+
* the source of truth for a "you have X to collect" badge. Pass the player's email
|
|
212
|
+
* or phone. Match `toPhone` to the logged-in player (don't require `toIdentityId`,
|
|
213
|
+
* which is null when the phone maps to more than one of your players). Pairs with the
|
|
214
|
+
* `transfer.claim_pending` webhook (the webhook is the wake-up; this is the list).
|
|
215
|
+
*/
|
|
216
|
+
getInboundPending(query: InboundPendingQuery, opts?: CallOptions): Promise<InboundPendingResult>;
|
|
158
217
|
private toInitiateResult;
|
|
159
218
|
}
|
|
160
219
|
|
|
161
|
-
export { ConfirmPaymentResult, CreateCheckoutInput, CreateCheckoutResult, InitiateResult, InitiateSendInput, InitiateTransferInput, InvoServer, type InvoWebhookEvent, ItemHistoryQuery, ItemHistoryResult, ItemOrderQuery, type ItemPurchasedData, OrderDetailsResult, PlayerBalanceQuery, PlayerBalanceResult, PlayerToken, type PurchaseCompletedData, type PurchaseEventData, PurchaseInput, PurchaseItemInput, PurchaseItemResult, PurchaseResult, ServerConfig, type TransferEventData, type VerifyWebhookOptions, verifyWebhook };
|
|
220
|
+
export { CallOptions, ConfirmPaymentResult, CreateCheckoutInput, CreateCheckoutResult, InboundPendingQuery, InboundPendingResult, InitiateResult, InitiateSendInput, InitiateTransferInput, InvoError, InvoServer, type InvoWebhookEvent, ItemHistoryQuery, ItemHistoryResult, ItemOrderQuery, type ItemPurchasedData, OrderDetailsResult, PlayerBalanceQuery, PlayerBalanceResult, PlayerToken, type PurchaseCompletedData, type PurchaseEventData, PurchaseInput, PurchaseItemInput, PurchaseItemResult, PurchaseResult, ServerConfig, type TransferEventData, type VerifyWebhookOptions, type WebhookHandlerOptions, createWebhookHandler, verifyWebhook, verifyWebhookAsync };
|