@paddle/better-auth 0.0.0-stage → 0.1.1-rc.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/LICENSE +21 -0
- package/README.md +549 -2
- package/dist/client.d.ts +59 -0
- package/dist/client.js +77 -0
- package/dist/index.d.ts +549 -0
- package/dist/index.js +756 -0
- package/dist/react/index.d.ts +30 -0
- package/dist/react/index.js +90 -0
- package/package.json +75 -4
package/dist/client.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// src/client.ts
|
|
2
|
+
var paddleClient = () => {
|
|
3
|
+
return {
|
|
4
|
+
id: "paddle",
|
|
5
|
+
$InferServerPlugin: {},
|
|
6
|
+
pathMethods: {
|
|
7
|
+
"/paddle/checkout": "POST",
|
|
8
|
+
"/paddle/subscription/cancel": "POST",
|
|
9
|
+
"/paddle/subscription/restore": "POST",
|
|
10
|
+
"/paddle/subscription/update": "POST",
|
|
11
|
+
"/paddle/subscription/pause": "POST",
|
|
12
|
+
"/paddle/subscription/resume": "POST",
|
|
13
|
+
"/paddle/subscription/preview": "POST",
|
|
14
|
+
"/paddle/transaction/invoice": "POST",
|
|
15
|
+
"/paddle/portal": "POST"
|
|
16
|
+
},
|
|
17
|
+
getActions: ($fetch) => ({
|
|
18
|
+
paddle: {
|
|
19
|
+
subscription: {
|
|
20
|
+
/**
|
|
21
|
+
* Polls the local subscription list until the row created by `transactionId`'s
|
|
22
|
+
* webhook appears. Bridges the gap between Paddle.js `checkout.completed` and the
|
|
23
|
+
* `subscription.created` webhook landing.
|
|
24
|
+
*/
|
|
25
|
+
waitFor: (options) => waitForSubscription($fetch, options)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
async function waitForSubscription($fetch, { transactionId, timeoutMs = 3e4, intervalMs = 500, signal }) {
|
|
32
|
+
const deadline = Date.now() + timeoutMs;
|
|
33
|
+
while (true) {
|
|
34
|
+
if (signal?.aborted) return aborted();
|
|
35
|
+
let response;
|
|
36
|
+
try {
|
|
37
|
+
response = await $fetch("/paddle/subscription/list", { method: "GET", signal });
|
|
38
|
+
} catch (thrown) {
|
|
39
|
+
if (signal?.aborted) return aborted();
|
|
40
|
+
throw thrown;
|
|
41
|
+
}
|
|
42
|
+
if (signal?.aborted) return aborted();
|
|
43
|
+
const { data, error } = response;
|
|
44
|
+
if (error) return { data: null, error };
|
|
45
|
+
const row = data?.find((r) => r.paddleTransactionId === transactionId);
|
|
46
|
+
if (row) return { data: row, error: null };
|
|
47
|
+
if (Date.now() + intervalMs > deadline) {
|
|
48
|
+
return {
|
|
49
|
+
data: null,
|
|
50
|
+
error: {
|
|
51
|
+
status: 408,
|
|
52
|
+
statusText: "Request Timeout",
|
|
53
|
+
code: "TIMEOUT",
|
|
54
|
+
message: `No subscription for ${transactionId} after ${timeoutMs}ms`
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
await sleep(intervalMs, signal);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function aborted() {
|
|
62
|
+
return { data: null, error: { status: 0, statusText: "Aborted", code: "ABORTED", message: "Wait aborted" } };
|
|
63
|
+
}
|
|
64
|
+
function sleep(ms, signal) {
|
|
65
|
+
return new Promise((resolve) => {
|
|
66
|
+
const timer = setTimeout(done, ms);
|
|
67
|
+
signal?.addEventListener("abort", done, { once: true });
|
|
68
|
+
function done() {
|
|
69
|
+
clearTimeout(timer);
|
|
70
|
+
signal?.removeEventListener("abort", done);
|
|
71
|
+
resolve();
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
paddleClient
|
|
77
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,549 @@
|
|
|
1
|
+
import * as _paddle_paddle_node_sdk from '@paddle/paddle-node-sdk';
|
|
2
|
+
import { Paddle, EventEntity } from '@paddle/paddle-node-sdk';
|
|
3
|
+
import * as better_auth from 'better-auth';
|
|
4
|
+
import { User } from 'better-auth';
|
|
5
|
+
import * as zod_v4_core from 'zod/v4/core';
|
|
6
|
+
import * as zod from 'zod';
|
|
7
|
+
|
|
8
|
+
interface PaddlePlan {
|
|
9
|
+
name: string;
|
|
10
|
+
priceId: string;
|
|
11
|
+
annualPriceId?: string;
|
|
12
|
+
limits?: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
interface SubscriptionRow {
|
|
15
|
+
id: string;
|
|
16
|
+
plan: string | null;
|
|
17
|
+
referenceId: string;
|
|
18
|
+
paddleCustomerId: string;
|
|
19
|
+
paddleSubscriptionId: string;
|
|
20
|
+
paddleTransactionId: string | null;
|
|
21
|
+
status: string;
|
|
22
|
+
priceId: string | null;
|
|
23
|
+
quantity: number;
|
|
24
|
+
periodStart: Date | null;
|
|
25
|
+
periodEnd: Date | null;
|
|
26
|
+
trialStart: Date | null;
|
|
27
|
+
trialEnd: Date | null;
|
|
28
|
+
cancelAtPeriodEnd: boolean;
|
|
29
|
+
scheduledChange: string | null;
|
|
30
|
+
lastEventAt: Date;
|
|
31
|
+
createdAt: Date;
|
|
32
|
+
updatedAt: Date;
|
|
33
|
+
}
|
|
34
|
+
type ProrationBillingMode = "prorated_immediately" | "prorated_next_billing_period" | "full_immediately" | "full_next_billing_period" | "do_not_bill";
|
|
35
|
+
interface PlanChangeContext {
|
|
36
|
+
/** The local row as it is before the change. */
|
|
37
|
+
subscription: SubscriptionRow;
|
|
38
|
+
/** The plan being moved to. */
|
|
39
|
+
plan: PaddlePlan;
|
|
40
|
+
/** The price being moved to: the plan's monthly or annual price. */
|
|
41
|
+
priceId: string;
|
|
42
|
+
}
|
|
43
|
+
type GrantReason = "active" | "trialing" | "resumed";
|
|
44
|
+
type RevokeReason = "canceled" | "paused" | "past_due";
|
|
45
|
+
interface AccessChangeContext {
|
|
46
|
+
userId: string;
|
|
47
|
+
subscription: Omit<SubscriptionRow, "id" | "createdAt" | "updatedAt">;
|
|
48
|
+
}
|
|
49
|
+
interface PaddleOptions {
|
|
50
|
+
paddleClient: Paddle;
|
|
51
|
+
webhookSecret: string;
|
|
52
|
+
/** Seller-built page hosting the checkout component. Relative paths resolve against the app origin. */
|
|
53
|
+
checkoutPage: string;
|
|
54
|
+
/** Query param carrying the transaction id. Default: "txn". */
|
|
55
|
+
checkoutParam?: string;
|
|
56
|
+
/** Default: true. */
|
|
57
|
+
createCustomerOnSignUp?: boolean;
|
|
58
|
+
getCustomerCreateParams?: (data: {
|
|
59
|
+
user: User;
|
|
60
|
+
}) => Promise<{
|
|
61
|
+
name?: string;
|
|
62
|
+
customData?: Record<string, unknown>;
|
|
63
|
+
}> | {
|
|
64
|
+
name?: string;
|
|
65
|
+
customData?: Record<string, unknown>;
|
|
66
|
+
};
|
|
67
|
+
onCustomerCreate?: (data: {
|
|
68
|
+
user: User;
|
|
69
|
+
customerId: string;
|
|
70
|
+
}) => Promise<void> | void;
|
|
71
|
+
subscription?: {
|
|
72
|
+
enabled: boolean;
|
|
73
|
+
plans: PaddlePlan[] | (() => Promise<PaddlePlan[]>);
|
|
74
|
+
requireEmailVerification?: boolean;
|
|
75
|
+
/** Let `checkout` start a subscription for a user who already has one. Default: false, so nobody is billed twice by accident. */
|
|
76
|
+
allowMultipleSubscriptions?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* How plan changes are billed. Set here, never by the caller, so a user can't pick a mode that skips the charge.
|
|
79
|
+
* A function decides per change. Default: "prorated_immediately".
|
|
80
|
+
*/
|
|
81
|
+
prorationBillingMode?: ProrationBillingMode | ((change: PlanChangeContext) => Promise<ProrationBillingMode> | ProrationBillingMode);
|
|
82
|
+
onSubscriptionCreated?: (data: AccessChangeContext & {
|
|
83
|
+
event: EventEntity;
|
|
84
|
+
}) => Promise<void> | void;
|
|
85
|
+
onSubscriptionUpdated?: (data: AccessChangeContext & {
|
|
86
|
+
event: EventEntity;
|
|
87
|
+
}) => Promise<void> | void;
|
|
88
|
+
onSubscriptionCanceled?: (data: AccessChangeContext & {
|
|
89
|
+
event: EventEntity;
|
|
90
|
+
}) => Promise<void> | void;
|
|
91
|
+
};
|
|
92
|
+
/** Revoke access when a subscription goes past_due. Default: false (dunning grace). */
|
|
93
|
+
revokePastDue?: boolean;
|
|
94
|
+
onGrantAccess?: (data: AccessChangeContext & {
|
|
95
|
+
reason: GrantReason;
|
|
96
|
+
}) => Promise<void> | void;
|
|
97
|
+
onRevokeAccess?: (data: AccessChangeContext & {
|
|
98
|
+
reason: RevokeReason;
|
|
99
|
+
}) => Promise<void> | void;
|
|
100
|
+
/** Catch-all for every verified webhook event. */
|
|
101
|
+
onEvent?: (event: EventEntity) => Promise<void> | void;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
interface SubscriptionPreviewResult {
|
|
105
|
+
subscriptionId: string;
|
|
106
|
+
currencyCode: string;
|
|
107
|
+
/** Amounts are minor-unit strings, as Paddle returns them. Null when nothing is billed or credited now. */
|
|
108
|
+
immediate: {
|
|
109
|
+
action: "charge" | "credit";
|
|
110
|
+
amount: string;
|
|
111
|
+
} | null;
|
|
112
|
+
next: {
|
|
113
|
+
amount: string;
|
|
114
|
+
billedAt: string | null;
|
|
115
|
+
} | null;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
interface TransactionSummary {
|
|
119
|
+
id: string;
|
|
120
|
+
status: string;
|
|
121
|
+
origin: string;
|
|
122
|
+
subscriptionId: string | null;
|
|
123
|
+
invoiceNumber: string | null;
|
|
124
|
+
currencyCode: string;
|
|
125
|
+
/** Grand total in minor units, tax included, as Paddle returns it. */
|
|
126
|
+
total: string | null;
|
|
127
|
+
billedAt: string | null;
|
|
128
|
+
createdAt: string;
|
|
129
|
+
}
|
|
130
|
+
interface TransactionListResult {
|
|
131
|
+
transactions: TransactionSummary[];
|
|
132
|
+
/** Pass back as `cursor` for the next page; null on the last page. */
|
|
133
|
+
nextCursor: string | null;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
declare const paddle: (options: PaddleOptions) => {
|
|
137
|
+
id: "paddle";
|
|
138
|
+
schema: better_auth.BetterAuthPluginDBSchema | undefined;
|
|
139
|
+
init(ctx: better_auth.AuthContext): {
|
|
140
|
+
options: {
|
|
141
|
+
databaseHooks: {
|
|
142
|
+
user: {
|
|
143
|
+
create: {
|
|
144
|
+
after: (user: {
|
|
145
|
+
id: string;
|
|
146
|
+
createdAt: Date;
|
|
147
|
+
updatedAt: Date;
|
|
148
|
+
email: string;
|
|
149
|
+
emailVerified: boolean;
|
|
150
|
+
name: string;
|
|
151
|
+
image?: string | null | undefined;
|
|
152
|
+
} & Record<string, unknown>) => Promise<void>;
|
|
153
|
+
};
|
|
154
|
+
update: {
|
|
155
|
+
after: (user: {
|
|
156
|
+
id: string;
|
|
157
|
+
createdAt: Date;
|
|
158
|
+
updatedAt: Date;
|
|
159
|
+
email: string;
|
|
160
|
+
emailVerified: boolean;
|
|
161
|
+
name: string;
|
|
162
|
+
image?: string | null | undefined;
|
|
163
|
+
} & Record<string, unknown>) => Promise<void>;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
endpoints: {
|
|
170
|
+
paddleCheckout: better_auth.StrictEndpoint<"/paddle/checkout", {
|
|
171
|
+
method: "POST";
|
|
172
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
173
|
+
session: {
|
|
174
|
+
session: Record<string, any> & {
|
|
175
|
+
id: string;
|
|
176
|
+
createdAt: Date;
|
|
177
|
+
updatedAt: Date;
|
|
178
|
+
userId: string;
|
|
179
|
+
expiresAt: Date;
|
|
180
|
+
token: string;
|
|
181
|
+
ipAddress?: string | null | undefined;
|
|
182
|
+
userAgent?: string | null | undefined;
|
|
183
|
+
};
|
|
184
|
+
user: Record<string, any> & {
|
|
185
|
+
id: string;
|
|
186
|
+
createdAt: Date;
|
|
187
|
+
updatedAt: Date;
|
|
188
|
+
email: string;
|
|
189
|
+
emailVerified: boolean;
|
|
190
|
+
name: string;
|
|
191
|
+
image?: string | null | undefined;
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
}>>[];
|
|
195
|
+
body: zod.ZodObject<{
|
|
196
|
+
plan: zod.ZodString;
|
|
197
|
+
annual: zod.ZodOptional<zod.ZodBoolean>;
|
|
198
|
+
quantity: zod.ZodDefault<zod.ZodNumber>;
|
|
199
|
+
customData: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodAny>>;
|
|
200
|
+
disableRedirect: zod.ZodOptional<zod.ZodBoolean>;
|
|
201
|
+
}, zod_v4_core.$strip>;
|
|
202
|
+
}, {
|
|
203
|
+
transactionId: string;
|
|
204
|
+
url: string;
|
|
205
|
+
redirect: boolean;
|
|
206
|
+
}>;
|
|
207
|
+
paddlePortal: better_auth.StrictEndpoint<"/paddle/portal", {
|
|
208
|
+
method: "POST";
|
|
209
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
210
|
+
session: {
|
|
211
|
+
session: Record<string, any> & {
|
|
212
|
+
id: string;
|
|
213
|
+
createdAt: Date;
|
|
214
|
+
updatedAt: Date;
|
|
215
|
+
userId: string;
|
|
216
|
+
expiresAt: Date;
|
|
217
|
+
token: string;
|
|
218
|
+
ipAddress?: string | null | undefined;
|
|
219
|
+
userAgent?: string | null | undefined;
|
|
220
|
+
};
|
|
221
|
+
user: Record<string, any> & {
|
|
222
|
+
id: string;
|
|
223
|
+
createdAt: Date;
|
|
224
|
+
updatedAt: Date;
|
|
225
|
+
email: string;
|
|
226
|
+
emailVerified: boolean;
|
|
227
|
+
name: string;
|
|
228
|
+
image?: string | null | undefined;
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
}>>[];
|
|
232
|
+
body: zod.ZodObject<{
|
|
233
|
+
subscriptionId: zod.ZodOptional<zod.ZodString>;
|
|
234
|
+
}, zod_v4_core.$strip>;
|
|
235
|
+
}, {
|
|
236
|
+
url: string;
|
|
237
|
+
cancelUrl: string | undefined;
|
|
238
|
+
updatePaymentMethodUrl: string | undefined;
|
|
239
|
+
}>;
|
|
240
|
+
paddleWebhook: better_auth.StrictEndpoint<"/paddle/webhook", {
|
|
241
|
+
method: "POST";
|
|
242
|
+
metadata: {
|
|
243
|
+
isAction: false;
|
|
244
|
+
};
|
|
245
|
+
cloneRequest: true;
|
|
246
|
+
}, {
|
|
247
|
+
received: boolean;
|
|
248
|
+
}>;
|
|
249
|
+
paddleSubscriptionList: better_auth.StrictEndpoint<"/paddle/subscription/list", {
|
|
250
|
+
method: "GET";
|
|
251
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
252
|
+
session: {
|
|
253
|
+
session: Record<string, any> & {
|
|
254
|
+
id: string;
|
|
255
|
+
createdAt: Date;
|
|
256
|
+
updatedAt: Date;
|
|
257
|
+
userId: string;
|
|
258
|
+
expiresAt: Date;
|
|
259
|
+
token: string;
|
|
260
|
+
ipAddress?: string | null | undefined;
|
|
261
|
+
userAgent?: string | null | undefined;
|
|
262
|
+
};
|
|
263
|
+
user: Record<string, any> & {
|
|
264
|
+
id: string;
|
|
265
|
+
createdAt: Date;
|
|
266
|
+
updatedAt: Date;
|
|
267
|
+
email: string;
|
|
268
|
+
emailVerified: boolean;
|
|
269
|
+
name: string;
|
|
270
|
+
image?: string | null | undefined;
|
|
271
|
+
};
|
|
272
|
+
};
|
|
273
|
+
}>>[];
|
|
274
|
+
}, SubscriptionRow[]>;
|
|
275
|
+
paddleSubscriptionCancel: better_auth.StrictEndpoint<"/paddle/subscription/cancel", {
|
|
276
|
+
method: "POST";
|
|
277
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
278
|
+
session: {
|
|
279
|
+
session: Record<string, any> & {
|
|
280
|
+
id: string;
|
|
281
|
+
createdAt: Date;
|
|
282
|
+
updatedAt: Date;
|
|
283
|
+
userId: string;
|
|
284
|
+
expiresAt: Date;
|
|
285
|
+
token: string;
|
|
286
|
+
ipAddress?: string | null | undefined;
|
|
287
|
+
userAgent?: string | null | undefined;
|
|
288
|
+
};
|
|
289
|
+
user: Record<string, any> & {
|
|
290
|
+
id: string;
|
|
291
|
+
createdAt: Date;
|
|
292
|
+
updatedAt: Date;
|
|
293
|
+
email: string;
|
|
294
|
+
emailVerified: boolean;
|
|
295
|
+
name: string;
|
|
296
|
+
image?: string | null | undefined;
|
|
297
|
+
};
|
|
298
|
+
};
|
|
299
|
+
}>>[];
|
|
300
|
+
body: zod.ZodObject<{
|
|
301
|
+
subscriptionId: zod.ZodOptional<zod.ZodString>;
|
|
302
|
+
effectiveFrom: zod.ZodDefault<zod.ZodEnum<{
|
|
303
|
+
next_billing_period: "next_billing_period";
|
|
304
|
+
immediately: "immediately";
|
|
305
|
+
}>>;
|
|
306
|
+
}, zod_v4_core.$strip>;
|
|
307
|
+
}, {
|
|
308
|
+
subscriptionId: string;
|
|
309
|
+
status: _paddle_paddle_node_sdk.SubscriptionStatus;
|
|
310
|
+
}>;
|
|
311
|
+
paddleSubscriptionRestore: better_auth.StrictEndpoint<"/paddle/subscription/restore", {
|
|
312
|
+
method: "POST";
|
|
313
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
314
|
+
session: {
|
|
315
|
+
session: Record<string, any> & {
|
|
316
|
+
id: string;
|
|
317
|
+
createdAt: Date;
|
|
318
|
+
updatedAt: Date;
|
|
319
|
+
userId: string;
|
|
320
|
+
expiresAt: Date;
|
|
321
|
+
token: string;
|
|
322
|
+
ipAddress?: string | null | undefined;
|
|
323
|
+
userAgent?: string | null | undefined;
|
|
324
|
+
};
|
|
325
|
+
user: Record<string, any> & {
|
|
326
|
+
id: string;
|
|
327
|
+
createdAt: Date;
|
|
328
|
+
updatedAt: Date;
|
|
329
|
+
email: string;
|
|
330
|
+
emailVerified: boolean;
|
|
331
|
+
name: string;
|
|
332
|
+
image?: string | null | undefined;
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
}>>[];
|
|
336
|
+
body: zod.ZodObject<{
|
|
337
|
+
subscriptionId: zod.ZodOptional<zod.ZodString>;
|
|
338
|
+
}, zod_v4_core.$strip>;
|
|
339
|
+
}, {
|
|
340
|
+
subscriptionId: string;
|
|
341
|
+
status: _paddle_paddle_node_sdk.SubscriptionStatus;
|
|
342
|
+
}>;
|
|
343
|
+
paddleSubscriptionUpdate: better_auth.StrictEndpoint<"/paddle/subscription/update", {
|
|
344
|
+
method: "POST";
|
|
345
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
346
|
+
session: {
|
|
347
|
+
session: Record<string, any> & {
|
|
348
|
+
id: string;
|
|
349
|
+
createdAt: Date;
|
|
350
|
+
updatedAt: Date;
|
|
351
|
+
userId: string;
|
|
352
|
+
expiresAt: Date;
|
|
353
|
+
token: string;
|
|
354
|
+
ipAddress?: string | null | undefined;
|
|
355
|
+
userAgent?: string | null | undefined;
|
|
356
|
+
};
|
|
357
|
+
user: Record<string, any> & {
|
|
358
|
+
id: string;
|
|
359
|
+
createdAt: Date;
|
|
360
|
+
updatedAt: Date;
|
|
361
|
+
email: string;
|
|
362
|
+
emailVerified: boolean;
|
|
363
|
+
name: string;
|
|
364
|
+
image?: string | null | undefined;
|
|
365
|
+
};
|
|
366
|
+
};
|
|
367
|
+
}>>[];
|
|
368
|
+
body: zod.ZodObject<{
|
|
369
|
+
subscriptionId: zod.ZodOptional<zod.ZodString>;
|
|
370
|
+
plan: zod.ZodString;
|
|
371
|
+
annual: zod.ZodOptional<zod.ZodBoolean>;
|
|
372
|
+
}, zod_v4_core.$strip>;
|
|
373
|
+
}, {
|
|
374
|
+
subscriptionId: string;
|
|
375
|
+
status: _paddle_paddle_node_sdk.SubscriptionStatus;
|
|
376
|
+
}>;
|
|
377
|
+
paddleSubscriptionPause: better_auth.StrictEndpoint<"/paddle/subscription/pause", {
|
|
378
|
+
method: "POST";
|
|
379
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
380
|
+
session: {
|
|
381
|
+
session: Record<string, any> & {
|
|
382
|
+
id: string;
|
|
383
|
+
createdAt: Date;
|
|
384
|
+
updatedAt: Date;
|
|
385
|
+
userId: string;
|
|
386
|
+
expiresAt: Date;
|
|
387
|
+
token: string;
|
|
388
|
+
ipAddress?: string | null | undefined;
|
|
389
|
+
userAgent?: string | null | undefined;
|
|
390
|
+
};
|
|
391
|
+
user: Record<string, any> & {
|
|
392
|
+
id: string;
|
|
393
|
+
createdAt: Date;
|
|
394
|
+
updatedAt: Date;
|
|
395
|
+
email: string;
|
|
396
|
+
emailVerified: boolean;
|
|
397
|
+
name: string;
|
|
398
|
+
image?: string | null | undefined;
|
|
399
|
+
};
|
|
400
|
+
};
|
|
401
|
+
}>>[];
|
|
402
|
+
body: zod.ZodObject<{
|
|
403
|
+
subscriptionId: zod.ZodOptional<zod.ZodString>;
|
|
404
|
+
effectiveFrom: zod.ZodDefault<zod.ZodEnum<{
|
|
405
|
+
next_billing_period: "next_billing_period";
|
|
406
|
+
immediately: "immediately";
|
|
407
|
+
}>>;
|
|
408
|
+
}, zod_v4_core.$strip>;
|
|
409
|
+
}, {
|
|
410
|
+
subscriptionId: string;
|
|
411
|
+
status: _paddle_paddle_node_sdk.SubscriptionStatus;
|
|
412
|
+
}>;
|
|
413
|
+
paddleSubscriptionResume: better_auth.StrictEndpoint<"/paddle/subscription/resume", {
|
|
414
|
+
method: "POST";
|
|
415
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
416
|
+
session: {
|
|
417
|
+
session: Record<string, any> & {
|
|
418
|
+
id: string;
|
|
419
|
+
createdAt: Date;
|
|
420
|
+
updatedAt: Date;
|
|
421
|
+
userId: string;
|
|
422
|
+
expiresAt: Date;
|
|
423
|
+
token: string;
|
|
424
|
+
ipAddress?: string | null | undefined;
|
|
425
|
+
userAgent?: string | null | undefined;
|
|
426
|
+
};
|
|
427
|
+
user: Record<string, any> & {
|
|
428
|
+
id: string;
|
|
429
|
+
createdAt: Date;
|
|
430
|
+
updatedAt: Date;
|
|
431
|
+
email: string;
|
|
432
|
+
emailVerified: boolean;
|
|
433
|
+
name: string;
|
|
434
|
+
image?: string | null | undefined;
|
|
435
|
+
};
|
|
436
|
+
};
|
|
437
|
+
}>>[];
|
|
438
|
+
body: zod.ZodObject<{
|
|
439
|
+
subscriptionId: zod.ZodOptional<zod.ZodString>;
|
|
440
|
+
onResume: zod.ZodOptional<zod.ZodEnum<{
|
|
441
|
+
start_new_billing_period: "start_new_billing_period";
|
|
442
|
+
continue_existing_billing_period: "continue_existing_billing_period";
|
|
443
|
+
}>>;
|
|
444
|
+
}, zod_v4_core.$strip>;
|
|
445
|
+
}, {
|
|
446
|
+
subscriptionId: string;
|
|
447
|
+
status: _paddle_paddle_node_sdk.SubscriptionStatus;
|
|
448
|
+
}>;
|
|
449
|
+
paddleSubscriptionPreview: better_auth.StrictEndpoint<"/paddle/subscription/preview", {
|
|
450
|
+
method: "POST";
|
|
451
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
452
|
+
session: {
|
|
453
|
+
session: Record<string, any> & {
|
|
454
|
+
id: string;
|
|
455
|
+
createdAt: Date;
|
|
456
|
+
updatedAt: Date;
|
|
457
|
+
userId: string;
|
|
458
|
+
expiresAt: Date;
|
|
459
|
+
token: string;
|
|
460
|
+
ipAddress?: string | null | undefined;
|
|
461
|
+
userAgent?: string | null | undefined;
|
|
462
|
+
};
|
|
463
|
+
user: Record<string, any> & {
|
|
464
|
+
id: string;
|
|
465
|
+
createdAt: Date;
|
|
466
|
+
updatedAt: Date;
|
|
467
|
+
email: string;
|
|
468
|
+
emailVerified: boolean;
|
|
469
|
+
name: string;
|
|
470
|
+
image?: string | null | undefined;
|
|
471
|
+
};
|
|
472
|
+
};
|
|
473
|
+
}>>[];
|
|
474
|
+
body: zod.ZodObject<{
|
|
475
|
+
subscriptionId: zod.ZodOptional<zod.ZodString>;
|
|
476
|
+
plan: zod.ZodString;
|
|
477
|
+
annual: zod.ZodOptional<zod.ZodBoolean>;
|
|
478
|
+
}, zod_v4_core.$strip>;
|
|
479
|
+
}, SubscriptionPreviewResult>;
|
|
480
|
+
paddleTransactionList: better_auth.StrictEndpoint<"/paddle/transaction/list", {
|
|
481
|
+
method: "GET";
|
|
482
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
483
|
+
session: {
|
|
484
|
+
session: Record<string, any> & {
|
|
485
|
+
id: string;
|
|
486
|
+
createdAt: Date;
|
|
487
|
+
updatedAt: Date;
|
|
488
|
+
userId: string;
|
|
489
|
+
expiresAt: Date;
|
|
490
|
+
token: string;
|
|
491
|
+
ipAddress?: string | null | undefined;
|
|
492
|
+
userAgent?: string | null | undefined;
|
|
493
|
+
};
|
|
494
|
+
user: Record<string, any> & {
|
|
495
|
+
id: string;
|
|
496
|
+
createdAt: Date;
|
|
497
|
+
updatedAt: Date;
|
|
498
|
+
email: string;
|
|
499
|
+
emailVerified: boolean;
|
|
500
|
+
name: string;
|
|
501
|
+
image?: string | null | undefined;
|
|
502
|
+
};
|
|
503
|
+
};
|
|
504
|
+
}>>[];
|
|
505
|
+
query: zod.ZodOptional<zod.ZodObject<{
|
|
506
|
+
cursor: zod.ZodOptional<zod.ZodString>;
|
|
507
|
+
perPage: zod.ZodOptional<zod.ZodCoercedNumber<unknown>>;
|
|
508
|
+
}, zod_v4_core.$strip>>;
|
|
509
|
+
}, TransactionListResult>;
|
|
510
|
+
paddleTransactionInvoice: better_auth.StrictEndpoint<"/paddle/transaction/invoice", {
|
|
511
|
+
method: "POST";
|
|
512
|
+
use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
|
|
513
|
+
session: {
|
|
514
|
+
session: Record<string, any> & {
|
|
515
|
+
id: string;
|
|
516
|
+
createdAt: Date;
|
|
517
|
+
updatedAt: Date;
|
|
518
|
+
userId: string;
|
|
519
|
+
expiresAt: Date;
|
|
520
|
+
token: string;
|
|
521
|
+
ipAddress?: string | null | undefined;
|
|
522
|
+
userAgent?: string | null | undefined;
|
|
523
|
+
};
|
|
524
|
+
user: Record<string, any> & {
|
|
525
|
+
id: string;
|
|
526
|
+
createdAt: Date;
|
|
527
|
+
updatedAt: Date;
|
|
528
|
+
email: string;
|
|
529
|
+
emailVerified: boolean;
|
|
530
|
+
name: string;
|
|
531
|
+
image?: string | null | undefined;
|
|
532
|
+
};
|
|
533
|
+
};
|
|
534
|
+
}>>[];
|
|
535
|
+
body: zod.ZodObject<{
|
|
536
|
+
transactionId: zod.ZodString;
|
|
537
|
+
disposition: zod.ZodOptional<zod.ZodEnum<{
|
|
538
|
+
attachment: "attachment";
|
|
539
|
+
inline: "inline";
|
|
540
|
+
}>>;
|
|
541
|
+
}, zod_v4_core.$strip>;
|
|
542
|
+
}, {
|
|
543
|
+
url: string;
|
|
544
|
+
}>;
|
|
545
|
+
};
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
export { paddle };
|
|
549
|
+
export type { PaddleOptions, PaddlePlan, PlanChangeContext, ProrationBillingMode, SubscriptionPreviewResult, SubscriptionRow, TransactionListResult, TransactionSummary };
|