@better-auth/stripe 1.5.0-beta.8 → 1.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/README.md +17 -0
- package/dist/client.d.mts +52 -171
- package/dist/client.mjs +3 -2
- package/dist/client.mjs.map +1 -0
- package/dist/{error-codes-Clj-xYDP.mjs → error-codes-CCosYkXx.mjs} +4 -1
- package/dist/error-codes-CCosYkXx.mjs.map +1 -0
- package/dist/index.d.mts +519 -2
- package/dist/index.mjs +586 -232
- package/dist/index.mjs.map +1 -0
- package/dist/types-OT6L84x4.d.mts +480 -0
- package/package.json +28 -22
- package/.turbo/turbo-build.log +0 -17
- package/CHANGELOG.md +0 -24
- package/dist/index-BqGWQFAv.d.mts +0 -1015
- package/src/client.ts +0 -38
- package/src/error-codes.ts +0 -30
- package/src/hooks.ts +0 -435
- package/src/index.ts +0 -314
- package/src/middleware.ts +0 -104
- package/src/routes.ts +0 -1681
- package/src/schema.ts +0 -128
- package/src/types.ts +0 -449
- package/src/utils.ts +0 -70
- package/test/stripe-organization.test.ts +0 -1993
- package/test/stripe.test.ts +0 -4807
- package/tsconfig.json +0 -14
- package/tsdown.config.ts +0 -8
- package/vitest.config.ts +0 -8
|
@@ -1,1015 +0,0 @@
|
|
|
1
|
-
import * as better_auth0 from "better-auth";
|
|
2
|
-
import { GenericEndpointContext, InferOptionSchema, Session, User } from "better-auth";
|
|
3
|
-
import * as better_call0 from "better-call";
|
|
4
|
-
import * as zod0 from "zod";
|
|
5
|
-
import { Organization } from "better-auth/plugins/organization";
|
|
6
|
-
import Stripe from "stripe";
|
|
7
|
-
|
|
8
|
-
//#region src/schema.d.ts
|
|
9
|
-
declare const subscriptions: {
|
|
10
|
-
subscription: {
|
|
11
|
-
fields: {
|
|
12
|
-
plan: {
|
|
13
|
-
type: "string";
|
|
14
|
-
required: true;
|
|
15
|
-
};
|
|
16
|
-
referenceId: {
|
|
17
|
-
type: "string";
|
|
18
|
-
required: true;
|
|
19
|
-
};
|
|
20
|
-
stripeCustomerId: {
|
|
21
|
-
type: "string";
|
|
22
|
-
required: false;
|
|
23
|
-
};
|
|
24
|
-
stripeSubscriptionId: {
|
|
25
|
-
type: "string";
|
|
26
|
-
required: false;
|
|
27
|
-
};
|
|
28
|
-
status: {
|
|
29
|
-
type: "string";
|
|
30
|
-
defaultValue: string;
|
|
31
|
-
};
|
|
32
|
-
periodStart: {
|
|
33
|
-
type: "date";
|
|
34
|
-
required: false;
|
|
35
|
-
};
|
|
36
|
-
periodEnd: {
|
|
37
|
-
type: "date";
|
|
38
|
-
required: false;
|
|
39
|
-
};
|
|
40
|
-
trialStart: {
|
|
41
|
-
type: "date";
|
|
42
|
-
required: false;
|
|
43
|
-
};
|
|
44
|
-
trialEnd: {
|
|
45
|
-
type: "date";
|
|
46
|
-
required: false;
|
|
47
|
-
};
|
|
48
|
-
cancelAtPeriodEnd: {
|
|
49
|
-
type: "boolean";
|
|
50
|
-
required: false;
|
|
51
|
-
defaultValue: false;
|
|
52
|
-
};
|
|
53
|
-
cancelAt: {
|
|
54
|
-
type: "date";
|
|
55
|
-
required: false;
|
|
56
|
-
};
|
|
57
|
-
canceledAt: {
|
|
58
|
-
type: "date";
|
|
59
|
-
required: false;
|
|
60
|
-
};
|
|
61
|
-
endedAt: {
|
|
62
|
-
type: "date";
|
|
63
|
-
required: false;
|
|
64
|
-
};
|
|
65
|
-
seats: {
|
|
66
|
-
type: "number";
|
|
67
|
-
required: false;
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
declare const user: {
|
|
73
|
-
user: {
|
|
74
|
-
fields: {
|
|
75
|
-
stripeCustomerId: {
|
|
76
|
-
type: "string";
|
|
77
|
-
required: false;
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
declare const organization: {
|
|
83
|
-
organization: {
|
|
84
|
-
fields: {
|
|
85
|
-
stripeCustomerId: {
|
|
86
|
-
type: "string";
|
|
87
|
-
required: false;
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
//#endregion
|
|
93
|
-
//#region src/types.d.ts
|
|
94
|
-
type AuthorizeReferenceAction = "upgrade-subscription" | "list-subscription" | "cancel-subscription" | "restore-subscription" | "billing-portal";
|
|
95
|
-
type WithStripeCustomerId = {
|
|
96
|
-
stripeCustomerId?: string;
|
|
97
|
-
};
|
|
98
|
-
type WithActiveOrganizationId = {
|
|
99
|
-
activeOrganizationId?: string;
|
|
100
|
-
};
|
|
101
|
-
type StripeCtxSession = {
|
|
102
|
-
session: Session & WithActiveOrganizationId;
|
|
103
|
-
user: User & WithStripeCustomerId;
|
|
104
|
-
};
|
|
105
|
-
type StripePlan = {
|
|
106
|
-
/**
|
|
107
|
-
* Monthly price id
|
|
108
|
-
*/
|
|
109
|
-
priceId?: string | undefined;
|
|
110
|
-
/**
|
|
111
|
-
* To use lookup key instead of price id
|
|
112
|
-
*
|
|
113
|
-
* https://docs.stripe.com/products-prices/
|
|
114
|
-
* manage-prices#lookup-keys
|
|
115
|
-
*/
|
|
116
|
-
lookupKey?: string | undefined;
|
|
117
|
-
/**
|
|
118
|
-
* A yearly discount price id
|
|
119
|
-
*
|
|
120
|
-
* useful when you want to offer a discount for
|
|
121
|
-
* yearly subscription
|
|
122
|
-
*/
|
|
123
|
-
annualDiscountPriceId?: string | undefined;
|
|
124
|
-
/**
|
|
125
|
-
* To use lookup key instead of price id
|
|
126
|
-
*
|
|
127
|
-
* https://docs.stripe.com/products-prices/
|
|
128
|
-
* manage-prices#lookup-keys
|
|
129
|
-
*/
|
|
130
|
-
annualDiscountLookupKey?: string | undefined;
|
|
131
|
-
/**
|
|
132
|
-
* Plan name
|
|
133
|
-
*/
|
|
134
|
-
name: string;
|
|
135
|
-
/**
|
|
136
|
-
* Limits for the plan
|
|
137
|
-
*
|
|
138
|
-
* useful when you want to define plan-specific metadata.
|
|
139
|
-
*/
|
|
140
|
-
limits?: Record<string, unknown> | undefined;
|
|
141
|
-
/**
|
|
142
|
-
* Plan group name
|
|
143
|
-
*
|
|
144
|
-
* useful when you want to group plans or
|
|
145
|
-
* when a user can subscribe to multiple plans.
|
|
146
|
-
*/
|
|
147
|
-
group?: string | undefined;
|
|
148
|
-
/**
|
|
149
|
-
* Free trial days
|
|
150
|
-
*/
|
|
151
|
-
freeTrial?: {
|
|
152
|
-
/**
|
|
153
|
-
* Number of days
|
|
154
|
-
*/
|
|
155
|
-
days: number;
|
|
156
|
-
/**
|
|
157
|
-
* A function that will be called when the trial
|
|
158
|
-
* starts.
|
|
159
|
-
*
|
|
160
|
-
* @param subscription
|
|
161
|
-
* @returns
|
|
162
|
-
*/
|
|
163
|
-
onTrialStart?: (subscription: Subscription) => Promise<void>;
|
|
164
|
-
/**
|
|
165
|
-
* A function that will be called when the trial
|
|
166
|
-
* ends
|
|
167
|
-
*
|
|
168
|
-
* @param subscription - Subscription
|
|
169
|
-
* @returns
|
|
170
|
-
*/
|
|
171
|
-
onTrialEnd?: (data: {
|
|
172
|
-
subscription: Subscription;
|
|
173
|
-
}, ctx: GenericEndpointContext) => Promise<void>;
|
|
174
|
-
/**
|
|
175
|
-
* A function that will be called when the trial
|
|
176
|
-
* expired.
|
|
177
|
-
* @param subscription - Subscription
|
|
178
|
-
* @returns
|
|
179
|
-
*/
|
|
180
|
-
onTrialExpired?: (subscription: Subscription, ctx: GenericEndpointContext) => Promise<void>;
|
|
181
|
-
} | undefined;
|
|
182
|
-
};
|
|
183
|
-
interface Subscription {
|
|
184
|
-
/**
|
|
185
|
-
* Database identifier
|
|
186
|
-
*/
|
|
187
|
-
id: string;
|
|
188
|
-
/**
|
|
189
|
-
* The plan name
|
|
190
|
-
*/
|
|
191
|
-
plan: string;
|
|
192
|
-
/**
|
|
193
|
-
* Stripe customer id
|
|
194
|
-
*/
|
|
195
|
-
stripeCustomerId?: string | undefined;
|
|
196
|
-
/**
|
|
197
|
-
* Stripe subscription id
|
|
198
|
-
*/
|
|
199
|
-
stripeSubscriptionId?: string | undefined;
|
|
200
|
-
/**
|
|
201
|
-
* Trial start date
|
|
202
|
-
*/
|
|
203
|
-
trialStart?: Date | undefined;
|
|
204
|
-
/**
|
|
205
|
-
* Trial end date
|
|
206
|
-
*/
|
|
207
|
-
trialEnd?: Date | undefined;
|
|
208
|
-
/**
|
|
209
|
-
* Price Id for the subscription
|
|
210
|
-
*/
|
|
211
|
-
priceId?: string | undefined;
|
|
212
|
-
/**
|
|
213
|
-
* To what reference id the subscription belongs to
|
|
214
|
-
* @example
|
|
215
|
-
* - userId for a user
|
|
216
|
-
* - workspace id for a saas platform
|
|
217
|
-
* - website id for a hosting platform
|
|
218
|
-
*
|
|
219
|
-
* @default - userId
|
|
220
|
-
*/
|
|
221
|
-
referenceId: string;
|
|
222
|
-
/**
|
|
223
|
-
* Subscription status
|
|
224
|
-
*/
|
|
225
|
-
status: "active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "trialing" | "unpaid";
|
|
226
|
-
/**
|
|
227
|
-
* The billing cycle start date
|
|
228
|
-
*/
|
|
229
|
-
periodStart?: Date | undefined;
|
|
230
|
-
/**
|
|
231
|
-
* The billing cycle end date
|
|
232
|
-
*/
|
|
233
|
-
periodEnd?: Date | undefined;
|
|
234
|
-
/**
|
|
235
|
-
* Whether this subscription will (if status=active)
|
|
236
|
-
* or did (if status=canceled) cancel at the end of the current billing period.
|
|
237
|
-
*/
|
|
238
|
-
cancelAtPeriodEnd?: boolean | undefined;
|
|
239
|
-
/**
|
|
240
|
-
* If the subscription is scheduled to be canceled,
|
|
241
|
-
* this is the time at which the cancellation will take effect.
|
|
242
|
-
*/
|
|
243
|
-
cancelAt?: Date | undefined;
|
|
244
|
-
/**
|
|
245
|
-
* If the subscription has been canceled, this is the time when it was canceled.
|
|
246
|
-
*
|
|
247
|
-
* Note: If the subscription was canceled with `cancel_at_period_end`,
|
|
248
|
-
* this reflects the cancellation request time, not when the subscription actually ends.
|
|
249
|
-
*/
|
|
250
|
-
canceledAt?: Date | undefined;
|
|
251
|
-
/**
|
|
252
|
-
* If the subscription has ended, the date the subscription ended.
|
|
253
|
-
*/
|
|
254
|
-
endedAt?: Date | undefined;
|
|
255
|
-
/**
|
|
256
|
-
* A field to group subscriptions so you can have multiple subscriptions
|
|
257
|
-
* for one reference id
|
|
258
|
-
*/
|
|
259
|
-
groupId?: string | undefined;
|
|
260
|
-
/**
|
|
261
|
-
* Number of seats for the subscription (useful for team plans)
|
|
262
|
-
*/
|
|
263
|
-
seats?: number | undefined;
|
|
264
|
-
}
|
|
265
|
-
type SubscriptionOptions = {
|
|
266
|
-
/**
|
|
267
|
-
* Subscription Configuration
|
|
268
|
-
*/
|
|
269
|
-
/**
|
|
270
|
-
* List of plan
|
|
271
|
-
*/
|
|
272
|
-
plans: StripePlan[] | (() => StripePlan[] | Promise<StripePlan[]>);
|
|
273
|
-
/**
|
|
274
|
-
* Require email verification before a user is allowed to upgrade
|
|
275
|
-
* their subscriptions
|
|
276
|
-
*
|
|
277
|
-
* @default false
|
|
278
|
-
*/
|
|
279
|
-
requireEmailVerification?: boolean | undefined;
|
|
280
|
-
/**
|
|
281
|
-
* A callback to run after a user has subscribed to a package
|
|
282
|
-
* @param event - Stripe Event
|
|
283
|
-
* @param subscription - Subscription Data
|
|
284
|
-
* @returns
|
|
285
|
-
*/
|
|
286
|
-
onSubscriptionComplete?: ((data: {
|
|
287
|
-
event: Stripe.Event;
|
|
288
|
-
stripeSubscription: Stripe.Subscription;
|
|
289
|
-
subscription: Subscription;
|
|
290
|
-
plan: StripePlan;
|
|
291
|
-
}, ctx: GenericEndpointContext) => Promise<void>) | undefined;
|
|
292
|
-
/**
|
|
293
|
-
* A callback to run after a user is about to cancel their subscription
|
|
294
|
-
* @returns
|
|
295
|
-
*/
|
|
296
|
-
onSubscriptionUpdate?: ((data: {
|
|
297
|
-
event: Stripe.Event;
|
|
298
|
-
subscription: Subscription;
|
|
299
|
-
}) => Promise<void>) | undefined;
|
|
300
|
-
/**
|
|
301
|
-
* A callback to run after a user is about to cancel their subscription
|
|
302
|
-
* @returns
|
|
303
|
-
*/
|
|
304
|
-
onSubscriptionCancel?: ((data: {
|
|
305
|
-
event?: Stripe.Event;
|
|
306
|
-
subscription: Subscription;
|
|
307
|
-
stripeSubscription: Stripe.Subscription;
|
|
308
|
-
cancellationDetails?: Stripe.Subscription.CancellationDetails | null;
|
|
309
|
-
}) => Promise<void>) | undefined;
|
|
310
|
-
/**
|
|
311
|
-
* A function to check if the reference id is valid
|
|
312
|
-
* and belongs to the user
|
|
313
|
-
*
|
|
314
|
-
* @param data - data containing user, session and referenceId
|
|
315
|
-
* @param ctx - the context object
|
|
316
|
-
* @returns
|
|
317
|
-
*/
|
|
318
|
-
authorizeReference?: ((data: {
|
|
319
|
-
user: User & Record<string, any>;
|
|
320
|
-
session: Session & Record<string, any>;
|
|
321
|
-
referenceId: string;
|
|
322
|
-
action: AuthorizeReferenceAction;
|
|
323
|
-
}, ctx: GenericEndpointContext) => Promise<boolean>) | undefined;
|
|
324
|
-
/**
|
|
325
|
-
* A callback to run after a user has deleted their subscription
|
|
326
|
-
* @returns
|
|
327
|
-
*/
|
|
328
|
-
onSubscriptionDeleted?: ((data: {
|
|
329
|
-
event: Stripe.Event;
|
|
330
|
-
stripeSubscription: Stripe.Subscription;
|
|
331
|
-
subscription: Subscription;
|
|
332
|
-
}) => Promise<void>) | undefined;
|
|
333
|
-
/**
|
|
334
|
-
* A callback to run when a subscription is created
|
|
335
|
-
* @returns
|
|
336
|
-
*/
|
|
337
|
-
onSubscriptionCreated?: ((data: {
|
|
338
|
-
event: Stripe.Event;
|
|
339
|
-
stripeSubscription: Stripe.Subscription;
|
|
340
|
-
subscription: Subscription;
|
|
341
|
-
plan: StripePlan;
|
|
342
|
-
}) => Promise<void>) | undefined;
|
|
343
|
-
/**
|
|
344
|
-
* parameters for session create params
|
|
345
|
-
*
|
|
346
|
-
* @param data - data containing user, session and plan
|
|
347
|
-
* @param req - the request object
|
|
348
|
-
* @param ctx - the context object
|
|
349
|
-
*/
|
|
350
|
-
getCheckoutSessionParams?: ((data: {
|
|
351
|
-
user: User & Record<string, any>;
|
|
352
|
-
session: Session & Record<string, any>;
|
|
353
|
-
plan: StripePlan;
|
|
354
|
-
subscription: Subscription;
|
|
355
|
-
}, req: GenericEndpointContext["request"], ctx: GenericEndpointContext) => Promise<{
|
|
356
|
-
params?: Stripe.Checkout.SessionCreateParams;
|
|
357
|
-
options?: Stripe.RequestOptions;
|
|
358
|
-
}> | {
|
|
359
|
-
params?: Stripe.Checkout.SessionCreateParams;
|
|
360
|
-
options?: Stripe.RequestOptions;
|
|
361
|
-
}) | undefined;
|
|
362
|
-
};
|
|
363
|
-
interface StripeOptions {
|
|
364
|
-
/**
|
|
365
|
-
* Stripe Client
|
|
366
|
-
*/
|
|
367
|
-
stripeClient: Stripe;
|
|
368
|
-
/**
|
|
369
|
-
* Stripe Webhook Secret
|
|
370
|
-
*
|
|
371
|
-
* @description Stripe webhook secret key
|
|
372
|
-
*/
|
|
373
|
-
stripeWebhookSecret: string;
|
|
374
|
-
/**
|
|
375
|
-
* Enable customer creation when a user signs up
|
|
376
|
-
*/
|
|
377
|
-
createCustomerOnSignUp?: boolean | undefined;
|
|
378
|
-
/**
|
|
379
|
-
* A callback to run after a customer has been created
|
|
380
|
-
* @param customer - Customer Data
|
|
381
|
-
* @param stripeCustomer - Stripe Customer Data
|
|
382
|
-
* @returns
|
|
383
|
-
*/
|
|
384
|
-
onCustomerCreate?: ((data: {
|
|
385
|
-
stripeCustomer: Stripe.Customer;
|
|
386
|
-
user: User & WithStripeCustomerId;
|
|
387
|
-
}, ctx: GenericEndpointContext) => Promise<void>) | undefined;
|
|
388
|
-
/**
|
|
389
|
-
* A custom function to get the customer create
|
|
390
|
-
* params
|
|
391
|
-
* @param data - data containing user and session
|
|
392
|
-
* @returns
|
|
393
|
-
*/
|
|
394
|
-
getCustomerCreateParams?: ((user: User, ctx: GenericEndpointContext) => Promise<Partial<Stripe.CustomerCreateParams>>) | undefined;
|
|
395
|
-
/**
|
|
396
|
-
* Subscriptions
|
|
397
|
-
*/
|
|
398
|
-
subscription?: ({
|
|
399
|
-
enabled: false;
|
|
400
|
-
} | ({
|
|
401
|
-
enabled: true;
|
|
402
|
-
} & SubscriptionOptions)) | undefined;
|
|
403
|
-
/**
|
|
404
|
-
* Organization Stripe integration
|
|
405
|
-
*
|
|
406
|
-
* Enable organizations to have their own Stripe customer ID
|
|
407
|
-
*/
|
|
408
|
-
organization?: {
|
|
409
|
-
/**
|
|
410
|
-
* Enable organization Stripe customer
|
|
411
|
-
*/
|
|
412
|
-
enabled: true;
|
|
413
|
-
/**
|
|
414
|
-
* A custom function to get the customer create params
|
|
415
|
-
* for organization customers.
|
|
416
|
-
*
|
|
417
|
-
* @param organization - the organization
|
|
418
|
-
* @param ctx - the context object
|
|
419
|
-
* @returns
|
|
420
|
-
*/
|
|
421
|
-
getCustomerCreateParams?: ((organization: Organization, ctx: GenericEndpointContext) => Promise<Partial<Stripe.CustomerCreateParams>>) | undefined;
|
|
422
|
-
/**
|
|
423
|
-
* A callback to run after an organization customer has been created
|
|
424
|
-
*
|
|
425
|
-
* @param data - data containing stripeCustomer and organization
|
|
426
|
-
* @param ctx - the context object
|
|
427
|
-
* @returns
|
|
428
|
-
*/
|
|
429
|
-
onCustomerCreate?: ((data: {
|
|
430
|
-
stripeCustomer: Stripe.Customer;
|
|
431
|
-
organization: Organization & WithStripeCustomerId;
|
|
432
|
-
}, ctx: GenericEndpointContext) => Promise<void>) | undefined;
|
|
433
|
-
} | undefined;
|
|
434
|
-
/**
|
|
435
|
-
* A callback to run after a stripe event is received
|
|
436
|
-
* @param event - Stripe Event
|
|
437
|
-
* @returns
|
|
438
|
-
*/
|
|
439
|
-
onEvent?: ((event: Stripe.Event) => Promise<void>) | undefined;
|
|
440
|
-
/**
|
|
441
|
-
* Schema for the stripe plugin
|
|
442
|
-
*/
|
|
443
|
-
schema?: InferOptionSchema<typeof subscriptions & typeof user & typeof organization> | undefined;
|
|
444
|
-
}
|
|
445
|
-
//#endregion
|
|
446
|
-
//#region src/index.d.ts
|
|
447
|
-
declare module "@better-auth/core" {
|
|
448
|
-
interface BetterAuthPluginRegistry<Auth, Context> {
|
|
449
|
-
stripe: {
|
|
450
|
-
creator: typeof stripe;
|
|
451
|
-
};
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
455
|
-
id: "stripe";
|
|
456
|
-
endpoints: {
|
|
457
|
-
stripeWebhook: better_call0.StrictEndpoint<"/stripe/webhook", {
|
|
458
|
-
method: "POST";
|
|
459
|
-
metadata: {
|
|
460
|
-
openapi: {
|
|
461
|
-
operationId: string;
|
|
462
|
-
};
|
|
463
|
-
scope: "server";
|
|
464
|
-
};
|
|
465
|
-
cloneRequest: true;
|
|
466
|
-
disableBody: true;
|
|
467
|
-
}, {
|
|
468
|
-
success: boolean;
|
|
469
|
-
}>;
|
|
470
|
-
} & (O["subscription"] extends {
|
|
471
|
-
enabled: true;
|
|
472
|
-
} ? {
|
|
473
|
-
upgradeSubscription: better_call0.StrictEndpoint<"/subscription/upgrade", {
|
|
474
|
-
method: "POST";
|
|
475
|
-
body: zod0.ZodObject<{
|
|
476
|
-
plan: zod0.ZodString;
|
|
477
|
-
annual: zod0.ZodOptional<zod0.ZodBoolean>;
|
|
478
|
-
referenceId: zod0.ZodOptional<zod0.ZodString>;
|
|
479
|
-
subscriptionId: zod0.ZodOptional<zod0.ZodString>;
|
|
480
|
-
customerType: zod0.ZodOptional<zod0.ZodEnum<{
|
|
481
|
-
user: "user";
|
|
482
|
-
organization: "organization";
|
|
483
|
-
}>>;
|
|
484
|
-
metadata: zod0.ZodOptional<zod0.ZodRecord<zod0.ZodString, zod0.ZodAny>>;
|
|
485
|
-
seats: zod0.ZodOptional<zod0.ZodNumber>;
|
|
486
|
-
locale: zod0.ZodOptional<zod0.ZodCustom<Stripe.Checkout.Session.Locale, Stripe.Checkout.Session.Locale>>;
|
|
487
|
-
successUrl: zod0.ZodDefault<zod0.ZodString>;
|
|
488
|
-
cancelUrl: zod0.ZodDefault<zod0.ZodString>;
|
|
489
|
-
returnUrl: zod0.ZodOptional<zod0.ZodString>;
|
|
490
|
-
disableRedirect: zod0.ZodDefault<zod0.ZodBoolean>;
|
|
491
|
-
}, better_auth0.$strip>;
|
|
492
|
-
metadata: {
|
|
493
|
-
openapi: {
|
|
494
|
-
operationId: string;
|
|
495
|
-
};
|
|
496
|
-
};
|
|
497
|
-
use: (((inputContext: better_call0.MiddlewareInputContext<{
|
|
498
|
-
use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
|
|
499
|
-
session: {
|
|
500
|
-
session: Record<string, any> & {
|
|
501
|
-
id: string;
|
|
502
|
-
createdAt: Date;
|
|
503
|
-
updatedAt: Date;
|
|
504
|
-
userId: string;
|
|
505
|
-
expiresAt: Date;
|
|
506
|
-
token: string;
|
|
507
|
-
ipAddress?: string | null | undefined;
|
|
508
|
-
userAgent?: string | null | undefined;
|
|
509
|
-
};
|
|
510
|
-
user: Record<string, any> & {
|
|
511
|
-
id: string;
|
|
512
|
-
createdAt: Date;
|
|
513
|
-
updatedAt: Date;
|
|
514
|
-
email: string;
|
|
515
|
-
emailVerified: boolean;
|
|
516
|
-
name: string;
|
|
517
|
-
image?: string | null | undefined;
|
|
518
|
-
};
|
|
519
|
-
};
|
|
520
|
-
}>)[];
|
|
521
|
-
}>) => Promise<{
|
|
522
|
-
session: StripeCtxSession;
|
|
523
|
-
}>) | ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>))[];
|
|
524
|
-
}, {
|
|
525
|
-
url: string;
|
|
526
|
-
redirect: boolean;
|
|
527
|
-
} | {
|
|
528
|
-
redirect: boolean;
|
|
529
|
-
id: string;
|
|
530
|
-
object: "checkout.session";
|
|
531
|
-
adaptive_pricing: Stripe.Checkout.Session.AdaptivePricing | null;
|
|
532
|
-
after_expiration: Stripe.Checkout.Session.AfterExpiration | null;
|
|
533
|
-
allow_promotion_codes: boolean | null;
|
|
534
|
-
amount_subtotal: number | null;
|
|
535
|
-
amount_total: number | null;
|
|
536
|
-
automatic_tax: Stripe.Checkout.Session.AutomaticTax;
|
|
537
|
-
billing_address_collection: Stripe.Checkout.Session.BillingAddressCollection | null;
|
|
538
|
-
branding_settings?: Stripe.Checkout.Session.BrandingSettings;
|
|
539
|
-
cancel_url: string | null;
|
|
540
|
-
client_reference_id: string | null;
|
|
541
|
-
client_secret: string | null;
|
|
542
|
-
collected_information: Stripe.Checkout.Session.CollectedInformation | null;
|
|
543
|
-
consent: Stripe.Checkout.Session.Consent | null;
|
|
544
|
-
consent_collection: Stripe.Checkout.Session.ConsentCollection | null;
|
|
545
|
-
created: number;
|
|
546
|
-
currency: string | null;
|
|
547
|
-
currency_conversion: Stripe.Checkout.Session.CurrencyConversion | null;
|
|
548
|
-
custom_fields: Array<Stripe.Checkout.Session.CustomField>;
|
|
549
|
-
custom_text: Stripe.Checkout.Session.CustomText;
|
|
550
|
-
customer: string | Stripe.Customer | Stripe.DeletedCustomer | null;
|
|
551
|
-
customer_creation: Stripe.Checkout.Session.CustomerCreation | null;
|
|
552
|
-
customer_details: Stripe.Checkout.Session.CustomerDetails | null;
|
|
553
|
-
customer_email: string | null;
|
|
554
|
-
discounts: Array<Stripe.Checkout.Session.Discount> | null;
|
|
555
|
-
excluded_payment_method_types?: Array<string>;
|
|
556
|
-
expires_at: number;
|
|
557
|
-
invoice: string | Stripe.Invoice | null;
|
|
558
|
-
invoice_creation: Stripe.Checkout.Session.InvoiceCreation | null;
|
|
559
|
-
line_items?: Stripe.ApiList<Stripe.LineItem>;
|
|
560
|
-
livemode: boolean;
|
|
561
|
-
locale: Stripe.Checkout.Session.Locale | null;
|
|
562
|
-
metadata: Stripe.Metadata | null;
|
|
563
|
-
mode: Stripe.Checkout.Session.Mode;
|
|
564
|
-
name_collection?: Stripe.Checkout.Session.NameCollection;
|
|
565
|
-
optional_items?: Array<Stripe.Checkout.Session.OptionalItem> | null;
|
|
566
|
-
origin_context: Stripe.Checkout.Session.OriginContext | null;
|
|
567
|
-
payment_intent: string | Stripe.PaymentIntent | null;
|
|
568
|
-
payment_link: string | Stripe.PaymentLink | null;
|
|
569
|
-
payment_method_collection: Stripe.Checkout.Session.PaymentMethodCollection | null;
|
|
570
|
-
payment_method_configuration_details: Stripe.Checkout.Session.PaymentMethodConfigurationDetails | null;
|
|
571
|
-
payment_method_options: Stripe.Checkout.Session.PaymentMethodOptions | null;
|
|
572
|
-
payment_method_types: Array<string>;
|
|
573
|
-
payment_status: Stripe.Checkout.Session.PaymentStatus;
|
|
574
|
-
permissions: Stripe.Checkout.Session.Permissions | null;
|
|
575
|
-
phone_number_collection?: Stripe.Checkout.Session.PhoneNumberCollection;
|
|
576
|
-
presentment_details?: Stripe.Checkout.Session.PresentmentDetails;
|
|
577
|
-
recovered_from: string | null;
|
|
578
|
-
redirect_on_completion?: Stripe.Checkout.Session.RedirectOnCompletion;
|
|
579
|
-
return_url?: string;
|
|
580
|
-
saved_payment_method_options: Stripe.Checkout.Session.SavedPaymentMethodOptions | null;
|
|
581
|
-
setup_intent: string | Stripe.SetupIntent | null;
|
|
582
|
-
shipping_address_collection: Stripe.Checkout.Session.ShippingAddressCollection | null;
|
|
583
|
-
shipping_cost: Stripe.Checkout.Session.ShippingCost | null;
|
|
584
|
-
shipping_options: Array<Stripe.Checkout.Session.ShippingOption>;
|
|
585
|
-
status: Stripe.Checkout.Session.Status | null;
|
|
586
|
-
submit_type: Stripe.Checkout.Session.SubmitType | null;
|
|
587
|
-
subscription: string | Stripe.Subscription | null;
|
|
588
|
-
success_url: string | null;
|
|
589
|
-
tax_id_collection?: Stripe.Checkout.Session.TaxIdCollection;
|
|
590
|
-
total_details: Stripe.Checkout.Session.TotalDetails | null;
|
|
591
|
-
ui_mode: Stripe.Checkout.Session.UiMode | null;
|
|
592
|
-
url: string | null;
|
|
593
|
-
wallet_options: Stripe.Checkout.Session.WalletOptions | null;
|
|
594
|
-
lastResponse: {
|
|
595
|
-
headers: {
|
|
596
|
-
[key: string]: string;
|
|
597
|
-
};
|
|
598
|
-
requestId: string;
|
|
599
|
-
statusCode: number;
|
|
600
|
-
apiVersion?: string;
|
|
601
|
-
idempotencyKey?: string;
|
|
602
|
-
stripeAccount?: string;
|
|
603
|
-
};
|
|
604
|
-
}>;
|
|
605
|
-
cancelSubscriptionCallback: better_call0.StrictEndpoint<"/subscription/cancel/callback", {
|
|
606
|
-
method: "GET";
|
|
607
|
-
query: zod0.ZodOptional<zod0.ZodRecord<zod0.ZodString, zod0.ZodAny>>;
|
|
608
|
-
metadata: {
|
|
609
|
-
openapi: {
|
|
610
|
-
operationId: string;
|
|
611
|
-
};
|
|
612
|
-
};
|
|
613
|
-
use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>)[];
|
|
614
|
-
}, never>;
|
|
615
|
-
cancelSubscription: better_call0.StrictEndpoint<"/subscription/cancel", {
|
|
616
|
-
method: "POST";
|
|
617
|
-
body: zod0.ZodObject<{
|
|
618
|
-
referenceId: zod0.ZodOptional<zod0.ZodString>;
|
|
619
|
-
subscriptionId: zod0.ZodOptional<zod0.ZodString>;
|
|
620
|
-
customerType: zod0.ZodOptional<zod0.ZodEnum<{
|
|
621
|
-
user: "user";
|
|
622
|
-
organization: "organization";
|
|
623
|
-
}>>;
|
|
624
|
-
returnUrl: zod0.ZodString;
|
|
625
|
-
disableRedirect: zod0.ZodDefault<zod0.ZodBoolean>;
|
|
626
|
-
}, better_auth0.$strip>;
|
|
627
|
-
metadata: {
|
|
628
|
-
openapi: {
|
|
629
|
-
operationId: string;
|
|
630
|
-
};
|
|
631
|
-
};
|
|
632
|
-
use: (((inputContext: better_call0.MiddlewareInputContext<{
|
|
633
|
-
use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
|
|
634
|
-
session: {
|
|
635
|
-
session: Record<string, any> & {
|
|
636
|
-
id: string;
|
|
637
|
-
createdAt: Date;
|
|
638
|
-
updatedAt: Date;
|
|
639
|
-
userId: string;
|
|
640
|
-
expiresAt: Date;
|
|
641
|
-
token: string;
|
|
642
|
-
ipAddress?: string | null | undefined;
|
|
643
|
-
userAgent?: string | null | undefined;
|
|
644
|
-
};
|
|
645
|
-
user: Record<string, any> & {
|
|
646
|
-
id: string;
|
|
647
|
-
createdAt: Date;
|
|
648
|
-
updatedAt: Date;
|
|
649
|
-
email: string;
|
|
650
|
-
emailVerified: boolean;
|
|
651
|
-
name: string;
|
|
652
|
-
image?: string | null | undefined;
|
|
653
|
-
};
|
|
654
|
-
};
|
|
655
|
-
}>)[];
|
|
656
|
-
}>) => Promise<{
|
|
657
|
-
session: StripeCtxSession;
|
|
658
|
-
}>) | ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>))[];
|
|
659
|
-
}, {
|
|
660
|
-
url: string;
|
|
661
|
-
redirect: boolean;
|
|
662
|
-
}>;
|
|
663
|
-
restoreSubscription: better_call0.StrictEndpoint<"/subscription/restore", {
|
|
664
|
-
method: "POST";
|
|
665
|
-
body: zod0.ZodObject<{
|
|
666
|
-
referenceId: zod0.ZodOptional<zod0.ZodString>;
|
|
667
|
-
subscriptionId: zod0.ZodOptional<zod0.ZodString>;
|
|
668
|
-
customerType: zod0.ZodOptional<zod0.ZodEnum<{
|
|
669
|
-
user: "user";
|
|
670
|
-
organization: "organization";
|
|
671
|
-
}>>;
|
|
672
|
-
}, better_auth0.$strip>;
|
|
673
|
-
metadata: {
|
|
674
|
-
openapi: {
|
|
675
|
-
operationId: string;
|
|
676
|
-
};
|
|
677
|
-
};
|
|
678
|
-
use: (((inputContext: better_call0.MiddlewareInputContext<{
|
|
679
|
-
use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
|
|
680
|
-
session: {
|
|
681
|
-
session: Record<string, any> & {
|
|
682
|
-
id: string;
|
|
683
|
-
createdAt: Date;
|
|
684
|
-
updatedAt: Date;
|
|
685
|
-
userId: string;
|
|
686
|
-
expiresAt: Date;
|
|
687
|
-
token: string;
|
|
688
|
-
ipAddress?: string | null | undefined;
|
|
689
|
-
userAgent?: string | null | undefined;
|
|
690
|
-
};
|
|
691
|
-
user: Record<string, any> & {
|
|
692
|
-
id: string;
|
|
693
|
-
createdAt: Date;
|
|
694
|
-
updatedAt: Date;
|
|
695
|
-
email: string;
|
|
696
|
-
emailVerified: boolean;
|
|
697
|
-
name: string;
|
|
698
|
-
image?: string | null | undefined;
|
|
699
|
-
};
|
|
700
|
-
};
|
|
701
|
-
}>)[];
|
|
702
|
-
}>) => Promise<{
|
|
703
|
-
session: StripeCtxSession;
|
|
704
|
-
}>) | ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>))[];
|
|
705
|
-
}, Stripe.Response<Stripe.Subscription>>;
|
|
706
|
-
listActiveSubscriptions: better_call0.StrictEndpoint<"/subscription/list", {
|
|
707
|
-
method: "GET";
|
|
708
|
-
query: zod0.ZodOptional<zod0.ZodObject<{
|
|
709
|
-
referenceId: zod0.ZodOptional<zod0.ZodString>;
|
|
710
|
-
customerType: zod0.ZodOptional<zod0.ZodEnum<{
|
|
711
|
-
user: "user";
|
|
712
|
-
organization: "organization";
|
|
713
|
-
}>>;
|
|
714
|
-
}, better_auth0.$strip>>;
|
|
715
|
-
metadata: {
|
|
716
|
-
openapi: {
|
|
717
|
-
operationId: string;
|
|
718
|
-
};
|
|
719
|
-
};
|
|
720
|
-
use: (((inputContext: better_call0.MiddlewareInputContext<{
|
|
721
|
-
use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
|
|
722
|
-
session: {
|
|
723
|
-
session: Record<string, any> & {
|
|
724
|
-
id: string;
|
|
725
|
-
createdAt: Date;
|
|
726
|
-
updatedAt: Date;
|
|
727
|
-
userId: string;
|
|
728
|
-
expiresAt: Date;
|
|
729
|
-
token: string;
|
|
730
|
-
ipAddress?: string | null | undefined;
|
|
731
|
-
userAgent?: string | null | undefined;
|
|
732
|
-
};
|
|
733
|
-
user: Record<string, any> & {
|
|
734
|
-
id: string;
|
|
735
|
-
createdAt: Date;
|
|
736
|
-
updatedAt: Date;
|
|
737
|
-
email: string;
|
|
738
|
-
emailVerified: boolean;
|
|
739
|
-
name: string;
|
|
740
|
-
image?: string | null | undefined;
|
|
741
|
-
};
|
|
742
|
-
};
|
|
743
|
-
}>)[];
|
|
744
|
-
}>) => Promise<{
|
|
745
|
-
session: StripeCtxSession;
|
|
746
|
-
}>) | ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>))[];
|
|
747
|
-
}, {
|
|
748
|
-
limits: Record<string, unknown> | undefined;
|
|
749
|
-
priceId: string | undefined;
|
|
750
|
-
id: string;
|
|
751
|
-
plan: string;
|
|
752
|
-
stripeCustomerId?: string | undefined;
|
|
753
|
-
stripeSubscriptionId?: string | undefined;
|
|
754
|
-
trialStart?: Date | undefined;
|
|
755
|
-
trialEnd?: Date | undefined;
|
|
756
|
-
referenceId: string;
|
|
757
|
-
status: "active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "trialing" | "unpaid";
|
|
758
|
-
periodStart?: Date | undefined;
|
|
759
|
-
periodEnd?: Date | undefined;
|
|
760
|
-
cancelAtPeriodEnd?: boolean | undefined;
|
|
761
|
-
cancelAt?: Date | undefined;
|
|
762
|
-
canceledAt?: Date | undefined;
|
|
763
|
-
endedAt?: Date | undefined;
|
|
764
|
-
groupId?: string | undefined;
|
|
765
|
-
seats?: number | undefined;
|
|
766
|
-
}[]>;
|
|
767
|
-
subscriptionSuccess: better_call0.StrictEndpoint<"/subscription/success", {
|
|
768
|
-
method: "GET";
|
|
769
|
-
query: zod0.ZodOptional<zod0.ZodRecord<zod0.ZodString, zod0.ZodAny>>;
|
|
770
|
-
metadata: {
|
|
771
|
-
openapi: {
|
|
772
|
-
operationId: string;
|
|
773
|
-
};
|
|
774
|
-
};
|
|
775
|
-
use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>)[];
|
|
776
|
-
}, never>;
|
|
777
|
-
createBillingPortal: better_call0.StrictEndpoint<"/subscription/billing-portal", {
|
|
778
|
-
method: "POST";
|
|
779
|
-
body: zod0.ZodObject<{
|
|
780
|
-
locale: zod0.ZodOptional<zod0.ZodCustom<Stripe.Checkout.Session.Locale, Stripe.Checkout.Session.Locale>>;
|
|
781
|
-
referenceId: zod0.ZodOptional<zod0.ZodString>;
|
|
782
|
-
customerType: zod0.ZodOptional<zod0.ZodEnum<{
|
|
783
|
-
user: "user";
|
|
784
|
-
organization: "organization";
|
|
785
|
-
}>>;
|
|
786
|
-
returnUrl: zod0.ZodDefault<zod0.ZodString>;
|
|
787
|
-
disableRedirect: zod0.ZodDefault<zod0.ZodBoolean>;
|
|
788
|
-
}, better_auth0.$strip>;
|
|
789
|
-
metadata: {
|
|
790
|
-
openapi: {
|
|
791
|
-
operationId: string;
|
|
792
|
-
};
|
|
793
|
-
};
|
|
794
|
-
use: (((inputContext: better_call0.MiddlewareInputContext<{
|
|
795
|
-
use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
|
|
796
|
-
session: {
|
|
797
|
-
session: Record<string, any> & {
|
|
798
|
-
id: string;
|
|
799
|
-
createdAt: Date;
|
|
800
|
-
updatedAt: Date;
|
|
801
|
-
userId: string;
|
|
802
|
-
expiresAt: Date;
|
|
803
|
-
token: string;
|
|
804
|
-
ipAddress?: string | null | undefined;
|
|
805
|
-
userAgent?: string | null | undefined;
|
|
806
|
-
};
|
|
807
|
-
user: Record<string, any> & {
|
|
808
|
-
id: string;
|
|
809
|
-
createdAt: Date;
|
|
810
|
-
updatedAt: Date;
|
|
811
|
-
email: string;
|
|
812
|
-
emailVerified: boolean;
|
|
813
|
-
name: string;
|
|
814
|
-
image?: string | null | undefined;
|
|
815
|
-
};
|
|
816
|
-
};
|
|
817
|
-
}>)[];
|
|
818
|
-
}>) => Promise<{
|
|
819
|
-
session: StripeCtxSession;
|
|
820
|
-
}>) | ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>))[];
|
|
821
|
-
}, {
|
|
822
|
-
url: string;
|
|
823
|
-
redirect: boolean;
|
|
824
|
-
}>;
|
|
825
|
-
} : {});
|
|
826
|
-
init(ctx: better_auth0.AuthContext): {
|
|
827
|
-
options: {
|
|
828
|
-
databaseHooks: {
|
|
829
|
-
user: {
|
|
830
|
-
create: {
|
|
831
|
-
after(user: User & WithStripeCustomerId, ctx: better_auth0.GenericEndpointContext | null): Promise<void>;
|
|
832
|
-
};
|
|
833
|
-
update: {
|
|
834
|
-
after(user: User & WithStripeCustomerId, ctx: better_auth0.GenericEndpointContext | null): Promise<void>;
|
|
835
|
-
};
|
|
836
|
-
};
|
|
837
|
-
};
|
|
838
|
-
};
|
|
839
|
-
} | undefined;
|
|
840
|
-
schema: {
|
|
841
|
-
user: {
|
|
842
|
-
fields: {
|
|
843
|
-
stripeCustomerId: {
|
|
844
|
-
type: "string";
|
|
845
|
-
required: false;
|
|
846
|
-
};
|
|
847
|
-
};
|
|
848
|
-
};
|
|
849
|
-
} & (O["subscription"] extends {
|
|
850
|
-
enabled: true;
|
|
851
|
-
} ? {
|
|
852
|
-
subscription: {
|
|
853
|
-
fields: {
|
|
854
|
-
plan: {
|
|
855
|
-
type: "string";
|
|
856
|
-
required: true;
|
|
857
|
-
};
|
|
858
|
-
referenceId: {
|
|
859
|
-
type: "string";
|
|
860
|
-
required: true;
|
|
861
|
-
};
|
|
862
|
-
stripeCustomerId: {
|
|
863
|
-
type: "string";
|
|
864
|
-
required: false;
|
|
865
|
-
};
|
|
866
|
-
stripeSubscriptionId: {
|
|
867
|
-
type: "string";
|
|
868
|
-
required: false;
|
|
869
|
-
};
|
|
870
|
-
status: {
|
|
871
|
-
type: "string";
|
|
872
|
-
defaultValue: string;
|
|
873
|
-
};
|
|
874
|
-
periodStart: {
|
|
875
|
-
type: "date";
|
|
876
|
-
required: false;
|
|
877
|
-
};
|
|
878
|
-
periodEnd: {
|
|
879
|
-
type: "date";
|
|
880
|
-
required: false;
|
|
881
|
-
};
|
|
882
|
-
trialStart: {
|
|
883
|
-
type: "date";
|
|
884
|
-
required: false;
|
|
885
|
-
};
|
|
886
|
-
trialEnd: {
|
|
887
|
-
type: "date";
|
|
888
|
-
required: false;
|
|
889
|
-
};
|
|
890
|
-
cancelAtPeriodEnd: {
|
|
891
|
-
type: "boolean";
|
|
892
|
-
required: false;
|
|
893
|
-
defaultValue: false;
|
|
894
|
-
};
|
|
895
|
-
cancelAt: {
|
|
896
|
-
type: "date";
|
|
897
|
-
required: false;
|
|
898
|
-
};
|
|
899
|
-
canceledAt: {
|
|
900
|
-
type: "date";
|
|
901
|
-
required: false;
|
|
902
|
-
};
|
|
903
|
-
endedAt: {
|
|
904
|
-
type: "date";
|
|
905
|
-
required: false;
|
|
906
|
-
};
|
|
907
|
-
seats: {
|
|
908
|
-
type: "number";
|
|
909
|
-
required: false;
|
|
910
|
-
};
|
|
911
|
-
};
|
|
912
|
-
};
|
|
913
|
-
} : {}) & (O["organization"] extends {
|
|
914
|
-
enabled: true;
|
|
915
|
-
} ? {
|
|
916
|
-
organization: {
|
|
917
|
-
fields: {
|
|
918
|
-
stripeCustomerId: {
|
|
919
|
-
type: "string";
|
|
920
|
-
required: false;
|
|
921
|
-
};
|
|
922
|
-
};
|
|
923
|
-
};
|
|
924
|
-
} : {});
|
|
925
|
-
options: NoInfer<O>;
|
|
926
|
-
$ERROR_CODES: {
|
|
927
|
-
readonly UNAUTHORIZED: {
|
|
928
|
-
code: "UNAUTHORIZED";
|
|
929
|
-
message: "Unauthorized access";
|
|
930
|
-
};
|
|
931
|
-
readonly INVALID_REQUEST_BODY: {
|
|
932
|
-
code: "INVALID_REQUEST_BODY";
|
|
933
|
-
message: "Invalid request body";
|
|
934
|
-
};
|
|
935
|
-
readonly SUBSCRIPTION_NOT_FOUND: {
|
|
936
|
-
code: "SUBSCRIPTION_NOT_FOUND";
|
|
937
|
-
message: "Subscription not found";
|
|
938
|
-
};
|
|
939
|
-
readonly SUBSCRIPTION_PLAN_NOT_FOUND: {
|
|
940
|
-
code: "SUBSCRIPTION_PLAN_NOT_FOUND";
|
|
941
|
-
message: "Subscription plan not found";
|
|
942
|
-
};
|
|
943
|
-
readonly ALREADY_SUBSCRIBED_PLAN: {
|
|
944
|
-
code: "ALREADY_SUBSCRIBED_PLAN";
|
|
945
|
-
message: "You're already subscribed to this plan";
|
|
946
|
-
};
|
|
947
|
-
readonly REFERENCE_ID_NOT_ALLOWED: {
|
|
948
|
-
code: "REFERENCE_ID_NOT_ALLOWED";
|
|
949
|
-
message: "Reference id is not allowed";
|
|
950
|
-
};
|
|
951
|
-
readonly CUSTOMER_NOT_FOUND: {
|
|
952
|
-
code: "CUSTOMER_NOT_FOUND";
|
|
953
|
-
message: "Stripe customer not found for this user";
|
|
954
|
-
};
|
|
955
|
-
readonly UNABLE_TO_CREATE_CUSTOMER: {
|
|
956
|
-
code: "UNABLE_TO_CREATE_CUSTOMER";
|
|
957
|
-
message: "Unable to create customer";
|
|
958
|
-
};
|
|
959
|
-
readonly UNABLE_TO_CREATE_BILLING_PORTAL: {
|
|
960
|
-
code: "UNABLE_TO_CREATE_BILLING_PORTAL";
|
|
961
|
-
message: "Unable to create billing portal session";
|
|
962
|
-
};
|
|
963
|
-
readonly STRIPE_SIGNATURE_NOT_FOUND: {
|
|
964
|
-
code: "STRIPE_SIGNATURE_NOT_FOUND";
|
|
965
|
-
message: "Stripe signature not found";
|
|
966
|
-
};
|
|
967
|
-
readonly STRIPE_WEBHOOK_SECRET_NOT_FOUND: {
|
|
968
|
-
code: "STRIPE_WEBHOOK_SECRET_NOT_FOUND";
|
|
969
|
-
message: "Stripe webhook secret not found";
|
|
970
|
-
};
|
|
971
|
-
readonly STRIPE_WEBHOOK_ERROR: {
|
|
972
|
-
code: "STRIPE_WEBHOOK_ERROR";
|
|
973
|
-
message: "Stripe webhook error";
|
|
974
|
-
};
|
|
975
|
-
readonly FAILED_TO_CONSTRUCT_STRIPE_EVENT: {
|
|
976
|
-
code: "FAILED_TO_CONSTRUCT_STRIPE_EVENT";
|
|
977
|
-
message: "Failed to construct Stripe event";
|
|
978
|
-
};
|
|
979
|
-
readonly FAILED_TO_FETCH_PLANS: {
|
|
980
|
-
code: "FAILED_TO_FETCH_PLANS";
|
|
981
|
-
message: "Failed to fetch plans";
|
|
982
|
-
};
|
|
983
|
-
readonly EMAIL_VERIFICATION_REQUIRED: {
|
|
984
|
-
code: "EMAIL_VERIFICATION_REQUIRED";
|
|
985
|
-
message: "Email verification is required before you can subscribe to a plan";
|
|
986
|
-
};
|
|
987
|
-
readonly SUBSCRIPTION_NOT_ACTIVE: {
|
|
988
|
-
code: "SUBSCRIPTION_NOT_ACTIVE";
|
|
989
|
-
message: "Subscription is not active";
|
|
990
|
-
};
|
|
991
|
-
readonly SUBSCRIPTION_NOT_SCHEDULED_FOR_CANCELLATION: {
|
|
992
|
-
code: "SUBSCRIPTION_NOT_SCHEDULED_FOR_CANCELLATION";
|
|
993
|
-
message: "Subscription is not scheduled for cancellation";
|
|
994
|
-
};
|
|
995
|
-
readonly ORGANIZATION_NOT_FOUND: {
|
|
996
|
-
code: "ORGANIZATION_NOT_FOUND";
|
|
997
|
-
message: "Organization not found";
|
|
998
|
-
};
|
|
999
|
-
readonly ORGANIZATION_SUBSCRIPTION_NOT_ENABLED: {
|
|
1000
|
-
code: "ORGANIZATION_SUBSCRIPTION_NOT_ENABLED";
|
|
1001
|
-
message: "Organization subscription is not enabled";
|
|
1002
|
-
};
|
|
1003
|
-
readonly ORGANIZATION_HAS_ACTIVE_SUBSCRIPTION: {
|
|
1004
|
-
code: "ORGANIZATION_HAS_ACTIVE_SUBSCRIPTION";
|
|
1005
|
-
message: "Cannot delete organization with active subscription";
|
|
1006
|
-
};
|
|
1007
|
-
readonly ORGANIZATION_REFERENCE_ID_REQUIRED: {
|
|
1008
|
-
code: "ORGANIZATION_REFERENCE_ID_REQUIRED";
|
|
1009
|
-
message: "Reference ID is required. Provide referenceId or set activeOrganizationId in session";
|
|
1010
|
-
};
|
|
1011
|
-
};
|
|
1012
|
-
};
|
|
1013
|
-
type StripePlugin<O extends StripeOptions> = ReturnType<typeof stripe<O>>;
|
|
1014
|
-
//#endregion
|
|
1015
|
-
export { SubscriptionOptions as a, Subscription as i, stripe as n, StripePlan as r, StripePlugin as t };
|