@solvapay/server 1.0.0-preview.1 → 1.0.0-preview.10

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
@@ -20,8 +20,98 @@ interface components {
20
20
  UpdateConnectedAccount: Record<string, never>;
21
21
  CreatePlanRequest: Record<string, never>;
22
22
  UpdatePlanRequest: Record<string, never>;
23
+ CreateCustomerSessionRequest: {
24
+ /**
25
+ * @description Customer reference identifier
26
+ * @example cus_3c4d5e6f7g8h
27
+ */
28
+ customerRef: string;
29
+ };
30
+ CustomerSessionResponse: {
31
+ /**
32
+ * @description Customer session ID
33
+ * @example 507f1f77bcf86cd799439011
34
+ */
35
+ id: string;
36
+ /**
37
+ * @description Public session ID used in customer URL
38
+ * @example e3f1c2d4b6a89f001122334455667788
39
+ */
40
+ sessionId: string;
41
+ /**
42
+ * @description Session status
43
+ * @example active
44
+ */
45
+ status: string;
46
+ /**
47
+ * @description Customer URL to open the customer page
48
+ * @example https://solvapay.com/customer/manage?id=e3f1c2d4b6a89f001122334455667788
49
+ */
50
+ customerUrl: string;
51
+ };
23
52
  ExecuteAnalyticsQuery: Record<string, never>;
24
53
  ExecuteMultipleQueries: Record<string, never>;
54
+ CreateCheckoutSessionRequest: {
55
+ /**
56
+ * @description Customer reference identifier
57
+ * @example cus_3c4d5e6f7g8h
58
+ */
59
+ customerRef: string;
60
+ /**
61
+ * @description Agent reference identifier
62
+ * @example agt_1a2b3c4d5e6f
63
+ */
64
+ agentRef: string;
65
+ /**
66
+ * @description Plan reference identifier (optional)
67
+ * @example pln_2b3c4d5e6f7g
68
+ */
69
+ planRef?: string;
70
+ /**
71
+ * @description URL to redirect to after successful payment (optional)
72
+ * @example https://example.com/payment-success
73
+ */
74
+ returnUrl?: string;
75
+ };
76
+ CheckoutSessionResponse: {
77
+ /**
78
+ * @description Checkout session ID
79
+ * @example 507f1f77bcf86cd799439011
80
+ */
81
+ id: string;
82
+ /**
83
+ * @description Public session ID used in checkout URL
84
+ * @example a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6
85
+ */
86
+ sessionId: string;
87
+ /**
88
+ * @description Amount in cents
89
+ * @example 2999
90
+ */
91
+ amount: number;
92
+ /**
93
+ * @description Currency code
94
+ * @example USD
95
+ */
96
+ currency: string;
97
+ /**
98
+ * @description Session status
99
+ * @example active
100
+ */
101
+ status: string;
102
+ /**
103
+ * @description Checkout URL to open the checkout page
104
+ * @example https://solvapay.com/customer/checkout?id=a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6
105
+ */
106
+ checkoutUrl: string;
107
+ };
108
+ CancelSubscriptionRequest: {
109
+ /**
110
+ * @description Reason for cancellation
111
+ * @example Customer request
112
+ */
113
+ reason?: string;
114
+ };
25
115
  CheckLimitRequest: {
26
116
  /**
27
117
  * @description Customer reference identifier
@@ -46,8 +136,13 @@ interface components {
46
136
  */
47
137
  remaining: number;
48
138
  /**
49
- * @description Optional checkout URL if payment is required
50
- * @example https://checkout.solvapay.com/pay_1a2b3c4d
139
+ * @description Optional checkout session ID/token if payment is required
140
+ * @example e3f1c2d4b6a89f001122334455667788
141
+ */
142
+ checkoutSessionId?: string;
143
+ /**
144
+ * @description Optional full checkout URL if payment is required (based on backend configuration)
145
+ * @example https://app.solvapay.com/customer/checkout?id=e3f1c2d4b6a89f001122334455667788
51
146
  */
52
147
  checkoutUrl?: string;
53
148
  };
@@ -100,6 +195,11 @@ interface components {
100
195
  * @example John Doe
101
196
  */
102
197
  name?: string;
198
+ /**
199
+ * @description External reference ID from your auth system to map this customer to an auth user (optional)
200
+ * @example auth_user_12345
201
+ */
202
+ externalRef?: string;
103
203
  };
104
204
  SubscriptionInfo: {
105
205
  /**
@@ -127,6 +227,31 @@ interface components {
127
227
  * @example 2025-10-27T10:00:00Z
128
228
  */
129
229
  startDate: string;
230
+ /**
231
+ * @description Amount paid in original currency (in cents)
232
+ * @example 9900
233
+ */
234
+ amount: number;
235
+ /**
236
+ * @description Currency code
237
+ * @example USD
238
+ */
239
+ currency: string;
240
+ /**
241
+ * @description End date of subscription
242
+ * @example 2025-11-27T10:00:00Z
243
+ */
244
+ endDate?: string;
245
+ /**
246
+ * @description When subscription was cancelled
247
+ * @example 2025-10-28T10:00:00Z
248
+ */
249
+ cancelledAt?: string;
250
+ /**
251
+ * @description Reason for cancellation
252
+ * @example Customer request
253
+ */
254
+ cancellationReason?: string;
130
255
  };
131
256
  CustomerResponse: {
132
257
  /**
@@ -144,9 +269,61 @@ interface components {
144
269
  * @example customer@example.com
145
270
  */
146
271
  email: string;
272
+ /**
273
+ * @description External reference ID from your auth system (if set during creation or update)
274
+ * @example auth_user_12345
275
+ */
276
+ externalRef?: string;
147
277
  /** @description Active subscriptions */
148
278
  subscriptions?: components["schemas"]["SubscriptionInfo"][];
149
279
  };
280
+ CreateCustomerSessionResponse: {
281
+ /**
282
+ * @description Customer session ID/token
283
+ * @example e3f1c2d4b6a89f001122334455667788
284
+ */
285
+ sessionId: string;
286
+ /**
287
+ * @description Full customer URL based on backend configuration (ready to redirect customer)
288
+ * @example https://solvapay.com/customer/manage?id=e3f1c2d4b6a89f001122334455667788
289
+ */
290
+ customerUrl: string;
291
+ };
292
+ GetCustomerSessionResponse: {
293
+ /**
294
+ * @description Customer session ID/token
295
+ * @example e3f1c2d4b6a89f001122334455667788
296
+ */
297
+ sessionId: string;
298
+ /**
299
+ * @description Session status
300
+ * @example active
301
+ * @enum {string}
302
+ */
303
+ status: "active" | "expired" | "used";
304
+ /**
305
+ * @description Full customer URL based on backend configuration (ready to redirect customer)
306
+ * @example https://solvapay.com/customer/manage?id=e3f1c2d4b6a89f001122334455667788
307
+ */
308
+ customerUrl: string;
309
+ /**
310
+ * @description Session expiration date
311
+ * @example 2025-01-01T12:00:00.000Z
312
+ */
313
+ expiresAt: string;
314
+ /** @description Customer object from session data */
315
+ customer: components["schemas"]["CustomerResponse"];
316
+ /**
317
+ * @description Session creation date
318
+ * @example 2025-01-01T11:45:00.000Z
319
+ */
320
+ createdAt: string;
321
+ /**
322
+ * @description Session last update date
323
+ * @example 2025-01-01T11:45:00.000Z
324
+ */
325
+ updatedAt: string;
326
+ };
150
327
  Agent: Record<string, never>;
151
328
  CreateAgentRequest: Record<string, never>;
152
329
  UpdateAgentRequest: Record<string, never>;
@@ -257,12 +434,17 @@ interface components {
257
434
  */
258
435
  createdAt: string;
259
436
  };
260
- CancelSubscriptionRequest: {
437
+ CreateCheckoutSessionResponse: {
261
438
  /**
262
- * @description Reason for cancellation
263
- * @example Customer request
439
+ * @description Checkout session ID/token
440
+ * @example e3f1c2d4b6a89f001122334455667788
264
441
  */
265
- reason?: string;
442
+ sessionId: string;
443
+ /**
444
+ * @description Full checkout URL based on backend configuration (ready to redirect customer)
445
+ * @example https://solvapay.com/customer/checkout?id=e3f1c2d4b6a89f001122334455667788
446
+ */
447
+ checkoutUrl: string;
266
448
  };
267
449
  CreatePageSettings: {
268
450
  /** @description Page identifier */
@@ -324,13 +506,39 @@ type LimitResponseWithPlan = components['schemas']['LimitResponse'] & {
324
506
  };
325
507
  /**
326
508
  * Extended CustomerResponse with proper field mapping
509
+ *
510
+ * Note: The backend API may return subscriptions with additional fields beyond SubscriptionInfo
511
+ * (e.g., amount, endDate, cancelledAt, cancellationReason) as defined in SubscriptionResponse.
512
+ * These additional fields are preserved in the subscriptions array.
327
513
  */
328
514
  type CustomerResponseMapped = {
329
515
  customerRef: string;
330
516
  email?: string;
331
517
  name?: string;
518
+ externalRef?: string;
332
519
  plan?: string;
520
+ subscriptions?: Array<components['schemas']['SubscriptionInfo'] & Partial<Pick<components['schemas']['SubscriptionResponse'], 'amount' | 'currency' | 'endDate' | 'cancelledAt' | 'cancellationReason' | 'paidAt' | 'nextBillingDate'>>>;
333
521
  };
522
+ /**
523
+ * Purchase information returned from payment processing
524
+ */
525
+ interface PurchaseInfo {
526
+ reference: string;
527
+ productRef?: string;
528
+ amount: number;
529
+ currency: string;
530
+ creditsAdded?: number;
531
+ completedAt: string;
532
+ }
533
+ /**
534
+ * Result from processing a payment intent
535
+ */
536
+ interface ProcessPaymentResult {
537
+ type: 'subscription' | 'purchase';
538
+ subscription?: components['schemas']['SubscriptionInfo'];
539
+ purchase?: PurchaseInfo;
540
+ status: 'completed';
541
+ }
334
542
  /**
335
543
  * SolvaPay API Client Interface
336
544
  *
@@ -349,6 +557,9 @@ interface SolvaPayClient {
349
557
  getCustomer?(params: {
350
558
  customerRef: string;
351
559
  }): Promise<CustomerResponseMapped>;
560
+ getCustomerByExternalRef?(params: {
561
+ externalRef: string;
562
+ }): Promise<CustomerResponseMapped>;
352
563
  listAgents?(): Promise<Array<{
353
564
  reference: string;
354
565
  name: string;
@@ -362,9 +573,14 @@ interface SolvaPayClient {
362
573
  listPlans?(agentRef: string): Promise<Array<{
363
574
  reference: string;
364
575
  name: string;
576
+ description?: string;
577
+ price?: number;
578
+ currency?: string;
579
+ interval?: string;
365
580
  isFreeTier?: boolean;
366
581
  freeUnits?: number;
367
- description?: string;
582
+ metadata?: Record<string, any>;
583
+ [key: string]: any;
368
584
  }>>;
369
585
  createPlan?(params: components['schemas']['CreatePlanRequest'] & {
370
586
  agentRef: string;
@@ -384,6 +600,18 @@ interface SolvaPayClient {
384
600
  publishableKey: string;
385
601
  accountId?: string;
386
602
  }>;
603
+ cancelSubscription?(params: {
604
+ subscriptionRef: string;
605
+ reason?: string;
606
+ }): Promise<components['schemas']['SubscriptionResponse']>;
607
+ processPayment?(params: {
608
+ paymentIntentId: string;
609
+ agentRef: string;
610
+ customerRef: string;
611
+ planRef?: string;
612
+ }): Promise<ProcessPaymentResult>;
613
+ createCheckoutSession(params: components['schemas']['CreateCheckoutSessionRequest']): Promise<components['schemas']['CreateCheckoutSessionResponse']>;
614
+ createCustomerSession(params: components['schemas']['CreateCustomerSessionRequest']): Promise<components['schemas']['CreateCustomerSessionResponse']>;
387
615
  }
388
616
 
389
617
  /**
@@ -439,7 +667,7 @@ interface PaywallToolResult {
439
667
  /**
440
668
  * Retry configuration options
441
669
  */
442
- interface RetryOptions$1 {
670
+ interface RetryOptions {
443
671
  /**
444
672
  * Maximum number of retry attempts (default: 2)
445
673
  */
@@ -582,12 +810,6 @@ type ServerClientOptions = {
582
810
  */
583
811
  declare function createSolvaPayClient(opts: ServerClientOptions): SolvaPayClient;
584
812
 
585
- /**
586
- * SolvaPay Factory
587
- *
588
- * Main entry point for creating SolvaPay instances with the unified payable API
589
- */
590
-
591
813
  /**
592
814
  * Configuration for creating a SolvaPay instance
593
815
  */
@@ -638,8 +860,17 @@ interface SolvaPay {
638
860
  /**
639
861
  * Ensure customer exists (for testing/setup)
640
862
  * Only attempts creation once per customer (idempotent).
863
+ *
864
+ * @param customerRef - The customer reference used as a cache key (e.g., Supabase user ID)
865
+ * @param externalRef - Optional external reference for backend lookup (e.g., Supabase user ID)
866
+ * If provided, will lookup existing customer by externalRef before creating new one.
867
+ * The externalRef is stored on the SolvaPay backend for customer lookup.
868
+ * @param options - Optional customer details (email, name) for customer creation
641
869
  */
642
- ensureCustomer(customerRef: string): Promise<string>;
870
+ ensureCustomer(customerRef: string, externalRef?: string, options?: {
871
+ email?: string;
872
+ name?: string;
873
+ }): Promise<string>;
643
874
  /**
644
875
  * Create a payment intent for a customer to subscribe to a plan
645
876
  */
@@ -654,6 +885,16 @@ interface SolvaPay {
654
885
  publishableKey: string;
655
886
  accountId?: string;
656
887
  }>;
888
+ /**
889
+ * Process a payment intent after client-side confirmation
890
+ * Creates subscription or purchase immediately, eliminating webhook delay
891
+ */
892
+ processPayment(params: {
893
+ paymentIntentId: string;
894
+ agentRef: string;
895
+ customerRef: string;
896
+ planRef?: string;
897
+ }): Promise<ProcessPaymentResult>;
657
898
  /**
658
899
  * Check if customer is within usage limits
659
900
  */
@@ -690,14 +931,30 @@ interface SolvaPay {
690
931
  }>;
691
932
  /**
692
933
  * Get customer details
934
+ * Uses the generated CustomerResponseMapped type which includes all subscription fields from the API
693
935
  */
694
936
  getCustomer(params: {
695
937
  customerRef: string;
938
+ }): Promise<CustomerResponseMapped>;
939
+ /**
940
+ * Create a checkout session for a customer
941
+ */
942
+ createCheckoutSession(params: {
943
+ agentRef: string;
944
+ customerRef: string;
945
+ planRef?: string;
696
946
  }): Promise<{
947
+ sessionId: string;
948
+ checkoutUrl: string;
949
+ }>;
950
+ /**
951
+ * Create a customer session for accessing customer-specific functionality
952
+ */
953
+ createCustomerSession(params: {
697
954
  customerRef: string;
698
- email?: string;
699
- name?: string;
700
- plan?: string;
955
+ }): Promise<{
956
+ sessionId: string;
957
+ customerUrl: string;
701
958
  }>;
702
959
  /**
703
960
  * Direct access to the API client for advanced operations
@@ -708,12 +965,15 @@ interface SolvaPay {
708
965
  /**
709
966
  * Create a SolvaPay instance
710
967
  *
711
- * @param config - Configuration with either apiKey or apiClient
968
+ * @param config - Optional configuration with either apiKey or apiClient. If not provided, reads from environment variables.
712
969
  * @returns SolvaPay instance with payable() method
713
970
  *
714
971
  * @example
715
972
  * ```typescript
716
- * // Production: Pass API key
973
+ * // Production: Read from environment variables (recommended)
974
+ * const solvaPay = createSolvaPay();
975
+ *
976
+ * // Production: Pass API key explicitly
717
977
  * const solvaPay = createSolvaPay({
718
978
  * apiKey: process.env.SOLVAPAY_SECRET_KEY
719
979
  * });
@@ -729,7 +989,7 @@ interface SolvaPay {
729
989
  * export const POST = payable.next(createTask);
730
990
  * ```
731
991
  */
732
- declare function createSolvaPay(config: CreateSolvaPayConfig): SolvaPay;
992
+ declare function createSolvaPay(config?: CreateSolvaPayConfig): SolvaPay;
733
993
 
734
994
  /**
735
995
  * SolvaPay SDK - Universal Paywall Protection
@@ -748,39 +1008,7 @@ declare class PaywallError extends Error {
748
1008
  /**
749
1009
  * Utility functions for the SolvaPay Server SDK
750
1010
  */
751
- /**
752
- * Retry configuration options
753
- */
754
- interface RetryOptions {
755
- /**
756
- * Maximum number of retry attempts (default: 2)
757
- */
758
- maxRetries?: number;
759
- /**
760
- * Initial delay between retries in milliseconds (default: 500)
761
- */
762
- initialDelay?: number;
763
- /**
764
- * Backoff strategy for calculating delay between retries (default: 'fixed')
765
- * - 'fixed': Same delay between all retries
766
- * - 'linear': Delay increases linearly (initialDelay * attempt)
767
- * - 'exponential': Delay doubles each attempt (initialDelay * 2^(attempt-1))
768
- */
769
- backoffStrategy?: 'fixed' | 'linear' | 'exponential';
770
- /**
771
- * Optional function to determine if a retry should be attempted based on the error
772
- * @param error The error that was thrown
773
- * @param attempt The current attempt number (0-indexed)
774
- * @returns true if a retry should be attempted, false otherwise
775
- */
776
- shouldRetry?: (error: Error, attempt: number) => boolean;
777
- /**
778
- * Optional callback invoked before each retry attempt
779
- * @param error The error that triggered the retry
780
- * @param attempt The current attempt number (0-indexed)
781
- */
782
- onRetry?: (error: Error, attempt: number) => void;
783
- }
1011
+
784
1012
  /**
785
1013
  * Executes an async function with automatic retry logic
786
1014
  *
@@ -809,6 +1037,208 @@ interface RetryOptions {
809
1037
  */
810
1038
  declare function withRetry<T>(fn: () => Promise<T>, options?: RetryOptions): Promise<T>;
811
1039
 
1040
+ /**
1041
+ * Helper Types
1042
+ *
1043
+ * Shared types for route helpers
1044
+ */
1045
+ /**
1046
+ * Error result returned by core helpers
1047
+ */
1048
+ interface ErrorResult {
1049
+ error: string;
1050
+ status: number;
1051
+ details?: string;
1052
+ }
1053
+ /**
1054
+ * Authenticated user information
1055
+ */
1056
+ interface AuthenticatedUser {
1057
+ userId: string;
1058
+ email?: string | null;
1059
+ name?: string | null;
1060
+ }
1061
+
1062
+ /**
1063
+ * Error Handling Helper
1064
+ *
1065
+ * Generic error handling utilities for route helpers
1066
+ */
1067
+
1068
+ /**
1069
+ * Check if a result is an error result
1070
+ */
1071
+ declare function isErrorResult(result: unknown): result is ErrorResult;
1072
+ /**
1073
+ * Handle route errors and convert to ErrorResult
1074
+ */
1075
+ declare function handleRouteError(error: unknown, operationName: string, defaultMessage?: string): ErrorResult;
1076
+
1077
+ /**
1078
+ * Authentication Helper (Core)
1079
+ *
1080
+ * Generic helper for extracting authenticated user information from requests.
1081
+ * Works with standard Web API Request (works everywhere).
1082
+ */
1083
+
1084
+ /**
1085
+ * Extract authenticated user information from request
1086
+ *
1087
+ * This is a generic implementation that uses dynamic imports to avoid
1088
+ * requiring @solvapay/auth package at build time.
1089
+ *
1090
+ * @param request - Standard Web API Request
1091
+ * @param options - Configuration options
1092
+ * @returns Authenticated user info or error result
1093
+ */
1094
+ declare function getAuthenticatedUserCore(request: Request, options?: {
1095
+ includeEmail?: boolean;
1096
+ includeName?: boolean;
1097
+ }): Promise<AuthenticatedUser | ErrorResult>;
1098
+
1099
+ /**
1100
+ * Customer Helper (Core)
1101
+ *
1102
+ * Generic helper for syncing customers with SolvaPay backend.
1103
+ * Works with standard Web API Request (works everywhere).
1104
+ */
1105
+
1106
+ /**
1107
+ * Sync customer - ensure customer exists in SolvaPay backend
1108
+ *
1109
+ * Uses externalRef for consistent lookup and prevents duplicate customers.
1110
+ *
1111
+ * @param request - Standard Web API Request
1112
+ * @param options - Configuration options
1113
+ * @returns Customer reference or error result
1114
+ */
1115
+ declare function syncCustomerCore(request: Request, options?: {
1116
+ solvaPay?: SolvaPay;
1117
+ includeEmail?: boolean;
1118
+ includeName?: boolean;
1119
+ }): Promise<string | ErrorResult>;
1120
+
1121
+ /**
1122
+ * Create payment intent - core implementation
1123
+ *
1124
+ * @param request - Standard Web API Request
1125
+ * @param body - Payment intent parameters
1126
+ * @param options - Configuration options
1127
+ * @returns Payment intent response or error result
1128
+ */
1129
+ declare function createPaymentIntentCore(request: Request, body: {
1130
+ planRef: string;
1131
+ agentRef: string;
1132
+ }, options?: {
1133
+ solvaPay?: SolvaPay;
1134
+ includeEmail?: boolean;
1135
+ includeName?: boolean;
1136
+ }): Promise<{
1137
+ id: string;
1138
+ clientSecret: string;
1139
+ publishableKey: string;
1140
+ accountId?: string;
1141
+ customerRef: string;
1142
+ } | ErrorResult>;
1143
+ /**
1144
+ * Process payment - core implementation
1145
+ *
1146
+ * @param request - Standard Web API Request
1147
+ * @param body - Payment processing parameters
1148
+ * @param options - Configuration options
1149
+ * @returns Process payment result or error result
1150
+ */
1151
+ declare function processPaymentCore(request: Request, body: {
1152
+ paymentIntentId: string;
1153
+ agentRef: string;
1154
+ planRef?: string;
1155
+ }, options?: {
1156
+ solvaPay?: SolvaPay;
1157
+ }): Promise<ProcessPaymentResult | ErrorResult>;
1158
+
1159
+ /**
1160
+ * Checkout Helpers (Core)
1161
+ *
1162
+ * Generic helpers for checkout session operations.
1163
+ * Works with standard Web API Request (works everywhere).
1164
+ */
1165
+
1166
+ /**
1167
+ * Create checkout session - core implementation
1168
+ *
1169
+ * @param request - Standard Web API Request
1170
+ * @param body - Checkout session parameters
1171
+ * @param options - Configuration options
1172
+ * @returns Checkout session response or error result
1173
+ */
1174
+ declare function createCheckoutSessionCore(request: Request, body: {
1175
+ agentRef: string;
1176
+ planRef?: string;
1177
+ }, options?: {
1178
+ solvaPay?: SolvaPay;
1179
+ includeEmail?: boolean;
1180
+ includeName?: boolean;
1181
+ }): Promise<{
1182
+ sessionId: string;
1183
+ checkoutUrl: string;
1184
+ } | ErrorResult>;
1185
+ /**
1186
+ * Create customer session - core implementation
1187
+ *
1188
+ * @param request - Standard Web API Request
1189
+ * @param options - Configuration options
1190
+ * @returns Customer session response or error result
1191
+ */
1192
+ declare function createCustomerSessionCore(request: Request, options?: {
1193
+ solvaPay?: SolvaPay;
1194
+ includeEmail?: boolean;
1195
+ includeName?: boolean;
1196
+ }): Promise<{
1197
+ sessionId: string;
1198
+ customerUrl: string;
1199
+ } | ErrorResult>;
1200
+
1201
+ /**
1202
+ * Subscription Helpers (Core)
1203
+ *
1204
+ * Generic helpers for subscription operations.
1205
+ * Works with standard Web API Request (works everywhere).
1206
+ */
1207
+
1208
+ /**
1209
+ * Cancel subscription - core implementation
1210
+ *
1211
+ * @param request - Standard Web API Request
1212
+ * @param body - Cancellation parameters
1213
+ * @param options - Configuration options
1214
+ * @returns Cancelled subscription response or error result
1215
+ */
1216
+ declare function cancelSubscriptionCore(request: Request, body: {
1217
+ subscriptionRef: string;
1218
+ reason?: string;
1219
+ }, options?: {
1220
+ solvaPay?: SolvaPay;
1221
+ }): Promise<any | ErrorResult>;
1222
+
1223
+ /**
1224
+ * Plans Helper (Core)
1225
+ *
1226
+ * Generic helper for listing plans.
1227
+ * Works with standard Web API Request (works everywhere).
1228
+ * This is a public route - no authentication required.
1229
+ */
1230
+
1231
+ /**
1232
+ * List plans - core implementation
1233
+ *
1234
+ * @param request - Standard Web API Request
1235
+ * @returns Plans response or error result
1236
+ */
1237
+ declare function listPlansCore(request: Request): Promise<{
1238
+ plans: any[];
1239
+ agentRef: string;
1240
+ } | ErrorResult>;
1241
+
812
1242
  /**
813
1243
  * SolvaPay Server SDK - Edge Runtime Entry Point
814
1244
  *
@@ -842,4 +1272,4 @@ declare function verifyWebhook({ body, signature, secret }: {
842
1272
  secret: string;
843
1273
  }): Promise<any>;
844
1274
 
845
- export { type CreateSolvaPayConfig, type HttpAdapterOptions, type McpAdapterOptions, type NextAdapterOptions, type PayableFunction, type PayableOptions, type PaywallArgs, PaywallError, type PaywallMetadata, type PaywallStructuredContent, type PaywallToolResult, type RetryOptions$1 as RetryOptions, type ServerClientOptions, type SolvaPay, type SolvaPayClient, createSolvaPay, createSolvaPayClient, verifyWebhook, withRetry };
1275
+ export { type AuthenticatedUser, type CreateSolvaPayConfig, type ErrorResult, type HttpAdapterOptions, type McpAdapterOptions, type NextAdapterOptions, type PayableFunction, type PayableOptions, type PaywallArgs, PaywallError, type PaywallMetadata, type PaywallStructuredContent, type PaywallToolResult, type RetryOptions, type ServerClientOptions, type SolvaPay, type SolvaPayClient, cancelSubscriptionCore, createCheckoutSessionCore, createCustomerSessionCore, createPaymentIntentCore, createSolvaPay, createSolvaPayClient, getAuthenticatedUserCore, handleRouteError, isErrorResult, listPlansCore, processPaymentCore, syncCustomerCore, verifyWebhook, withRetry };