@dodopayments/better-auth 0.1.1

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.
@@ -0,0 +1,304 @@
1
+ import type DodoPayments from "dodopayments";
2
+ import { z } from "zod";
3
+ import type { Product } from "../types";
4
+ export interface CheckoutOptions {
5
+ /**
6
+ * Optional list of slug -> productId mappings for easy slug checkouts
7
+ */
8
+ products?: Product[] | (() => Promise<Product[]>);
9
+ /**
10
+ * Checkout Success URL
11
+ */
12
+ successUrl?: string;
13
+ /**
14
+ * Only allow authenticated customers to checkout
15
+ */
16
+ authenticatedUsersOnly?: boolean;
17
+ }
18
+ export declare const checkout: (checkoutOptions?: CheckoutOptions) => (dodopayments: DodoPayments) => {
19
+ checkout: {
20
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
21
+ body: z.objectInputType<{
22
+ product_id: z.ZodOptional<z.ZodString>;
23
+ quantity: z.ZodOptional<z.ZodNumber>;
24
+ product_cart: z.ZodOptional<z.ZodArray<z.ZodObject<{
25
+ product_id: z.ZodString;
26
+ quantity: z.ZodNumber;
27
+ }, "strip", z.ZodTypeAny, {
28
+ quantity: number;
29
+ product_id: string;
30
+ }, {
31
+ quantity: number;
32
+ product_id: string;
33
+ }>, "many">>;
34
+ billing: z.ZodObject<{
35
+ city: z.ZodString;
36
+ country: z.ZodString;
37
+ state: z.ZodString;
38
+ street: z.ZodString;
39
+ zipcode: z.ZodString;
40
+ }, "strip", z.ZodTypeAny, {
41
+ country: string;
42
+ city: string;
43
+ state: string;
44
+ street: string;
45
+ zipcode: string;
46
+ }, {
47
+ country: string;
48
+ city: string;
49
+ state: string;
50
+ street: string;
51
+ zipcode: string;
52
+ }>;
53
+ customer: z.ZodObject<{
54
+ customer_id: z.ZodOptional<z.ZodString>;
55
+ email: z.ZodOptional<z.ZodString>;
56
+ name: z.ZodOptional<z.ZodString>;
57
+ }, "strip", z.ZodTypeAny, {
58
+ email?: string | undefined;
59
+ customer_id?: string | undefined;
60
+ name?: string | undefined;
61
+ }, {
62
+ email?: string | undefined;
63
+ customer_id?: string | undefined;
64
+ name?: string | undefined;
65
+ }>;
66
+ discount_id: z.ZodOptional<z.ZodString>;
67
+ addons: z.ZodOptional<z.ZodArray<z.ZodObject<{
68
+ addon_id: z.ZodString;
69
+ quantity: z.ZodNumber;
70
+ }, "strip", z.ZodTypeAny, {
71
+ quantity: number;
72
+ addon_id: string;
73
+ }, {
74
+ quantity: number;
75
+ addon_id: string;
76
+ }>, "many">>;
77
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
78
+ currency: z.ZodOptional<z.ZodString>;
79
+ } & {
80
+ slug: z.ZodOptional<z.ZodString>;
81
+ referenceId: z.ZodOptional<z.ZodString>;
82
+ }, z.ZodUnknown, "strip">;
83
+ } & {
84
+ method?: "POST" | undefined;
85
+ } & {
86
+ query?: Record<string, any> | undefined;
87
+ } & {
88
+ params?: Record<string, any>;
89
+ } & {
90
+ request: Request;
91
+ } & {
92
+ headers?: HeadersInit;
93
+ } & {
94
+ asResponse?: boolean;
95
+ returnHeaders?: boolean;
96
+ use?: import("better-call").Middleware[];
97
+ path?: string;
98
+ } & {
99
+ asResponse?: AsResponse | undefined;
100
+ returnHeaders?: ReturnHeaders | undefined;
101
+ }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
102
+ headers: Headers;
103
+ response: {
104
+ url: string;
105
+ redirect: boolean;
106
+ };
107
+ } : {
108
+ url: string;
109
+ redirect: boolean;
110
+ }>;
111
+ options: {
112
+ method: "POST";
113
+ body: z.ZodObject<{
114
+ product_id: z.ZodOptional<z.ZodString>;
115
+ quantity: z.ZodOptional<z.ZodNumber>;
116
+ product_cart: z.ZodOptional<z.ZodArray<z.ZodObject<{
117
+ product_id: z.ZodString;
118
+ quantity: z.ZodNumber;
119
+ }, "strip", z.ZodTypeAny, {
120
+ quantity: number;
121
+ product_id: string;
122
+ }, {
123
+ quantity: number;
124
+ product_id: string;
125
+ }>, "many">>;
126
+ billing: z.ZodObject<{
127
+ city: z.ZodString;
128
+ country: z.ZodString;
129
+ state: z.ZodString;
130
+ street: z.ZodString;
131
+ zipcode: z.ZodString;
132
+ }, "strip", z.ZodTypeAny, {
133
+ country: string;
134
+ city: string;
135
+ state: string;
136
+ street: string;
137
+ zipcode: string;
138
+ }, {
139
+ country: string;
140
+ city: string;
141
+ state: string;
142
+ street: string;
143
+ zipcode: string;
144
+ }>;
145
+ customer: z.ZodObject<{
146
+ customer_id: z.ZodOptional<z.ZodString>;
147
+ email: z.ZodOptional<z.ZodString>;
148
+ name: z.ZodOptional<z.ZodString>;
149
+ }, "strip", z.ZodTypeAny, {
150
+ email?: string | undefined;
151
+ customer_id?: string | undefined;
152
+ name?: string | undefined;
153
+ }, {
154
+ email?: string | undefined;
155
+ customer_id?: string | undefined;
156
+ name?: string | undefined;
157
+ }>;
158
+ discount_id: z.ZodOptional<z.ZodString>;
159
+ addons: z.ZodOptional<z.ZodArray<z.ZodObject<{
160
+ addon_id: z.ZodString;
161
+ quantity: z.ZodNumber;
162
+ }, "strip", z.ZodTypeAny, {
163
+ quantity: number;
164
+ addon_id: string;
165
+ }, {
166
+ quantity: number;
167
+ addon_id: string;
168
+ }>, "many">>;
169
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
170
+ currency: z.ZodOptional<z.ZodString>;
171
+ } & {
172
+ slug: z.ZodOptional<z.ZodString>;
173
+ referenceId: z.ZodOptional<z.ZodString>;
174
+ }, "strip", z.ZodUnknown, z.objectOutputType<{
175
+ product_id: z.ZodOptional<z.ZodString>;
176
+ quantity: z.ZodOptional<z.ZodNumber>;
177
+ product_cart: z.ZodOptional<z.ZodArray<z.ZodObject<{
178
+ product_id: z.ZodString;
179
+ quantity: z.ZodNumber;
180
+ }, "strip", z.ZodTypeAny, {
181
+ quantity: number;
182
+ product_id: string;
183
+ }, {
184
+ quantity: number;
185
+ product_id: string;
186
+ }>, "many">>;
187
+ billing: z.ZodObject<{
188
+ city: z.ZodString;
189
+ country: z.ZodString;
190
+ state: z.ZodString;
191
+ street: z.ZodString;
192
+ zipcode: z.ZodString;
193
+ }, "strip", z.ZodTypeAny, {
194
+ country: string;
195
+ city: string;
196
+ state: string;
197
+ street: string;
198
+ zipcode: string;
199
+ }, {
200
+ country: string;
201
+ city: string;
202
+ state: string;
203
+ street: string;
204
+ zipcode: string;
205
+ }>;
206
+ customer: z.ZodObject<{
207
+ customer_id: z.ZodOptional<z.ZodString>;
208
+ email: z.ZodOptional<z.ZodString>;
209
+ name: z.ZodOptional<z.ZodString>;
210
+ }, "strip", z.ZodTypeAny, {
211
+ email?: string | undefined;
212
+ customer_id?: string | undefined;
213
+ name?: string | undefined;
214
+ }, {
215
+ email?: string | undefined;
216
+ customer_id?: string | undefined;
217
+ name?: string | undefined;
218
+ }>;
219
+ discount_id: z.ZodOptional<z.ZodString>;
220
+ addons: z.ZodOptional<z.ZodArray<z.ZodObject<{
221
+ addon_id: z.ZodString;
222
+ quantity: z.ZodNumber;
223
+ }, "strip", z.ZodTypeAny, {
224
+ quantity: number;
225
+ addon_id: string;
226
+ }, {
227
+ quantity: number;
228
+ addon_id: string;
229
+ }>, "many">>;
230
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
231
+ currency: z.ZodOptional<z.ZodString>;
232
+ } & {
233
+ slug: z.ZodOptional<z.ZodString>;
234
+ referenceId: z.ZodOptional<z.ZodString>;
235
+ }, z.ZodUnknown, "strip">, z.objectInputType<{
236
+ product_id: z.ZodOptional<z.ZodString>;
237
+ quantity: z.ZodOptional<z.ZodNumber>;
238
+ product_cart: z.ZodOptional<z.ZodArray<z.ZodObject<{
239
+ product_id: z.ZodString;
240
+ quantity: z.ZodNumber;
241
+ }, "strip", z.ZodTypeAny, {
242
+ quantity: number;
243
+ product_id: string;
244
+ }, {
245
+ quantity: number;
246
+ product_id: string;
247
+ }>, "many">>;
248
+ billing: z.ZodObject<{
249
+ city: z.ZodString;
250
+ country: z.ZodString;
251
+ state: z.ZodString;
252
+ street: z.ZodString;
253
+ zipcode: z.ZodString;
254
+ }, "strip", z.ZodTypeAny, {
255
+ country: string;
256
+ city: string;
257
+ state: string;
258
+ street: string;
259
+ zipcode: string;
260
+ }, {
261
+ country: string;
262
+ city: string;
263
+ state: string;
264
+ street: string;
265
+ zipcode: string;
266
+ }>;
267
+ customer: z.ZodObject<{
268
+ customer_id: z.ZodOptional<z.ZodString>;
269
+ email: z.ZodOptional<z.ZodString>;
270
+ name: z.ZodOptional<z.ZodString>;
271
+ }, "strip", z.ZodTypeAny, {
272
+ email?: string | undefined;
273
+ customer_id?: string | undefined;
274
+ name?: string | undefined;
275
+ }, {
276
+ email?: string | undefined;
277
+ customer_id?: string | undefined;
278
+ name?: string | undefined;
279
+ }>;
280
+ discount_id: z.ZodOptional<z.ZodString>;
281
+ addons: z.ZodOptional<z.ZodArray<z.ZodObject<{
282
+ addon_id: z.ZodString;
283
+ quantity: z.ZodNumber;
284
+ }, "strip", z.ZodTypeAny, {
285
+ quantity: number;
286
+ addon_id: string;
287
+ }, {
288
+ quantity: number;
289
+ addon_id: string;
290
+ }>, "many">>;
291
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
292
+ currency: z.ZodOptional<z.ZodString>;
293
+ } & {
294
+ slug: z.ZodOptional<z.ZodString>;
295
+ referenceId: z.ZodOptional<z.ZodString>;
296
+ }, z.ZodUnknown, "strip">>;
297
+ requireRequest: true;
298
+ } & {
299
+ use: any[];
300
+ };
301
+ path: "/checkout";
302
+ };
303
+ };
304
+ //# sourceMappingURL=checkout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../src/plugins/checkout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,cAAc,CAAC;AAG7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAMxC,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAClD;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,eAAO,MAAM,QAAQ,GAClB,kBAAiB,eAAoB,MACrC,cAAc,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAsGqV,CAAC;+BAAyC,CAAC;wBAAkC,CAAC;;yBAA4C,CAAC;+BAAyC,CAAC;wBAAkC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAAo2Z,WAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAAxja,CAAC;+BAAyC,CAAC;wBAAkC,CAAC;;yBAA4C,CAAC;+BAAyC,CAAC;wBAAkC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAAxM,CAAC;+BAAyC,CAAC;wBAAkC,CAAC;;yBAA4C,CAAC;+BAAyC,CAAC;wBAAkC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAAxM,CAAC;+BAAyC,CAAC;wBAAkC,CAAC;;yBAA4C,CAAC;+BAAyC,CAAC;wBAAkC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;CADvjB,CAAC"}
@@ -0,0 +1,218 @@
1
+ import type { DodoPayments } from "dodopayments";
2
+ import { z } from "zod";
3
+ export declare const portal: () => (dodopayments: DodoPayments) => {
4
+ portal: {
5
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
6
+ body?: undefined;
7
+ } & {
8
+ method?: "GET" | undefined;
9
+ } & {
10
+ query?: Record<string, any> | undefined;
11
+ } & {
12
+ params?: Record<string, any>;
13
+ } & {
14
+ request?: Request;
15
+ } & {
16
+ headers?: HeadersInit;
17
+ } & {
18
+ asResponse?: boolean;
19
+ returnHeaders?: boolean;
20
+ use?: import("better-call").Middleware[];
21
+ path?: string;
22
+ } & {
23
+ asResponse?: AsResponse | undefined;
24
+ returnHeaders?: ReturnHeaders | undefined;
25
+ }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
26
+ headers: Headers;
27
+ response: {
28
+ url: string;
29
+ redirect: boolean;
30
+ };
31
+ } : {
32
+ url: string;
33
+ redirect: boolean;
34
+ }>;
35
+ options: {
36
+ method: "GET";
37
+ use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
38
+ session: {
39
+ session: Record<string, any> & {
40
+ id: string;
41
+ token: string;
42
+ userId: string;
43
+ expiresAt: Date;
44
+ createdAt: Date;
45
+ updatedAt: Date;
46
+ ipAddress?: string | null | undefined;
47
+ userAgent?: string | null | undefined;
48
+ };
49
+ user: Record<string, any> & {
50
+ id: string;
51
+ name: string;
52
+ emailVerified: boolean;
53
+ email: string;
54
+ createdAt: Date;
55
+ updatedAt: Date;
56
+ image?: string | null | undefined;
57
+ };
58
+ };
59
+ }>)[];
60
+ } & {
61
+ use: any[];
62
+ };
63
+ path: "/customer/portal";
64
+ };
65
+ subscriptions: {
66
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
67
+ body?: undefined;
68
+ } & {
69
+ method?: "GET" | undefined;
70
+ } & {
71
+ query?: {
72
+ status?: "active" | "cancelled" | "on_hold" | "pending" | "paused" | "failed" | "expired" | undefined;
73
+ page?: number | undefined;
74
+ limit?: number | undefined;
75
+ } | undefined;
76
+ } & {
77
+ params?: Record<string, any>;
78
+ } & {
79
+ request?: Request;
80
+ } & {
81
+ headers?: HeadersInit;
82
+ } & {
83
+ asResponse?: boolean;
84
+ returnHeaders?: boolean;
85
+ use?: import("better-call").Middleware[];
86
+ path?: string;
87
+ } & {
88
+ asResponse?: AsResponse | undefined;
89
+ returnHeaders?: ReturnHeaders | undefined;
90
+ }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
91
+ headers: Headers;
92
+ response: {
93
+ items: DodoPayments.Subscriptions.SubscriptionListResponse[];
94
+ };
95
+ } : {
96
+ items: DodoPayments.Subscriptions.SubscriptionListResponse[];
97
+ }>;
98
+ options: {
99
+ method: "GET";
100
+ query: z.ZodOptional<z.ZodObject<{
101
+ page: z.ZodOptional<z.ZodNumber>;
102
+ limit: z.ZodOptional<z.ZodNumber>;
103
+ status: z.ZodOptional<z.ZodEnum<["active", "cancelled", "on_hold", "pending", "paused", "failed", "expired"]>>;
104
+ }, "strip", z.ZodTypeAny, {
105
+ status?: "active" | "cancelled" | "on_hold" | "pending" | "paused" | "failed" | "expired" | undefined;
106
+ page?: number | undefined;
107
+ limit?: number | undefined;
108
+ }, {
109
+ status?: "active" | "cancelled" | "on_hold" | "pending" | "paused" | "failed" | "expired" | undefined;
110
+ page?: number | undefined;
111
+ limit?: number | undefined;
112
+ }>>;
113
+ use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
114
+ session: {
115
+ session: Record<string, any> & {
116
+ id: string;
117
+ token: string;
118
+ userId: string;
119
+ expiresAt: Date;
120
+ createdAt: Date;
121
+ updatedAt: Date;
122
+ ipAddress?: string | null | undefined;
123
+ userAgent?: string | null | undefined;
124
+ };
125
+ user: Record<string, any> & {
126
+ id: string;
127
+ name: string;
128
+ emailVerified: boolean;
129
+ email: string;
130
+ createdAt: Date;
131
+ updatedAt: Date;
132
+ image?: string | null | undefined;
133
+ };
134
+ };
135
+ }>)[];
136
+ } & {
137
+ use: any[];
138
+ };
139
+ path: "/customer/subscriptions/list";
140
+ };
141
+ payments: {
142
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
143
+ body?: undefined;
144
+ } & {
145
+ method?: "GET" | undefined;
146
+ } & {
147
+ query?: {
148
+ status?: "cancelled" | "failed" | "succeeded" | "processing" | "requires_customer_action" | "requires_merchant_action" | "requires_payment_method" | "requires_confirmation" | "requires_capture" | "partially_captured" | "partially_captured_and_capturable" | undefined;
149
+ page?: number | undefined;
150
+ limit?: number | undefined;
151
+ } | undefined;
152
+ } & {
153
+ params?: Record<string, any>;
154
+ } & {
155
+ request?: Request;
156
+ } & {
157
+ headers?: HeadersInit;
158
+ } & {
159
+ asResponse?: boolean;
160
+ returnHeaders?: boolean;
161
+ use?: import("better-call").Middleware[];
162
+ path?: string;
163
+ } & {
164
+ asResponse?: AsResponse | undefined;
165
+ returnHeaders?: ReturnHeaders | undefined;
166
+ }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
167
+ headers: Headers;
168
+ response: {
169
+ items: DodoPayments.Payments.PaymentListResponse[];
170
+ };
171
+ } : {
172
+ items: DodoPayments.Payments.PaymentListResponse[];
173
+ }>;
174
+ options: {
175
+ method: "GET";
176
+ query: z.ZodOptional<z.ZodObject<{
177
+ page: z.ZodOptional<z.ZodNumber>;
178
+ limit: z.ZodOptional<z.ZodNumber>;
179
+ status: z.ZodOptional<z.ZodEnum<["succeeded", "failed", "cancelled", "processing", "requires_customer_action", "requires_merchant_action", "requires_payment_method", "requires_confirmation", "requires_capture", "partially_captured", "partially_captured_and_capturable"]>>;
180
+ }, "strip", z.ZodTypeAny, {
181
+ status?: "cancelled" | "failed" | "succeeded" | "processing" | "requires_customer_action" | "requires_merchant_action" | "requires_payment_method" | "requires_confirmation" | "requires_capture" | "partially_captured" | "partially_captured_and_capturable" | undefined;
182
+ page?: number | undefined;
183
+ limit?: number | undefined;
184
+ }, {
185
+ status?: "cancelled" | "failed" | "succeeded" | "processing" | "requires_customer_action" | "requires_merchant_action" | "requires_payment_method" | "requires_confirmation" | "requires_capture" | "partially_captured" | "partially_captured_and_capturable" | undefined;
186
+ page?: number | undefined;
187
+ limit?: number | undefined;
188
+ }>>;
189
+ use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
190
+ session: {
191
+ session: Record<string, any> & {
192
+ id: string;
193
+ token: string;
194
+ userId: string;
195
+ expiresAt: Date;
196
+ createdAt: Date;
197
+ updatedAt: Date;
198
+ ipAddress?: string | null | undefined;
199
+ userAgent?: string | null | undefined;
200
+ };
201
+ user: Record<string, any> & {
202
+ id: string;
203
+ name: string;
204
+ emailVerified: boolean;
205
+ email: string;
206
+ createdAt: Date;
207
+ updatedAt: Date;
208
+ image?: string | null | undefined;
209
+ };
210
+ };
211
+ }>)[];
212
+ } & {
213
+ use: any[];
214
+ };
215
+ path: "/customer/payments/list";
216
+ };
217
+ };
218
+ //# sourceMappingURL=portal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../src/plugins/portal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAIjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,MAAM,SAAU,cAAc,YAAY;;;;;;;;;;;;;sBAuLuuX,WAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAAo6uF,CAAC;iCAAkD,CAAC;;;;;;;;;6BAA0Q,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;sBAA/uvF,WAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAAo6uF,CAAC;iCAAkD,CAAC;;;;;;;;;6BAA0Q,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;sBAA/uvF,WAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAAo6uF,CAAC;iCAAkD,CAAC;;;;;;;;;6BAA0Q,CAAC;;;;;;;;;CAD5gnG,CAAC"}
@@ -0,0 +1,45 @@
1
+ import type { DodoPayments } from "dodopayments";
2
+ import { WebhookHandlerConfig } from "@dodopayments/core/webhook";
3
+ export declare const webhooks: (options: WebhookHandlerConfig) => (_dodopayments: DodoPayments) => {
4
+ dodopaymentsWebhooks: {
5
+ <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
6
+ body?: undefined;
7
+ } & {
8
+ method?: "POST" | undefined;
9
+ } & {
10
+ query?: Record<string, any> | undefined;
11
+ } & {
12
+ params?: Record<string, any>;
13
+ } & {
14
+ request?: Request;
15
+ } & {
16
+ headers?: HeadersInit;
17
+ } & {
18
+ asResponse?: boolean;
19
+ returnHeaders?: boolean;
20
+ use?: import("better-call").Middleware[];
21
+ path?: string;
22
+ } & {
23
+ asResponse?: AsResponse | undefined;
24
+ returnHeaders?: ReturnHeaders | undefined;
25
+ }) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
26
+ headers: Headers;
27
+ response: {
28
+ received: boolean;
29
+ };
30
+ } : {
31
+ received: boolean;
32
+ }>;
33
+ options: {
34
+ method: "POST";
35
+ metadata: {
36
+ isAction: boolean;
37
+ };
38
+ cloneRequest: true;
39
+ } & {
40
+ use: any[];
41
+ };
42
+ path: "/webhooks/dodopayments";
43
+ };
44
+ };
45
+ //# sourceMappingURL=webhooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../src/plugins/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAEL,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AAKpC,eAAO,MAAM,QAAQ,GAClB,SAAS,oBAAoB,MAAM,eAAe,YAAY;;;;;;;;;;;;;sBA6E8id,WAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;CADxnd,CAAC"}
@@ -0,0 +1,33 @@
1
+ import type { DodoPayments } from "dodopayments";
2
+ import type { UnionToIntersection } from "better-auth";
3
+ import type { checkout } from "./plugins/checkout";
4
+ import type { portal } from "./plugins/portal";
5
+ import type { webhooks } from "./plugins/webhooks";
6
+ export type Product = {
7
+ /**
8
+ * Product Id from DodoPayments Product
9
+ */
10
+ productId: string;
11
+ /**
12
+ * Easily identifiable slug for the product
13
+ */
14
+ slug: string;
15
+ };
16
+ export type DodoPaymentsPlugin = ReturnType<typeof checkout> | ReturnType<typeof portal> | ReturnType<typeof webhooks>;
17
+ export type DodoPaymentsPlugins = [DodoPaymentsPlugin, ...DodoPaymentsPlugin[]];
18
+ export type DodoPaymentsEndpoints = UnionToIntersection<ReturnType<DodoPaymentsPlugin>>;
19
+ export interface DodoPaymentsOptions {
20
+ /**
21
+ * DodoPayments Client
22
+ */
23
+ client: DodoPayments;
24
+ /**
25
+ * Enable customer creation when a user signs up
26
+ */
27
+ createCustomerOnSignUp?: boolean;
28
+ /**
29
+ * Use DodoPayments plugins
30
+ */
31
+ use: DodoPaymentsPlugins;
32
+ }
33
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,KAAK,EAAE,mBAAmB,EAAQ,MAAM,aAAa,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,MAAM,OAAO,GAAG;IACpB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAC1B,UAAU,CAAC,OAAO,QAAQ,CAAC,GAC3B,UAAU,CAAC,OAAO,MAAM,CAAC,GACzB,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhC,MAAM,MAAM,mBAAmB,GAAG,CAAC,kBAAkB,EAAE,GAAG,kBAAkB,EAAE,CAAC,CAAC;AAEhF,MAAM,MAAM,qBAAqB,GAAG,mBAAmB,CACrD,UAAU,CAAC,kBAAkB,CAAC,CAC/B,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,MAAM,EAAE,YAAY,CAAC;IACrB;;OAEG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC;;OAEG;IACH,GAAG,EAAE,mBAAmB,CAAC;CAC1B"}
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@dodopayments/better-auth",
3
+ "version": "0.1.1",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "scripts": {
8
+ "build": "rollup -c",
9
+ "dev": "rollup -c -w",
10
+ "format": "prettier --write .",
11
+ "check-format": "prettier --check .",
12
+ "check-types": "tsc --noEmit"
13
+ },
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js",
18
+ "require": "./dist/index.cjs"
19
+ }
20
+ },
21
+ "dependencies": {
22
+ "@dodopayments/core": "*"
23
+ },
24
+ "keywords": [
25
+ "dodopayments",
26
+ "better-auth",
27
+ "payments",
28
+ "webhooks",
29
+ "checkout",
30
+ "api",
31
+ "typescript"
32
+ ],
33
+ "author": {
34
+ "name": "Dodo Payments",
35
+ "email": "support@dodopayments.com",
36
+ "url": "https://dodopayments.com"
37
+ },
38
+ "devDependencies": {
39
+ "@dodo/typescript-config": "*",
40
+ "@rollup/plugin-commonjs": "^25.0.0",
41
+ "@rollup/plugin-node-resolve": "^15.0.0",
42
+ "@rollup/plugin-typescript": "^11.0.0",
43
+ "rimraf": "^5.0.0",
44
+ "rollup": "^4.0.0",
45
+ "rollup-plugin-dts": "^6.1.0"
46
+ },
47
+ "peerDependencies": {
48
+ "dodopayments": "^1.42.0",
49
+ "zod": "^3.25.73"
50
+ },
51
+ "type": "module",
52
+ "files": [
53
+ "dist",
54
+ "llm-prompt.txt"
55
+ ]
56
+ }