@solvapay/server 1.0.1-preview.2 → 1.0.1-preview.3

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/dist/edge.d.ts CHANGED
@@ -77,12 +77,12 @@ interface components {
77
77
  VerifyEmailChange: {
78
78
  code: string;
79
79
  };
80
- CreateCheckoutSessionRequest: {
80
+ CreateUiCheckoutSessionRequest: {
81
81
  /**
82
82
  * Customer reference
83
83
  * @example cus_3c4d5e6f7g8h
84
84
  */
85
- customerReference: string;
85
+ customerRef: string;
86
86
  /**
87
87
  * Plan reference (optional)
88
88
  * @example pln_2b3c4d5e6f7g
@@ -188,6 +188,40 @@ interface components {
188
188
  /** @description Terms of Service acceptance */
189
189
  tosAcceptance?: components["schemas"]["TosAcceptance"];
190
190
  };
191
+ CreateCheckoutSessionRequest: {
192
+ /**
193
+ * Customer reference identifier
194
+ * @example cus_3c4d5e6f7g8h
195
+ */
196
+ customerRef: string;
197
+ /**
198
+ * Product reference identifier
199
+ * @example prd_1A2B3C4D
200
+ */
201
+ productRef: string;
202
+ /**
203
+ * Plan reference identifier (optional)
204
+ * @example pln_2b3c4d5e6f7g
205
+ */
206
+ planRef?: string;
207
+ /**
208
+ * URL to redirect to after successful payment (optional)
209
+ * @example https://example.com/payment-success
210
+ */
211
+ returnUrl?: string;
212
+ };
213
+ CreateCheckoutSessionResponse: {
214
+ /**
215
+ * Checkout session ID/token
216
+ * @example e3f1c2d4b6a89f001122334455667788
217
+ */
218
+ sessionId: string;
219
+ /**
220
+ * Full checkout URL based on backend configuration (ready to redirect customer)
221
+ * @example https://solvapay.com/customer/checkout?id=e3f1c2d4b6a89f001122334455667788
222
+ */
223
+ checkoutUrl: string;
224
+ };
191
225
  Signup: {
192
226
  name: string;
193
227
  email: string;
@@ -1812,6 +1846,101 @@ interface components {
1812
1846
  [key: string]: string;
1813
1847
  };
1814
1848
  };
1849
+ RevenueDataDto: {
1850
+ grossRevenue: number;
1851
+ refunds: number;
1852
+ platformFees: number;
1853
+ netRevenue: number;
1854
+ costOfRevenue: number;
1855
+ grossProfit?: Record<string, never> | null;
1856
+ grossMargin?: Record<string, never> | null;
1857
+ recognisedRevenue: number;
1858
+ deferredRevenue: number;
1859
+ hasCostTransactions: boolean;
1860
+ };
1861
+ BalanceDataDto: {
1862
+ openingBalance: number;
1863
+ paymentsReceived: number;
1864
+ refundsIssued: number;
1865
+ platformFees: number;
1866
+ costsPaid: number;
1867
+ closingBalance: number;
1868
+ netChange: number;
1869
+ };
1870
+ MonthlyFinancialsDto: {
1871
+ month: string;
1872
+ revenue: components["schemas"]["RevenueDataDto"];
1873
+ balance: components["schemas"]["BalanceDataDto"];
1874
+ };
1875
+ RevenueResponseDto: {
1876
+ current: components["schemas"]["RevenueDataDto"];
1877
+ prior: components["schemas"]["RevenueDataDto"];
1878
+ monthly: components["schemas"]["MonthlyFinancialsDto"][];
1879
+ periodLabel: string;
1880
+ /**
1881
+ * ISO 4217 currency code
1882
+ * @example SEK
1883
+ */
1884
+ currency: string;
1885
+ };
1886
+ BalanceResponseDto: {
1887
+ current: components["schemas"]["BalanceDataDto"];
1888
+ monthly: components["schemas"]["MonthlyFinancialsDto"][];
1889
+ periodLabel: string;
1890
+ /**
1891
+ * ISO 4217 currency code
1892
+ * @example SEK
1893
+ */
1894
+ currency: string;
1895
+ };
1896
+ ProductRevenueRowDto: {
1897
+ productRef: string;
1898
+ productName: string;
1899
+ productType: string;
1900
+ revenue: number;
1901
+ costs: number;
1902
+ grossProfit?: Record<string, never> | null;
1903
+ share: number;
1904
+ estimatedARR: number;
1905
+ transactionCount: number;
1906
+ };
1907
+ TopProductDto: {
1908
+ name: string;
1909
+ revenue: number;
1910
+ };
1911
+ RevenueByProductResponseDto: {
1912
+ products: components["schemas"]["ProductRevenueRowDto"][];
1913
+ activeProductCount: number;
1914
+ totalMRR: number;
1915
+ topProduct?: components["schemas"]["TopProductDto"] | null;
1916
+ /**
1917
+ * ISO 4217 currency code
1918
+ * @example SEK
1919
+ */
1920
+ currency: string;
1921
+ };
1922
+ LedgerEntryDto: {
1923
+ date: string;
1924
+ reference: string;
1925
+ description: string;
1926
+ type: string;
1927
+ direction: string;
1928
+ account: string;
1929
+ debit: number;
1930
+ credit: number;
1931
+ status: string;
1932
+ };
1933
+ LedgerResponseDto: {
1934
+ entries: components["schemas"]["LedgerEntryDto"][];
1935
+ total: number;
1936
+ totalCredit: number;
1937
+ totalDebit: number;
1938
+ /**
1939
+ * ISO 4217 currency code
1940
+ * @example SEK
1941
+ */
1942
+ currency: string;
1943
+ };
1815
1944
  /** @description Auto-generated fallback schema for unresolved reference: McpBootstrapPreviewValidationError */
1816
1945
  McpBootstrapPreviewValidationError: {
1817
1946
  [key: string]: unknown;
@@ -1823,6 +1952,1214 @@ interface components {
1823
1952
  headers: never;
1824
1953
  pathItems: never;
1825
1954
  }
1955
+ interface operations {
1956
+ PaymentIntentSdkController_getPaymentIntents: {
1957
+ parameters: {
1958
+ query?: {
1959
+ /** @description Maximum number of results */
1960
+ limit?: number;
1961
+ /** @description Pagination offset */
1962
+ offset?: number;
1963
+ };
1964
+ header?: never;
1965
+ path?: never;
1966
+ cookie?: never;
1967
+ };
1968
+ requestBody?: never;
1969
+ responses: {
1970
+ /** @description Payment intents retrieved successfully */
1971
+ 200: {
1972
+ headers: {
1973
+ [name: string]: unknown;
1974
+ };
1975
+ content: {
1976
+ "application/json": unknown;
1977
+ };
1978
+ };
1979
+ };
1980
+ };
1981
+ PaymentIntentSdkController_createPaymentIntent: {
1982
+ parameters: {
1983
+ query?: never;
1984
+ header: {
1985
+ /** @description Unique idempotency key to prevent duplicate payments (required) */
1986
+ "idempotency-key": string;
1987
+ };
1988
+ path?: never;
1989
+ cookie?: never;
1990
+ };
1991
+ /** @description Payment intent creation data */
1992
+ requestBody: {
1993
+ content: {
1994
+ "application/json": {
1995
+ /**
1996
+ * Plan reference to purchase
1997
+ * @example pln_2b3c4d5e6f7g
1998
+ */
1999
+ planRef: string;
2000
+ /**
2001
+ * Product reference that owns the plan
2002
+ * @example prd_1A2B3C4D
2003
+ */
2004
+ productRef: string;
2005
+ /**
2006
+ * Customer reference identifier
2007
+ * @example cus_3c4d5e6f7g8h
2008
+ */
2009
+ customerReference: string;
2010
+ /**
2011
+ * Name of the pricing tier to purchase (for plans with pricingTiers). If not specified, uses the plan base price.
2012
+ * @example Pro
2013
+ */
2014
+ pricingTier?: string;
2015
+ };
2016
+ };
2017
+ };
2018
+ responses: {
2019
+ /** @description Payment intent created successfully */
2020
+ 201: {
2021
+ headers: {
2022
+ [name: string]: unknown;
2023
+ };
2024
+ content: {
2025
+ "application/json": unknown;
2026
+ };
2027
+ };
2028
+ /** @description Missing required fields or invalid data */
2029
+ 400: {
2030
+ headers: {
2031
+ [name: string]: unknown;
2032
+ };
2033
+ content: {
2034
+ "application/json": unknown;
2035
+ };
2036
+ };
2037
+ };
2038
+ };
2039
+ PaymentIntentSdkController_getPaymentIntent: {
2040
+ parameters: {
2041
+ query?: never;
2042
+ header?: never;
2043
+ path: {
2044
+ /** @description Payment intent MongoDB ID */
2045
+ id: string;
2046
+ };
2047
+ cookie?: never;
2048
+ };
2049
+ requestBody?: never;
2050
+ responses: {
2051
+ /** @description Payment intent retrieved successfully */
2052
+ 200: {
2053
+ headers: {
2054
+ [name: string]: unknown;
2055
+ };
2056
+ content: {
2057
+ "application/json": unknown;
2058
+ };
2059
+ };
2060
+ /** @description Payment intent not found */
2061
+ 404: {
2062
+ headers: {
2063
+ [name: string]: unknown;
2064
+ };
2065
+ content: {
2066
+ "application/json": unknown;
2067
+ };
2068
+ };
2069
+ };
2070
+ };
2071
+ PaymentIntentSdkController_processPaymentIntent: {
2072
+ parameters: {
2073
+ query?: never;
2074
+ header?: never;
2075
+ path: {
2076
+ /** @description Stripe payment intent ID (format: pi_xxx) */
2077
+ id: string;
2078
+ };
2079
+ cookie?: never;
2080
+ };
2081
+ /** @description Payment processing data */
2082
+ requestBody: {
2083
+ content: {
2084
+ "application/json": {
2085
+ /**
2086
+ * Product reference that owns the plan
2087
+ * @example prd_123
2088
+ */
2089
+ productRef: string;
2090
+ /**
2091
+ * Customer reference identifier
2092
+ * @example cus_456
2093
+ */
2094
+ customerRef: string;
2095
+ /**
2096
+ * Plan reference - helps determine if payment is for purchase
2097
+ * @example pln_789
2098
+ */
2099
+ planRef?: string;
2100
+ };
2101
+ };
2102
+ };
2103
+ responses: {
2104
+ /** @description Payment intent status */
2105
+ 200: {
2106
+ headers: {
2107
+ [name: string]: unknown;
2108
+ };
2109
+ content: {
2110
+ "application/json": {
2111
+ /**
2112
+ * Payment intent status
2113
+ * @example succeeded
2114
+ * @enum {string}
2115
+ */
2116
+ status?: "succeeded" | "timeout" | "failed" | "cancelled";
2117
+ /**
2118
+ * Optional message, only present for timeout status
2119
+ * @example Timeout while waiting for payment intent confirmation, try again later. This could be due to Stripe webhooks not being configured correctly.
2120
+ */
2121
+ message?: string;
2122
+ };
2123
+ };
2124
+ };
2125
+ /** @description Payment not succeeded, invalid request, or forbidden */
2126
+ 400: {
2127
+ headers: {
2128
+ [name: string]: unknown;
2129
+ };
2130
+ content: {
2131
+ "application/json": unknown;
2132
+ };
2133
+ };
2134
+ };
2135
+ };
2136
+ CheckoutSessionSdkController_createCheckoutSession: {
2137
+ parameters: {
2138
+ query?: never;
2139
+ header?: never;
2140
+ path?: never;
2141
+ cookie?: never;
2142
+ };
2143
+ requestBody: {
2144
+ content: {
2145
+ "application/json": components["schemas"]["CreateCheckoutSessionRequest"];
2146
+ };
2147
+ };
2148
+ responses: {
2149
+ /** @description Checkout session created */
2150
+ 201: {
2151
+ headers: {
2152
+ [name: string]: unknown;
2153
+ };
2154
+ content: {
2155
+ "application/json": components["schemas"]["CreateCheckoutSessionResponse"];
2156
+ };
2157
+ };
2158
+ /** @description Missing customerRef or productRef */
2159
+ 400: {
2160
+ headers: {
2161
+ [name: string]: unknown;
2162
+ };
2163
+ content?: never;
2164
+ };
2165
+ };
2166
+ };
2167
+ PlanSdkController_listPlans: {
2168
+ parameters: {
2169
+ query?: {
2170
+ limit?: number;
2171
+ offset?: number;
2172
+ };
2173
+ header?: never;
2174
+ path: {
2175
+ /** @description Product reference or ID */
2176
+ productRef: string;
2177
+ };
2178
+ cookie?: never;
2179
+ };
2180
+ requestBody?: never;
2181
+ responses: {
2182
+ /** @description Plans retrieved successfully */
2183
+ 200: {
2184
+ headers: {
2185
+ [name: string]: unknown;
2186
+ };
2187
+ content: {
2188
+ "application/json": {
2189
+ plans?: components["schemas"]["Plan"][];
2190
+ /** @description Total number of plans for the product */
2191
+ total?: number;
2192
+ limit?: number;
2193
+ offset?: number;
2194
+ };
2195
+ };
2196
+ };
2197
+ /** @description Product not found */
2198
+ 404: {
2199
+ headers: {
2200
+ [name: string]: unknown;
2201
+ };
2202
+ content?: never;
2203
+ };
2204
+ };
2205
+ };
2206
+ PlanSdkController_createPlan: {
2207
+ parameters: {
2208
+ query?: never;
2209
+ header?: never;
2210
+ path: {
2211
+ /** @description Product reference or ID */
2212
+ productRef: string;
2213
+ };
2214
+ cookie?: never;
2215
+ };
2216
+ requestBody: {
2217
+ content: {
2218
+ "application/json": components["schemas"]["CreatePlanRequest"];
2219
+ };
2220
+ };
2221
+ responses: {
2222
+ /** @description Plan created successfully */
2223
+ 201: {
2224
+ headers: {
2225
+ [name: string]: unknown;
2226
+ };
2227
+ content: {
2228
+ "application/json": components["schemas"]["Plan"];
2229
+ };
2230
+ };
2231
+ /** @description Product not found */
2232
+ 404: {
2233
+ headers: {
2234
+ [name: string]: unknown;
2235
+ };
2236
+ content?: never;
2237
+ };
2238
+ };
2239
+ };
2240
+ PlanSdkController_getPlan: {
2241
+ parameters: {
2242
+ query?: never;
2243
+ header?: never;
2244
+ path: {
2245
+ /** @description Product reference or ID */
2246
+ productRef: string;
2247
+ /** @description Plan reference or ID */
2248
+ planRef: string;
2249
+ };
2250
+ cookie?: never;
2251
+ };
2252
+ requestBody?: never;
2253
+ responses: {
2254
+ /** @description Plan retrieved successfully */
2255
+ 200: {
2256
+ headers: {
2257
+ [name: string]: unknown;
2258
+ };
2259
+ content: {
2260
+ "application/json": components["schemas"]["Plan"];
2261
+ };
2262
+ };
2263
+ /** @description Plan or product not found */
2264
+ 404: {
2265
+ headers: {
2266
+ [name: string]: unknown;
2267
+ };
2268
+ content?: never;
2269
+ };
2270
+ };
2271
+ };
2272
+ PlanSdkController_updatePlan: {
2273
+ parameters: {
2274
+ query?: never;
2275
+ header?: never;
2276
+ path: {
2277
+ /** @description Product reference or ID */
2278
+ productRef: string;
2279
+ /** @description Plan reference or ID */
2280
+ planRef: string;
2281
+ };
2282
+ cookie?: never;
2283
+ };
2284
+ requestBody: {
2285
+ content: {
2286
+ "application/json": components["schemas"]["UpdatePlanRequest"];
2287
+ };
2288
+ };
2289
+ responses: {
2290
+ /** @description Plan updated successfully */
2291
+ 200: {
2292
+ headers: {
2293
+ [name: string]: unknown;
2294
+ };
2295
+ content: {
2296
+ "application/json": components["schemas"]["Plan"];
2297
+ };
2298
+ };
2299
+ /** @description Plan or product not found */
2300
+ 404: {
2301
+ headers: {
2302
+ [name: string]: unknown;
2303
+ };
2304
+ content?: never;
2305
+ };
2306
+ };
2307
+ };
2308
+ PlanSdkController_deletePlan: {
2309
+ parameters: {
2310
+ query?: never;
2311
+ header?: never;
2312
+ path: {
2313
+ /** @description Product reference or ID */
2314
+ productRef: string;
2315
+ /** @description Plan reference or ID */
2316
+ planRef: string;
2317
+ };
2318
+ cookie?: never;
2319
+ };
2320
+ requestBody?: never;
2321
+ responses: {
2322
+ /** @description Plan deleted successfully */
2323
+ 200: {
2324
+ headers: {
2325
+ [name: string]: unknown;
2326
+ };
2327
+ content?: never;
2328
+ };
2329
+ /** @description Plan or product not found */
2330
+ 404: {
2331
+ headers: {
2332
+ [name: string]: unknown;
2333
+ };
2334
+ content?: never;
2335
+ };
2336
+ };
2337
+ };
2338
+ ProductSdkController_listProducts: {
2339
+ parameters: {
2340
+ query?: {
2341
+ /** @description Max results (1-100) */
2342
+ limit?: number;
2343
+ /** @description Pagination offset */
2344
+ offset?: number;
2345
+ /** @description Search by name or description */
2346
+ search?: string;
2347
+ /** @description Filter by status */
2348
+ status?: "active" | "inactive" | "suspended";
2349
+ /** @description Filter MCP Pay products */
2350
+ isMcpPay?: boolean;
2351
+ };
2352
+ header?: never;
2353
+ path?: never;
2354
+ cookie?: never;
2355
+ };
2356
+ requestBody?: never;
2357
+ responses: {
2358
+ /** @description Products retrieved successfully */
2359
+ 200: {
2360
+ headers: {
2361
+ [name: string]: unknown;
2362
+ };
2363
+ content?: never;
2364
+ };
2365
+ };
2366
+ };
2367
+ ProductSdkController_createProduct: {
2368
+ parameters: {
2369
+ query?: never;
2370
+ header?: never;
2371
+ path?: never;
2372
+ cookie?: never;
2373
+ };
2374
+ requestBody: {
2375
+ content: {
2376
+ "application/json": components["schemas"]["CreateProductRequest"];
2377
+ };
2378
+ };
2379
+ responses: {
2380
+ /** @description Product created successfully */
2381
+ 201: {
2382
+ headers: {
2383
+ [name: string]: unknown;
2384
+ };
2385
+ content: {
2386
+ "application/json": components["schemas"]["SdkProductResponse"];
2387
+ };
2388
+ };
2389
+ /** @description Missing required fields or validation error */
2390
+ 400: {
2391
+ headers: {
2392
+ [name: string]: unknown;
2393
+ };
2394
+ content?: never;
2395
+ };
2396
+ };
2397
+ };
2398
+ ProductSdkController_getProduct: {
2399
+ parameters: {
2400
+ query?: never;
2401
+ header?: never;
2402
+ path: {
2403
+ /** @description Product reference or ID */
2404
+ productRef: string;
2405
+ };
2406
+ cookie?: never;
2407
+ };
2408
+ requestBody?: never;
2409
+ responses: {
2410
+ /** @description Product retrieved successfully */
2411
+ 200: {
2412
+ headers: {
2413
+ [name: string]: unknown;
2414
+ };
2415
+ content: {
2416
+ "application/json": components["schemas"]["SdkProductResponse"];
2417
+ };
2418
+ };
2419
+ /** @description Product not found */
2420
+ 404: {
2421
+ headers: {
2422
+ [name: string]: unknown;
2423
+ };
2424
+ content?: never;
2425
+ };
2426
+ };
2427
+ };
2428
+ ProductSdkController_updateProduct: {
2429
+ parameters: {
2430
+ query?: never;
2431
+ header?: never;
2432
+ path: {
2433
+ /** @description Product reference or ID */
2434
+ productRef: string;
2435
+ };
2436
+ cookie?: never;
2437
+ };
2438
+ requestBody: {
2439
+ content: {
2440
+ "application/json": components["schemas"]["UpdateProductRequest"];
2441
+ };
2442
+ };
2443
+ responses: {
2444
+ /** @description Product updated successfully */
2445
+ 200: {
2446
+ headers: {
2447
+ [name: string]: unknown;
2448
+ };
2449
+ content: {
2450
+ "application/json": components["schemas"]["SdkProductResponse"];
2451
+ };
2452
+ };
2453
+ /** @description Product not found */
2454
+ 404: {
2455
+ headers: {
2456
+ [name: string]: unknown;
2457
+ };
2458
+ content?: never;
2459
+ };
2460
+ };
2461
+ };
2462
+ ProductSdkController_deleteProduct: {
2463
+ parameters: {
2464
+ query?: never;
2465
+ header?: never;
2466
+ path: {
2467
+ /** @description Product reference or ID */
2468
+ productRef: string;
2469
+ };
2470
+ cookie?: never;
2471
+ };
2472
+ requestBody?: never;
2473
+ responses: {
2474
+ /** @description Product deleted or deactivated successfully */
2475
+ 200: {
2476
+ headers: {
2477
+ [name: string]: unknown;
2478
+ };
2479
+ content?: never;
2480
+ };
2481
+ /** @description Product not found */
2482
+ 404: {
2483
+ headers: {
2484
+ [name: string]: unknown;
2485
+ };
2486
+ content?: never;
2487
+ };
2488
+ };
2489
+ };
2490
+ ProductSdkController_bootstrapMcpProduct: {
2491
+ parameters: {
2492
+ query?: never;
2493
+ header?: never;
2494
+ path?: never;
2495
+ cookie?: never;
2496
+ };
2497
+ requestBody: {
2498
+ content: {
2499
+ "application/json": components["schemas"]["McpBootstrapRequest"];
2500
+ };
2501
+ };
2502
+ responses: {
2503
+ /** @description MCP product bootstrapped successfully */
2504
+ 201: {
2505
+ headers: {
2506
+ [name: string]: unknown;
2507
+ };
2508
+ content: {
2509
+ "application/json": components["schemas"]["McpBootstrapResult"];
2510
+ };
2511
+ };
2512
+ /** @description Invalid bootstrap request */
2513
+ 400: {
2514
+ headers: {
2515
+ [name: string]: unknown;
2516
+ };
2517
+ content?: never;
2518
+ };
2519
+ };
2520
+ };
2521
+ ProductSdkController_cloneProduct: {
2522
+ parameters: {
2523
+ query?: never;
2524
+ header?: never;
2525
+ path: {
2526
+ /** @description Product reference or ID to clone */
2527
+ productRef: string;
2528
+ };
2529
+ cookie?: never;
2530
+ };
2531
+ requestBody?: never;
2532
+ responses: {
2533
+ /** @description Product cloned successfully */
2534
+ 201: {
2535
+ headers: {
2536
+ [name: string]: unknown;
2537
+ };
2538
+ content: {
2539
+ "application/json": components["schemas"]["SdkProductResponse"];
2540
+ };
2541
+ };
2542
+ /** @description Product not found */
2543
+ 404: {
2544
+ headers: {
2545
+ [name: string]: unknown;
2546
+ };
2547
+ content?: never;
2548
+ };
2549
+ };
2550
+ };
2551
+ UsageSdkController_recordUsage: {
2552
+ parameters: {
2553
+ query?: never;
2554
+ header?: never;
2555
+ path?: never;
2556
+ cookie?: never;
2557
+ };
2558
+ requestBody: {
2559
+ content: {
2560
+ "application/json": {
2561
+ /**
2562
+ * Customer identifier
2563
+ * @example cus_3C4D5E6F
2564
+ */
2565
+ customerId: string;
2566
+ /**
2567
+ * Action type (default: api_call)
2568
+ * @example api_call
2569
+ * @enum {string}
2570
+ */
2571
+ actionType?: "transaction" | "api_call" | "hour" | "email" | "storage" | "custom";
2572
+ /**
2573
+ * Number of usage units (default: 1)
2574
+ * @example 1
2575
+ */
2576
+ units?: number;
2577
+ /** @description Product reference */
2578
+ productReference?: string;
2579
+ /** @description Purchase reference */
2580
+ purchaseReference?: string;
2581
+ /**
2582
+ * Outcome (default: success)
2583
+ * @enum {string}
2584
+ */
2585
+ outcome?: "success" | "paywall" | "fail";
2586
+ /** @description Arbitrary event properties */
2587
+ metadata?: {
2588
+ [key: string]: unknown;
2589
+ };
2590
+ /**
2591
+ * Format: date-time
2592
+ * @description ISO 8601 timestamp (defaults to now)
2593
+ */
2594
+ timestamp?: string;
2595
+ /** @description Unique key to prevent duplicate recording (max 256 chars) */
2596
+ idempotencyKey?: string;
2597
+ };
2598
+ };
2599
+ };
2600
+ responses: {
2601
+ /** @description Usage recorded successfully */
2602
+ 200: {
2603
+ headers: {
2604
+ [name: string]: unknown;
2605
+ };
2606
+ content: {
2607
+ "application/json": {
2608
+ /** @example true */
2609
+ success?: boolean;
2610
+ /** @example usage_A1B2C3D4 */
2611
+ reference?: string;
2612
+ };
2613
+ };
2614
+ };
2615
+ /** @description Validation failed */
2616
+ 400: {
2617
+ headers: {
2618
+ [name: string]: unknown;
2619
+ };
2620
+ content?: never;
2621
+ };
2622
+ };
2623
+ };
2624
+ UsageSdkController_recordBulkUsage: {
2625
+ parameters: {
2626
+ query?: never;
2627
+ header?: never;
2628
+ path?: never;
2629
+ cookie?: never;
2630
+ };
2631
+ requestBody: {
2632
+ content: {
2633
+ "application/json": {
2634
+ events: {
2635
+ customerId: string;
2636
+ /** @enum {string} */
2637
+ actionType?: "transaction" | "api_call" | "hour" | "email" | "storage" | "custom";
2638
+ units?: number;
2639
+ productReference?: string;
2640
+ purchaseReference?: string;
2641
+ /** @enum {string} */
2642
+ outcome?: "success" | "paywall" | "fail";
2643
+ metadata?: {
2644
+ [key: string]: unknown;
2645
+ };
2646
+ /** Format: date-time */
2647
+ timestamp?: string;
2648
+ idempotencyKey?: string;
2649
+ }[];
2650
+ };
2651
+ };
2652
+ };
2653
+ responses: {
2654
+ /** @description Bulk usage events processed */
2655
+ 200: {
2656
+ headers: {
2657
+ [name: string]: unknown;
2658
+ };
2659
+ content?: never;
2660
+ };
2661
+ /** @description Validation failed */
2662
+ 400: {
2663
+ headers: {
2664
+ [name: string]: unknown;
2665
+ };
2666
+ content?: never;
2667
+ };
2668
+ };
2669
+ };
2670
+ MeterEventsSdkController_recordEvent: {
2671
+ parameters: {
2672
+ query?: never;
2673
+ header?: never;
2674
+ path?: never;
2675
+ cookie?: never;
2676
+ };
2677
+ requestBody: {
2678
+ content: {
2679
+ "application/json": components["schemas"]["RecordMeterEventDto"];
2680
+ };
2681
+ };
2682
+ responses: {
2683
+ /** @description Event recorded */
2684
+ 200: {
2685
+ headers: {
2686
+ [name: string]: unknown;
2687
+ };
2688
+ content: {
2689
+ "application/json": {
2690
+ /** @example true */
2691
+ success?: boolean;
2692
+ };
2693
+ };
2694
+ };
2695
+ /** @description Invalid meter name or meter is archived */
2696
+ 400: {
2697
+ headers: {
2698
+ [name: string]: unknown;
2699
+ };
2700
+ content?: never;
2701
+ };
2702
+ };
2703
+ };
2704
+ MeterEventsSdkController_recordBulkEvents: {
2705
+ parameters: {
2706
+ query?: never;
2707
+ header?: never;
2708
+ path?: never;
2709
+ cookie?: never;
2710
+ };
2711
+ requestBody: {
2712
+ content: {
2713
+ "application/json": components["schemas"]["RecordBulkMeterEventsDto"];
2714
+ };
2715
+ };
2716
+ responses: {
2717
+ /** @description Events recorded */
2718
+ 200: {
2719
+ headers: {
2720
+ [name: string]: unknown;
2721
+ };
2722
+ content: {
2723
+ "application/json": {
2724
+ /** @example true */
2725
+ success?: boolean;
2726
+ /** @example 50 */
2727
+ inserted?: number;
2728
+ };
2729
+ };
2730
+ };
2731
+ /** @description Invalid meter name or meter is archived */
2732
+ 400: {
2733
+ headers: {
2734
+ [name: string]: unknown;
2735
+ };
2736
+ content?: never;
2737
+ };
2738
+ };
2739
+ };
2740
+ CustomerSdkController_getCustomerByQuery: {
2741
+ parameters: {
2742
+ query?: {
2743
+ /** @description Customer reference identifier (use exactly one query parameter) */
2744
+ reference?: string;
2745
+ /** @description External reference ID from your auth system (use exactly one query parameter) */
2746
+ externalRef?: string;
2747
+ /** @description Customer email address (use exactly one query parameter) */
2748
+ email?: string;
2749
+ };
2750
+ header?: never;
2751
+ path?: never;
2752
+ cookie?: never;
2753
+ };
2754
+ requestBody?: never;
2755
+ responses: {
2756
+ /** @description Customer retrieved successfully */
2757
+ 200: {
2758
+ headers: {
2759
+ [name: string]: unknown;
2760
+ };
2761
+ content: {
2762
+ "application/json": components["schemas"]["CustomerResponse"];
2763
+ };
2764
+ };
2765
+ /** @description Invalid request - must provide exactly one of reference, externalRef, or email */
2766
+ 400: {
2767
+ headers: {
2768
+ [name: string]: unknown;
2769
+ };
2770
+ content: {
2771
+ "application/json": unknown;
2772
+ };
2773
+ };
2774
+ /** @description Customer not found */
2775
+ 404: {
2776
+ headers: {
2777
+ [name: string]: unknown;
2778
+ };
2779
+ content: {
2780
+ "application/json": unknown;
2781
+ };
2782
+ };
2783
+ };
2784
+ };
2785
+ CustomerSdkController_createCustomer: {
2786
+ parameters: {
2787
+ query?: never;
2788
+ header?: never;
2789
+ path?: never;
2790
+ cookie?: never;
2791
+ };
2792
+ /** @description Customer creation data */
2793
+ requestBody: {
2794
+ content: {
2795
+ "application/json": components["schemas"]["CreateCustomerRequest"];
2796
+ };
2797
+ };
2798
+ responses: {
2799
+ /** @description Customer created successfully */
2800
+ 201: {
2801
+ headers: {
2802
+ [name: string]: unknown;
2803
+ };
2804
+ content: {
2805
+ "application/json": components["schemas"]["CustomerResponse"];
2806
+ };
2807
+ };
2808
+ /** @description Invalid email or missing required fields */
2809
+ 400: {
2810
+ headers: {
2811
+ [name: string]: unknown;
2812
+ };
2813
+ content: {
2814
+ "application/json": unknown;
2815
+ };
2816
+ };
2817
+ };
2818
+ };
2819
+ CustomerSdkController_getCustomer: {
2820
+ parameters: {
2821
+ query?: never;
2822
+ header?: never;
2823
+ path: {
2824
+ /** @description Customer reference identifier */
2825
+ reference: string;
2826
+ };
2827
+ cookie?: never;
2828
+ };
2829
+ requestBody?: never;
2830
+ responses: {
2831
+ /** @description Customer retrieved successfully */
2832
+ 200: {
2833
+ headers: {
2834
+ [name: string]: unknown;
2835
+ };
2836
+ content: {
2837
+ "application/json": components["schemas"]["CustomerResponse"];
2838
+ };
2839
+ };
2840
+ /** @description Customer not found */
2841
+ 404: {
2842
+ headers: {
2843
+ [name: string]: unknown;
2844
+ };
2845
+ content: {
2846
+ "application/json": unknown;
2847
+ };
2848
+ };
2849
+ };
2850
+ };
2851
+ CustomerSdkController_createCustomerSession: {
2852
+ parameters: {
2853
+ query?: never;
2854
+ header?: never;
2855
+ path?: never;
2856
+ cookie?: never;
2857
+ };
2858
+ /** @description Customer session creation request data */
2859
+ requestBody: {
2860
+ content: {
2861
+ "application/json": components["schemas"]["CreateCustomerSessionRequest"];
2862
+ };
2863
+ };
2864
+ responses: {
2865
+ /** @description Customer session created successfully */
2866
+ 201: {
2867
+ headers: {
2868
+ [name: string]: unknown;
2869
+ };
2870
+ content: {
2871
+ "application/json": components["schemas"]["CreateCustomerSessionResponse"];
2872
+ };
2873
+ };
2874
+ /** @description Invalid request data or customer not found */
2875
+ 400: {
2876
+ headers: {
2877
+ [name: string]: unknown;
2878
+ };
2879
+ content: {
2880
+ "application/json": unknown;
2881
+ };
2882
+ };
2883
+ /** @description Customer not found */
2884
+ 404: {
2885
+ headers: {
2886
+ [name: string]: unknown;
2887
+ };
2888
+ content: {
2889
+ "application/json": unknown;
2890
+ };
2891
+ };
2892
+ };
2893
+ };
2894
+ CustomerSdkController_getCustomerSession: {
2895
+ parameters: {
2896
+ query?: never;
2897
+ header?: never;
2898
+ path: {
2899
+ /** @description Customer session ID/token */
2900
+ sessionId: string;
2901
+ };
2902
+ cookie?: never;
2903
+ };
2904
+ requestBody?: never;
2905
+ responses: {
2906
+ /** @description Customer session retrieved successfully */
2907
+ 200: {
2908
+ headers: {
2909
+ [name: string]: unknown;
2910
+ };
2911
+ content: {
2912
+ "application/json": components["schemas"]["GetCustomerSessionResponse"];
2913
+ };
2914
+ };
2915
+ /** @description Customer session not found */
2916
+ 404: {
2917
+ headers: {
2918
+ [name: string]: unknown;
2919
+ };
2920
+ content: {
2921
+ "application/json": unknown;
2922
+ };
2923
+ };
2924
+ };
2925
+ };
2926
+ UserInfoSdkController_getUserInfo: {
2927
+ parameters: {
2928
+ query?: never;
2929
+ header?: never;
2930
+ path?: never;
2931
+ cookie?: never;
2932
+ };
2933
+ requestBody: {
2934
+ content: {
2935
+ "application/json": components["schemas"]["UserInfoRequest"];
2936
+ };
2937
+ };
2938
+ responses: {
2939
+ /** @description User info with purchase status */
2940
+ 200: {
2941
+ headers: {
2942
+ [name: string]: unknown;
2943
+ };
2944
+ content: {
2945
+ "application/json": components["schemas"]["UserInfoResponse"];
2946
+ };
2947
+ };
2948
+ /** @description Missing customerRef or productRef */
2949
+ 400: {
2950
+ headers: {
2951
+ [name: string]: unknown;
2952
+ };
2953
+ content?: never;
2954
+ };
2955
+ /** @description Customer or product not found */
2956
+ 404: {
2957
+ headers: {
2958
+ [name: string]: unknown;
2959
+ };
2960
+ content?: never;
2961
+ };
2962
+ };
2963
+ };
2964
+ PurchaseSdkController_listPurchases: {
2965
+ parameters: {
2966
+ query?: {
2967
+ /** @description Filter by purchase status */
2968
+ status?: "pending" | "active" | "trialing" | "past_due" | "cancelled" | "expired" | "suspended" | "refunded";
2969
+ /** @description Filter by product ID */
2970
+ productId?: string;
2971
+ /** @description Filter by customer ID */
2972
+ customerId?: string;
2973
+ };
2974
+ header?: never;
2975
+ path?: never;
2976
+ cookie?: never;
2977
+ };
2978
+ requestBody?: never;
2979
+ responses: {
2980
+ /** @description Purchases retrieved successfully */
2981
+ 200: {
2982
+ headers: {
2983
+ [name: string]: unknown;
2984
+ };
2985
+ content: {
2986
+ "application/json": {
2987
+ purchases?: components["schemas"]["PurchaseResponse"][];
2988
+ };
2989
+ };
2990
+ };
2991
+ };
2992
+ };
2993
+ PurchaseSdkController_getPurchasesForCustomer: {
2994
+ parameters: {
2995
+ query?: never;
2996
+ header?: never;
2997
+ path: {
2998
+ /** @description Customer reference or ID */
2999
+ customerRef: string;
3000
+ };
3001
+ cookie?: never;
3002
+ };
3003
+ requestBody?: never;
3004
+ responses: {
3005
+ /** @description Customer purchases retrieved successfully */
3006
+ 200: {
3007
+ headers: {
3008
+ [name: string]: unknown;
3009
+ };
3010
+ content: {
3011
+ "application/json": {
3012
+ purchases?: components["schemas"]["PurchaseResponse"][];
3013
+ };
3014
+ };
3015
+ };
3016
+ /** @description Customer not found */
3017
+ 404: {
3018
+ headers: {
3019
+ [name: string]: unknown;
3020
+ };
3021
+ content?: never;
3022
+ };
3023
+ };
3024
+ };
3025
+ PurchaseSdkController_getPurchasesForProduct: {
3026
+ parameters: {
3027
+ query?: never;
3028
+ header?: never;
3029
+ path: {
3030
+ /** @description Product reference or ID */
3031
+ productRef: string;
3032
+ };
3033
+ cookie?: never;
3034
+ };
3035
+ requestBody?: never;
3036
+ responses: {
3037
+ /** @description Product purchases retrieved successfully */
3038
+ 200: {
3039
+ headers: {
3040
+ [name: string]: unknown;
3041
+ };
3042
+ content: {
3043
+ "application/json": {
3044
+ purchases?: components["schemas"]["PurchaseResponse"][];
3045
+ };
3046
+ };
3047
+ };
3048
+ /** @description Product not found */
3049
+ 404: {
3050
+ headers: {
3051
+ [name: string]: unknown;
3052
+ };
3053
+ content?: never;
3054
+ };
3055
+ };
3056
+ };
3057
+ PurchaseSdkController_getPurchase: {
3058
+ parameters: {
3059
+ query?: never;
3060
+ header?: never;
3061
+ path: {
3062
+ /** @description Purchase ID or reference */
3063
+ id: string;
3064
+ };
3065
+ cookie?: never;
3066
+ };
3067
+ requestBody?: never;
3068
+ responses: {
3069
+ /** @description Purchase retrieved successfully */
3070
+ 200: {
3071
+ headers: {
3072
+ [name: string]: unknown;
3073
+ };
3074
+ content: {
3075
+ "application/json": components["schemas"]["PurchaseResponse"];
3076
+ };
3077
+ };
3078
+ /** @description Purchase not found */
3079
+ 404: {
3080
+ headers: {
3081
+ [name: string]: unknown;
3082
+ };
3083
+ content?: never;
3084
+ };
3085
+ };
3086
+ };
3087
+ PurchaseSdkController_cancelPurchase: {
3088
+ parameters: {
3089
+ query?: never;
3090
+ header?: never;
3091
+ path: {
3092
+ /** @description Purchase reference or ID */
3093
+ purchaseRef: string;
3094
+ };
3095
+ cookie?: never;
3096
+ };
3097
+ requestBody: {
3098
+ content: {
3099
+ "application/json": components["schemas"]["CancelPurchaseRequest"];
3100
+ };
3101
+ };
3102
+ responses: {
3103
+ /** @description Purchase cancelled successfully */
3104
+ 200: {
3105
+ headers: {
3106
+ [name: string]: unknown;
3107
+ };
3108
+ content: {
3109
+ "application/json": {
3110
+ success?: boolean;
3111
+ purchase?: components["schemas"]["PurchaseResponse"];
3112
+ };
3113
+ };
3114
+ };
3115
+ /** @description Purchase not found */
3116
+ 404: {
3117
+ headers: {
3118
+ [name: string]: unknown;
3119
+ };
3120
+ content?: never;
3121
+ };
3122
+ };
3123
+ };
3124
+ LimitsSdkController_checkLimits: {
3125
+ parameters: {
3126
+ query?: never;
3127
+ header?: never;
3128
+ path?: never;
3129
+ cookie?: never;
3130
+ };
3131
+ requestBody: {
3132
+ content: {
3133
+ "application/json": components["schemas"]["CheckLimitRequest"];
3134
+ };
3135
+ };
3136
+ responses: {
3137
+ /** @description Limit check result */
3138
+ 200: {
3139
+ headers: {
3140
+ [name: string]: unknown;
3141
+ };
3142
+ content: {
3143
+ "application/json": components["schemas"]["LimitResponse"];
3144
+ };
3145
+ };
3146
+ /** @description Missing customerRef or productRef */
3147
+ 400: {
3148
+ headers: {
3149
+ [name: string]: unknown;
3150
+ };
3151
+ content?: never;
3152
+ };
3153
+ /** @description Customer or product not found */
3154
+ 404: {
3155
+ headers: {
3156
+ [name: string]: unknown;
3157
+ };
3158
+ content?: never;
3159
+ };
3160
+ };
3161
+ };
3162
+ }
1826
3163
 
1827
3164
  /**
1828
3165
  * SolvaPay API Client Type Definitions
@@ -2038,7 +3375,7 @@ interface SolvaPayClient {
2038
3375
  customerRef: string;
2039
3376
  productRef: string;
2040
3377
  }): Promise<components['schemas']['UserInfoResponse']>;
2041
- createCheckoutSession(params: components['schemas']['CreateCheckoutSessionRequest']): Promise<components['schemas']['CheckoutSessionResponse']>;
3378
+ createCheckoutSession(params: operations['CheckoutSessionSdkController_createCheckoutSession']['requestBody']['content']['application/json']): Promise<components['schemas']['CheckoutSessionResponse']>;
2042
3379
  createCustomerSession(params: components['schemas']['CreateCustomerSessionRequest']): Promise<components['schemas']['CreateCustomerSessionResponse']>;
2043
3380
  }
2044
3381
 
@@ -2084,7 +3421,7 @@ interface PaywallToolResult {
2084
3421
  mimeType?: string;
2085
3422
  }>;
2086
3423
  isError?: boolean;
2087
- structuredContent?: PaywallStructuredContent;
3424
+ structuredContent?: PaywallStructuredContent | Record<string, unknown>;
2088
3425
  }
2089
3426
 
2090
3427
  /**
@@ -2126,6 +3463,16 @@ interface RetryOptions {
2126
3463
  */
2127
3464
  onRetry?: (error: Error, attempt: number) => void;
2128
3465
  }
3466
+ interface McpToolExtra {
3467
+ authInfo?: {
3468
+ token: string;
3469
+ clientId: string;
3470
+ scopes: string[];
3471
+ expiresAt?: number;
3472
+ extra?: Record<string, unknown>;
3473
+ };
3474
+ [key: string]: unknown;
3475
+ }
2129
3476
  /**
2130
3477
  * Options for configuring payable protection
2131
3478
  */
@@ -2196,7 +3543,7 @@ interface McpAdapterOptions {
2196
3543
  /**
2197
3544
  * Extract customer reference from MCP args
2198
3545
  */
2199
- getCustomerRef?: (args: any) => string | Promise<string>;
3546
+ getCustomerRef?: (args: any, extra?: McpToolExtra) => string | Promise<string>;
2200
3547
  /**
2201
3548
  * Transform the response before wrapping in MCP format
2202
3549
  */
@@ -2273,7 +3620,7 @@ interface VirtualToolsOptions {
2273
3620
  /** Product reference (required) */
2274
3621
  product: string;
2275
3622
  /** Extract customer reference from MCP tool args */
2276
- getCustomerRef: (args: Record<string, unknown>) => string;
3623
+ getCustomerRef: (args: Record<string, unknown>, extra?: McpToolExtra) => string;
2277
3624
  /** Tool names to exclude from registration (optional) */
2278
3625
  exclude?: string[];
2279
3626
  }
@@ -2285,7 +3632,7 @@ interface VirtualToolDefinition {
2285
3632
  properties: Record<string, object>;
2286
3633
  required: string[];
2287
3634
  };
2288
- handler: (args: Record<string, unknown>) => Promise<{
3635
+ handler: (args: Record<string, unknown>, extra?: McpToolExtra) => Promise<{
2289
3636
  content: Array<{
2290
3637
  type: string;
2291
3638
  text: string;
@@ -2294,6 +3641,16 @@ interface VirtualToolDefinition {
2294
3641
  }>;
2295
3642
  }
2296
3643
 
3644
+ interface McpServerLike {
3645
+ registerTool: (name: string, config: Record<string, unknown>, handler: (args: Record<string, unknown>, extra?: McpToolExtra) => unknown) => unknown;
3646
+ }
3647
+ interface RegisterVirtualToolsMcpOptions extends Omit<VirtualToolsOptions, 'getCustomerRef'> {
3648
+ getCustomerRef?: VirtualToolsOptions['getCustomerRef'];
3649
+ filter?: (definition: VirtualToolDefinition) => boolean;
3650
+ mapDefinition?: (definition: VirtualToolDefinition) => VirtualToolDefinition;
3651
+ wrapHandler?: (handler: VirtualToolDefinition['handler'], definition: VirtualToolDefinition) => (args: Record<string, unknown>, extra?: McpToolExtra) => Promise<unknown> | unknown;
3652
+ }
3653
+
2297
3654
  /**
2298
3655
  * Configuration for creating a SolvaPay instance.
2299
3656
  *
@@ -2411,7 +3768,7 @@ interface PayableFunction {
2411
3768
  * });
2412
3769
  * ```
2413
3770
  */
2414
- mcp<T = any>(businessLogic: (args: any) => Promise<T>, options?: McpAdapterOptions): (args: Record<string, unknown>) => Promise<unknown>;
3771
+ mcp<T = any>(businessLogic: (args: any) => Promise<T>, options?: McpAdapterOptions): (args: Record<string, unknown>, extra?: McpToolExtra) => Promise<unknown>;
2415
3772
  /**
2416
3773
  * Pure function adapter for direct function protection.
2417
3774
  *
@@ -2803,7 +4160,7 @@ interface SolvaPay {
2803
4160
  * ```typescript
2804
4161
  * const virtualTools = solvaPay.getVirtualTools({
2805
4162
  * product: 'prd_myapi',
2806
- * getCustomerRef: args => args._auth?.customer_ref || 'anonymous',
4163
+ * getCustomerRef: (_args, extra) => String(extra?.authInfo?.extra?.customer_ref || 'anonymous'),
2807
4164
  * });
2808
4165
  *
2809
4166
  * // Register on your MCP server
@@ -2813,6 +4170,13 @@ interface SolvaPay {
2813
4170
  * ```
2814
4171
  */
2815
4172
  getVirtualTools(options: VirtualToolsOptions): VirtualToolDefinition[];
4173
+ /**
4174
+ * Register virtual tools directly on an MCP server with one call.
4175
+ *
4176
+ * This helper converts virtual tool JSON schemas to Zod schemas and registers
4177
+ * each tool on an MCP server that supports `registerTool()`.
4178
+ */
4179
+ registerVirtualToolsMcp(server: McpServerLike, options: RegisterVirtualToolsMcpOptions): Promise<void>;
2816
4180
  /**
2817
4181
  * Direct access to the API client for advanced operations.
2818
4182
  *