@dodopayments/better-auth 1.2.0 → 1.3.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.
- package/dist/index.d.ts +372 -124
- package/dist/plugins/checkout.d.ts +252 -1
- package/dist/plugins/checkout.js +89 -6
- package/dist/plugins/portal.d.ts +1 -1
- package/dist/plugins/portal.js +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -9,26 +9,26 @@ export declare const dodopayments: (options: DodoPaymentsOptions) => {
|
|
|
9
9
|
endpoints: {
|
|
10
10
|
checkout: {
|
|
11
11
|
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
12
|
-
body: import("zod").objectInputType<{
|
|
13
|
-
product_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
14
|
-
quantity: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
15
|
-
product_cart: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
16
|
-
product_id: import("zod").ZodString;
|
|
17
|
-
quantity: import("zod").ZodNumber;
|
|
18
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
12
|
+
body: import("zod/v3").objectInputType<{
|
|
13
|
+
product_id: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
14
|
+
quantity: import("zod/v3").ZodOptional<import("zod/v3").ZodNumber>;
|
|
15
|
+
product_cart: import("zod/v3").ZodOptional<import("zod/v3").ZodArray<import("zod/v3").ZodObject<{
|
|
16
|
+
product_id: import("zod/v3").ZodString;
|
|
17
|
+
quantity: import("zod/v3").ZodNumber;
|
|
18
|
+
}, "strip", import("zod/v3").ZodTypeAny, {
|
|
19
19
|
quantity: number;
|
|
20
20
|
product_id: string;
|
|
21
21
|
}, {
|
|
22
22
|
quantity: number;
|
|
23
23
|
product_id: string;
|
|
24
24
|
}>, "many">>;
|
|
25
|
-
billing: import("zod").ZodObject<{
|
|
26
|
-
city: import("zod").ZodString;
|
|
27
|
-
country: import("zod").ZodString;
|
|
28
|
-
state: import("zod").ZodString;
|
|
29
|
-
street: import("zod").ZodString;
|
|
30
|
-
zipcode: import("zod").ZodString;
|
|
31
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
25
|
+
billing: import("zod/v3").ZodObject<{
|
|
26
|
+
city: import("zod/v3").ZodString;
|
|
27
|
+
country: import("zod/v3").ZodString;
|
|
28
|
+
state: import("zod/v3").ZodString;
|
|
29
|
+
street: import("zod/v3").ZodString;
|
|
30
|
+
zipcode: import("zod/v3").ZodString;
|
|
31
|
+
}, "strip", import("zod/v3").ZodTypeAny, {
|
|
32
32
|
country: string;
|
|
33
33
|
city: string;
|
|
34
34
|
state: string;
|
|
@@ -41,11 +41,11 @@ export declare const dodopayments: (options: DodoPaymentsOptions) => {
|
|
|
41
41
|
street: string;
|
|
42
42
|
zipcode: string;
|
|
43
43
|
}>;
|
|
44
|
-
customer: import("zod").ZodObject<{
|
|
45
|
-
customer_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
46
|
-
email: import("zod").ZodOptional<import("zod").ZodString>;
|
|
47
|
-
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
48
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
44
|
+
customer: import("zod/v3").ZodObject<{
|
|
45
|
+
customer_id: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
46
|
+
email: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
47
|
+
name: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
48
|
+
}, "strip", import("zod/v3").ZodTypeAny, {
|
|
49
49
|
email?: string | undefined;
|
|
50
50
|
customer_id?: string | undefined;
|
|
51
51
|
name?: string | undefined;
|
|
@@ -54,23 +54,23 @@ export declare const dodopayments: (options: DodoPaymentsOptions) => {
|
|
|
54
54
|
customer_id?: string | undefined;
|
|
55
55
|
name?: string | undefined;
|
|
56
56
|
}>;
|
|
57
|
-
discount_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
58
|
-
addons: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
59
|
-
addon_id: import("zod").ZodString;
|
|
60
|
-
quantity: import("zod").ZodNumber;
|
|
61
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
57
|
+
discount_id: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
58
|
+
addons: import("zod/v3").ZodOptional<import("zod/v3").ZodArray<import("zod/v3").ZodObject<{
|
|
59
|
+
addon_id: import("zod/v3").ZodString;
|
|
60
|
+
quantity: import("zod/v3").ZodNumber;
|
|
61
|
+
}, "strip", import("zod/v3").ZodTypeAny, {
|
|
62
62
|
quantity: number;
|
|
63
63
|
addon_id: string;
|
|
64
64
|
}, {
|
|
65
65
|
quantity: number;
|
|
66
66
|
addon_id: string;
|
|
67
67
|
}>, "many">>;
|
|
68
|
-
metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
69
|
-
currency: import("zod").ZodOptional<import("zod").ZodString>;
|
|
68
|
+
metadata: import("zod/v3").ZodOptional<import("zod/v3").ZodRecord<import("zod/v3").ZodString, import("zod/v3").ZodString>>;
|
|
69
|
+
currency: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
70
70
|
} & {
|
|
71
|
-
slug: import("zod").ZodOptional<import("zod").ZodString>;
|
|
72
|
-
referenceId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
73
|
-
}, import("zod").ZodUnknown, "strip">;
|
|
71
|
+
slug: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
72
|
+
referenceId: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
73
|
+
}, import("zod/v3").ZodUnknown, "strip">;
|
|
74
74
|
} & {
|
|
75
75
|
method?: "POST" | undefined;
|
|
76
76
|
} & {
|
|
@@ -95,26 +95,26 @@ export declare const dodopayments: (options: DodoPaymentsOptions) => {
|
|
|
95
95
|
} : import("./types").CreateCheckoutResponse>;
|
|
96
96
|
options: {
|
|
97
97
|
method: "POST";
|
|
98
|
-
body: import("zod").ZodObject<{
|
|
99
|
-
product_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
100
|
-
quantity: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
101
|
-
product_cart: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
102
|
-
product_id: import("zod").ZodString;
|
|
103
|
-
quantity: import("zod").ZodNumber;
|
|
104
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
98
|
+
body: import("zod/v3").ZodObject<{
|
|
99
|
+
product_id: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
100
|
+
quantity: import("zod/v3").ZodOptional<import("zod/v3").ZodNumber>;
|
|
101
|
+
product_cart: import("zod/v3").ZodOptional<import("zod/v3").ZodArray<import("zod/v3").ZodObject<{
|
|
102
|
+
product_id: import("zod/v3").ZodString;
|
|
103
|
+
quantity: import("zod/v3").ZodNumber;
|
|
104
|
+
}, "strip", import("zod/v3").ZodTypeAny, {
|
|
105
105
|
quantity: number;
|
|
106
106
|
product_id: string;
|
|
107
107
|
}, {
|
|
108
108
|
quantity: number;
|
|
109
109
|
product_id: string;
|
|
110
110
|
}>, "many">>;
|
|
111
|
-
billing: import("zod").ZodObject<{
|
|
112
|
-
city: import("zod").ZodString;
|
|
113
|
-
country: import("zod").ZodString;
|
|
114
|
-
state: import("zod").ZodString;
|
|
115
|
-
street: import("zod").ZodString;
|
|
116
|
-
zipcode: import("zod").ZodString;
|
|
117
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
111
|
+
billing: import("zod/v3").ZodObject<{
|
|
112
|
+
city: import("zod/v3").ZodString;
|
|
113
|
+
country: import("zod/v3").ZodString;
|
|
114
|
+
state: import("zod/v3").ZodString;
|
|
115
|
+
street: import("zod/v3").ZodString;
|
|
116
|
+
zipcode: import("zod/v3").ZodString;
|
|
117
|
+
}, "strip", import("zod/v3").ZodTypeAny, {
|
|
118
118
|
country: string;
|
|
119
119
|
city: string;
|
|
120
120
|
state: string;
|
|
@@ -127,11 +127,11 @@ export declare const dodopayments: (options: DodoPaymentsOptions) => {
|
|
|
127
127
|
street: string;
|
|
128
128
|
zipcode: string;
|
|
129
129
|
}>;
|
|
130
|
-
customer: import("zod").ZodObject<{
|
|
131
|
-
customer_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
132
|
-
email: import("zod").ZodOptional<import("zod").ZodString>;
|
|
133
|
-
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
134
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
130
|
+
customer: import("zod/v3").ZodObject<{
|
|
131
|
+
customer_id: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
132
|
+
email: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
133
|
+
name: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
134
|
+
}, "strip", import("zod/v3").ZodTypeAny, {
|
|
135
135
|
email?: string | undefined;
|
|
136
136
|
customer_id?: string | undefined;
|
|
137
137
|
name?: string | undefined;
|
|
@@ -140,42 +140,42 @@ export declare const dodopayments: (options: DodoPaymentsOptions) => {
|
|
|
140
140
|
customer_id?: string | undefined;
|
|
141
141
|
name?: string | undefined;
|
|
142
142
|
}>;
|
|
143
|
-
discount_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
144
|
-
addons: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
145
|
-
addon_id: import("zod").ZodString;
|
|
146
|
-
quantity: import("zod").ZodNumber;
|
|
147
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
143
|
+
discount_id: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
144
|
+
addons: import("zod/v3").ZodOptional<import("zod/v3").ZodArray<import("zod/v3").ZodObject<{
|
|
145
|
+
addon_id: import("zod/v3").ZodString;
|
|
146
|
+
quantity: import("zod/v3").ZodNumber;
|
|
147
|
+
}, "strip", import("zod/v3").ZodTypeAny, {
|
|
148
148
|
quantity: number;
|
|
149
149
|
addon_id: string;
|
|
150
150
|
}, {
|
|
151
151
|
quantity: number;
|
|
152
152
|
addon_id: string;
|
|
153
153
|
}>, "many">>;
|
|
154
|
-
metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
155
|
-
currency: import("zod").ZodOptional<import("zod").ZodString>;
|
|
154
|
+
metadata: import("zod/v3").ZodOptional<import("zod/v3").ZodRecord<import("zod/v3").ZodString, import("zod/v3").ZodString>>;
|
|
155
|
+
currency: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
156
156
|
} & {
|
|
157
|
-
slug: import("zod").ZodOptional<import("zod").ZodString>;
|
|
158
|
-
referenceId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
159
|
-
}, "strip", import("zod").ZodUnknown, import("zod").objectOutputType<{
|
|
160
|
-
product_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
161
|
-
quantity: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
162
|
-
product_cart: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
163
|
-
product_id: import("zod").ZodString;
|
|
164
|
-
quantity: import("zod").ZodNumber;
|
|
165
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
157
|
+
slug: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
158
|
+
referenceId: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
159
|
+
}, "strip", import("zod/v3").ZodUnknown, import("zod/v3").objectOutputType<{
|
|
160
|
+
product_id: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
161
|
+
quantity: import("zod/v3").ZodOptional<import("zod/v3").ZodNumber>;
|
|
162
|
+
product_cart: import("zod/v3").ZodOptional<import("zod/v3").ZodArray<import("zod/v3").ZodObject<{
|
|
163
|
+
product_id: import("zod/v3").ZodString;
|
|
164
|
+
quantity: import("zod/v3").ZodNumber;
|
|
165
|
+
}, "strip", import("zod/v3").ZodTypeAny, {
|
|
166
166
|
quantity: number;
|
|
167
167
|
product_id: string;
|
|
168
168
|
}, {
|
|
169
169
|
quantity: number;
|
|
170
170
|
product_id: string;
|
|
171
171
|
}>, "many">>;
|
|
172
|
-
billing: import("zod").ZodObject<{
|
|
173
|
-
city: import("zod").ZodString;
|
|
174
|
-
country: import("zod").ZodString;
|
|
175
|
-
state: import("zod").ZodString;
|
|
176
|
-
street: import("zod").ZodString;
|
|
177
|
-
zipcode: import("zod").ZodString;
|
|
178
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
172
|
+
billing: import("zod/v3").ZodObject<{
|
|
173
|
+
city: import("zod/v3").ZodString;
|
|
174
|
+
country: import("zod/v3").ZodString;
|
|
175
|
+
state: import("zod/v3").ZodString;
|
|
176
|
+
street: import("zod/v3").ZodString;
|
|
177
|
+
zipcode: import("zod/v3").ZodString;
|
|
178
|
+
}, "strip", import("zod/v3").ZodTypeAny, {
|
|
179
179
|
country: string;
|
|
180
180
|
city: string;
|
|
181
181
|
state: string;
|
|
@@ -188,11 +188,11 @@ export declare const dodopayments: (options: DodoPaymentsOptions) => {
|
|
|
188
188
|
street: string;
|
|
189
189
|
zipcode: string;
|
|
190
190
|
}>;
|
|
191
|
-
customer: import("zod").ZodObject<{
|
|
192
|
-
customer_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
193
|
-
email: import("zod").ZodOptional<import("zod").ZodString>;
|
|
194
|
-
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
195
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
191
|
+
customer: import("zod/v3").ZodObject<{
|
|
192
|
+
customer_id: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
193
|
+
email: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
194
|
+
name: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
195
|
+
}, "strip", import("zod/v3").ZodTypeAny, {
|
|
196
196
|
email?: string | undefined;
|
|
197
197
|
customer_id?: string | undefined;
|
|
198
198
|
name?: string | undefined;
|
|
@@ -201,42 +201,42 @@ export declare const dodopayments: (options: DodoPaymentsOptions) => {
|
|
|
201
201
|
customer_id?: string | undefined;
|
|
202
202
|
name?: string | undefined;
|
|
203
203
|
}>;
|
|
204
|
-
discount_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
205
|
-
addons: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
206
|
-
addon_id: import("zod").ZodString;
|
|
207
|
-
quantity: import("zod").ZodNumber;
|
|
208
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
204
|
+
discount_id: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
205
|
+
addons: import("zod/v3").ZodOptional<import("zod/v3").ZodArray<import("zod/v3").ZodObject<{
|
|
206
|
+
addon_id: import("zod/v3").ZodString;
|
|
207
|
+
quantity: import("zod/v3").ZodNumber;
|
|
208
|
+
}, "strip", import("zod/v3").ZodTypeAny, {
|
|
209
209
|
quantity: number;
|
|
210
210
|
addon_id: string;
|
|
211
211
|
}, {
|
|
212
212
|
quantity: number;
|
|
213
213
|
addon_id: string;
|
|
214
214
|
}>, "many">>;
|
|
215
|
-
metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
216
|
-
currency: import("zod").ZodOptional<import("zod").ZodString>;
|
|
215
|
+
metadata: import("zod/v3").ZodOptional<import("zod/v3").ZodRecord<import("zod/v3").ZodString, import("zod/v3").ZodString>>;
|
|
216
|
+
currency: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
217
217
|
} & {
|
|
218
|
-
slug: import("zod").ZodOptional<import("zod").ZodString>;
|
|
219
|
-
referenceId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
220
|
-
}, import("zod").ZodUnknown, "strip">, import("zod").objectInputType<{
|
|
221
|
-
product_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
222
|
-
quantity: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
223
|
-
product_cart: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
224
|
-
product_id: import("zod").ZodString;
|
|
225
|
-
quantity: import("zod").ZodNumber;
|
|
226
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
218
|
+
slug: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
219
|
+
referenceId: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
220
|
+
}, import("zod/v3").ZodUnknown, "strip">, import("zod/v3").objectInputType<{
|
|
221
|
+
product_id: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
222
|
+
quantity: import("zod/v3").ZodOptional<import("zod/v3").ZodNumber>;
|
|
223
|
+
product_cart: import("zod/v3").ZodOptional<import("zod/v3").ZodArray<import("zod/v3").ZodObject<{
|
|
224
|
+
product_id: import("zod/v3").ZodString;
|
|
225
|
+
quantity: import("zod/v3").ZodNumber;
|
|
226
|
+
}, "strip", import("zod/v3").ZodTypeAny, {
|
|
227
227
|
quantity: number;
|
|
228
228
|
product_id: string;
|
|
229
229
|
}, {
|
|
230
230
|
quantity: number;
|
|
231
231
|
product_id: string;
|
|
232
232
|
}>, "many">>;
|
|
233
|
-
billing: import("zod").ZodObject<{
|
|
234
|
-
city: import("zod").ZodString;
|
|
235
|
-
country: import("zod").ZodString;
|
|
236
|
-
state: import("zod").ZodString;
|
|
237
|
-
street: import("zod").ZodString;
|
|
238
|
-
zipcode: import("zod").ZodString;
|
|
239
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
233
|
+
billing: import("zod/v3").ZodObject<{
|
|
234
|
+
city: import("zod/v3").ZodString;
|
|
235
|
+
country: import("zod/v3").ZodString;
|
|
236
|
+
state: import("zod/v3").ZodString;
|
|
237
|
+
street: import("zod/v3").ZodString;
|
|
238
|
+
zipcode: import("zod/v3").ZodString;
|
|
239
|
+
}, "strip", import("zod/v3").ZodTypeAny, {
|
|
240
240
|
country: string;
|
|
241
241
|
city: string;
|
|
242
242
|
state: string;
|
|
@@ -249,11 +249,11 @@ export declare const dodopayments: (options: DodoPaymentsOptions) => {
|
|
|
249
249
|
street: string;
|
|
250
250
|
zipcode: string;
|
|
251
251
|
}>;
|
|
252
|
-
customer: import("zod").ZodObject<{
|
|
253
|
-
customer_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
254
|
-
email: import("zod").ZodOptional<import("zod").ZodString>;
|
|
255
|
-
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
256
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
252
|
+
customer: import("zod/v3").ZodObject<{
|
|
253
|
+
customer_id: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
254
|
+
email: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
255
|
+
name: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
256
|
+
}, "strip", import("zod/v3").ZodTypeAny, {
|
|
257
257
|
email?: string | undefined;
|
|
258
258
|
customer_id?: string | undefined;
|
|
259
259
|
name?: string | undefined;
|
|
@@ -262,29 +262,277 @@ export declare const dodopayments: (options: DodoPaymentsOptions) => {
|
|
|
262
262
|
customer_id?: string | undefined;
|
|
263
263
|
name?: string | undefined;
|
|
264
264
|
}>;
|
|
265
|
-
discount_id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
266
|
-
addons: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
267
|
-
addon_id: import("zod").ZodString;
|
|
268
|
-
quantity: import("zod").ZodNumber;
|
|
269
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
265
|
+
discount_id: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
266
|
+
addons: import("zod/v3").ZodOptional<import("zod/v3").ZodArray<import("zod/v3").ZodObject<{
|
|
267
|
+
addon_id: import("zod/v3").ZodString;
|
|
268
|
+
quantity: import("zod/v3").ZodNumber;
|
|
269
|
+
}, "strip", import("zod/v3").ZodTypeAny, {
|
|
270
270
|
quantity: number;
|
|
271
271
|
addon_id: string;
|
|
272
272
|
}, {
|
|
273
273
|
quantity: number;
|
|
274
274
|
addon_id: string;
|
|
275
275
|
}>, "many">>;
|
|
276
|
-
metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
277
|
-
currency: import("zod").ZodOptional<import("zod").ZodString>;
|
|
276
|
+
metadata: import("zod/v3").ZodOptional<import("zod/v3").ZodRecord<import("zod/v3").ZodString, import("zod/v3").ZodString>>;
|
|
277
|
+
currency: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
278
278
|
} & {
|
|
279
|
-
slug: import("zod").ZodOptional<import("zod").ZodString>;
|
|
280
|
-
referenceId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
281
|
-
}, import("zod").ZodUnknown, "strip">>;
|
|
279
|
+
slug: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
280
|
+
referenceId: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
281
|
+
}, import("zod/v3").ZodUnknown, "strip">>;
|
|
282
282
|
requireRequest: true;
|
|
283
283
|
} & {
|
|
284
284
|
use: any[];
|
|
285
285
|
};
|
|
286
286
|
path: "/dodopayments/checkout";
|
|
287
287
|
};
|
|
288
|
+
checkoutSession: {
|
|
289
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
290
|
+
body: {
|
|
291
|
+
product_cart?: {
|
|
292
|
+
quantity: number;
|
|
293
|
+
product_id: string;
|
|
294
|
+
}[] | undefined;
|
|
295
|
+
customer?: {
|
|
296
|
+
email?: string | undefined;
|
|
297
|
+
name?: string | undefined;
|
|
298
|
+
phone_number?: string | undefined;
|
|
299
|
+
} | undefined;
|
|
300
|
+
metadata?: Record<string, string> | undefined;
|
|
301
|
+
slug?: string | undefined;
|
|
302
|
+
referenceId?: string | undefined;
|
|
303
|
+
billing_address?: {
|
|
304
|
+
country: string;
|
|
305
|
+
city?: string | undefined;
|
|
306
|
+
state?: string | undefined;
|
|
307
|
+
street?: string | undefined;
|
|
308
|
+
zipcode?: string | undefined;
|
|
309
|
+
} | undefined;
|
|
310
|
+
return_url?: string | undefined;
|
|
311
|
+
allowed_payment_method_types?: ("credit" | "debit" | "upi_collect" | "upi_intent" | "apple_pay" | "google_pay" | "amazon_pay" | "klarna" | "affirm" | "afterpay_clearpay" | "sepa" | "ach")[] | undefined;
|
|
312
|
+
billing_currency?: string | undefined;
|
|
313
|
+
show_saved_payment_methods?: boolean | undefined;
|
|
314
|
+
confirm?: boolean | undefined;
|
|
315
|
+
discount_code?: string | undefined;
|
|
316
|
+
customization?: {
|
|
317
|
+
theme?: "light" | "dark" | "system" | undefined;
|
|
318
|
+
show_order_details?: boolean | undefined;
|
|
319
|
+
show_on_demand_tag?: boolean | undefined;
|
|
320
|
+
} | undefined;
|
|
321
|
+
feature_flags?: {
|
|
322
|
+
allow_currency_selection?: boolean | undefined;
|
|
323
|
+
allow_discount_code?: boolean | undefined;
|
|
324
|
+
allow_phone_number_collection?: boolean | undefined;
|
|
325
|
+
allow_tax_id?: boolean | undefined;
|
|
326
|
+
always_create_new_customer?: boolean | undefined;
|
|
327
|
+
} | undefined;
|
|
328
|
+
subscription_data?: {
|
|
329
|
+
trial_period_days?: number | undefined;
|
|
330
|
+
} | undefined;
|
|
331
|
+
};
|
|
332
|
+
} & {
|
|
333
|
+
method?: "POST" | undefined;
|
|
334
|
+
} & {
|
|
335
|
+
query?: Record<string, any> | undefined;
|
|
336
|
+
} & {
|
|
337
|
+
params?: Record<string, any>;
|
|
338
|
+
} & {
|
|
339
|
+
request: Request;
|
|
340
|
+
} & {
|
|
341
|
+
headers?: HeadersInit;
|
|
342
|
+
} & {
|
|
343
|
+
asResponse?: boolean;
|
|
344
|
+
returnHeaders?: boolean;
|
|
345
|
+
use?: import("better-call").Middleware[];
|
|
346
|
+
path?: string;
|
|
347
|
+
} & {
|
|
348
|
+
asResponse?: AsResponse | undefined;
|
|
349
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
350
|
+
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
351
|
+
headers: Headers;
|
|
352
|
+
response: import("./types").CreateCheckoutResponse;
|
|
353
|
+
} : import("./types").CreateCheckoutResponse>;
|
|
354
|
+
options: {
|
|
355
|
+
method: "POST";
|
|
356
|
+
body: import("zod/v3").ZodObject<{
|
|
357
|
+
product_cart: import("zod/v3").ZodOptional<import("zod/v3").ZodArray<import("zod/v3").ZodObject<{
|
|
358
|
+
product_id: import("zod/v3").ZodString;
|
|
359
|
+
quantity: import("zod/v3").ZodNumber;
|
|
360
|
+
}, "strip", import("zod/v3").ZodTypeAny, {
|
|
361
|
+
quantity: number;
|
|
362
|
+
product_id: string;
|
|
363
|
+
}, {
|
|
364
|
+
quantity: number;
|
|
365
|
+
product_id: string;
|
|
366
|
+
}>, "many">>;
|
|
367
|
+
customer: import("zod/v3").ZodOptional<import("zod/v3").ZodObject<{
|
|
368
|
+
email: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
369
|
+
name: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
370
|
+
phone_number: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
371
|
+
}, "strip", import("zod/v3").ZodTypeAny, {
|
|
372
|
+
email?: string | undefined;
|
|
373
|
+
name?: string | undefined;
|
|
374
|
+
phone_number?: string | undefined;
|
|
375
|
+
}, {
|
|
376
|
+
email?: string | undefined;
|
|
377
|
+
name?: string | undefined;
|
|
378
|
+
phone_number?: string | undefined;
|
|
379
|
+
}>>;
|
|
380
|
+
metadata: import("zod/v3").ZodOptional<import("zod/v3").ZodRecord<import("zod/v3").ZodString, import("zod/v3").ZodString>>;
|
|
381
|
+
slug: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
382
|
+
referenceId: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
383
|
+
billing_address: import("zod/v3").ZodOptional<import("zod/v3").ZodObject<{
|
|
384
|
+
street: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
385
|
+
city: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
386
|
+
state: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
387
|
+
country: import("zod/v3").ZodString;
|
|
388
|
+
zipcode: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
389
|
+
}, "strip", import("zod/v3").ZodTypeAny, {
|
|
390
|
+
country: string;
|
|
391
|
+
city?: string | undefined;
|
|
392
|
+
state?: string | undefined;
|
|
393
|
+
street?: string | undefined;
|
|
394
|
+
zipcode?: string | undefined;
|
|
395
|
+
}, {
|
|
396
|
+
country: string;
|
|
397
|
+
city?: string | undefined;
|
|
398
|
+
state?: string | undefined;
|
|
399
|
+
street?: string | undefined;
|
|
400
|
+
zipcode?: string | undefined;
|
|
401
|
+
}>>;
|
|
402
|
+
return_url: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
403
|
+
allowed_payment_method_types: import("zod/v3").ZodOptional<import("zod/v3").ZodArray<import("zod/v3").ZodEnum<["credit", "debit", "upi_collect", "upi_intent", "apple_pay", "google_pay", "amazon_pay", "klarna", "affirm", "afterpay_clearpay", "sepa", "ach"]>, "many">>;
|
|
404
|
+
billing_currency: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
405
|
+
show_saved_payment_methods: import("zod/v3").ZodOptional<import("zod/v3").ZodBoolean>;
|
|
406
|
+
confirm: import("zod/v3").ZodOptional<import("zod/v3").ZodBoolean>;
|
|
407
|
+
discount_code: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
|
|
408
|
+
customization: import("zod/v3").ZodOptional<import("zod/v3").ZodObject<{
|
|
409
|
+
theme: import("zod/v3").ZodOptional<import("zod/v3").ZodEnum<["light", "dark", "system"]>>;
|
|
410
|
+
show_order_details: import("zod/v3").ZodOptional<import("zod/v3").ZodBoolean>;
|
|
411
|
+
show_on_demand_tag: import("zod/v3").ZodOptional<import("zod/v3").ZodBoolean>;
|
|
412
|
+
}, "strip", import("zod/v3").ZodTypeAny, {
|
|
413
|
+
theme?: "light" | "dark" | "system" | undefined;
|
|
414
|
+
show_order_details?: boolean | undefined;
|
|
415
|
+
show_on_demand_tag?: boolean | undefined;
|
|
416
|
+
}, {
|
|
417
|
+
theme?: "light" | "dark" | "system" | undefined;
|
|
418
|
+
show_order_details?: boolean | undefined;
|
|
419
|
+
show_on_demand_tag?: boolean | undefined;
|
|
420
|
+
}>>;
|
|
421
|
+
feature_flags: import("zod/v3").ZodOptional<import("zod/v3").ZodObject<{
|
|
422
|
+
allow_currency_selection: import("zod/v3").ZodOptional<import("zod/v3").ZodBoolean>;
|
|
423
|
+
allow_discount_code: import("zod/v3").ZodOptional<import("zod/v3").ZodBoolean>;
|
|
424
|
+
allow_phone_number_collection: import("zod/v3").ZodOptional<import("zod/v3").ZodBoolean>;
|
|
425
|
+
allow_tax_id: import("zod/v3").ZodOptional<import("zod/v3").ZodBoolean>;
|
|
426
|
+
always_create_new_customer: import("zod/v3").ZodOptional<import("zod/v3").ZodBoolean>;
|
|
427
|
+
}, "strip", import("zod/v3").ZodTypeAny, {
|
|
428
|
+
allow_currency_selection?: boolean | undefined;
|
|
429
|
+
allow_discount_code?: boolean | undefined;
|
|
430
|
+
allow_phone_number_collection?: boolean | undefined;
|
|
431
|
+
allow_tax_id?: boolean | undefined;
|
|
432
|
+
always_create_new_customer?: boolean | undefined;
|
|
433
|
+
}, {
|
|
434
|
+
allow_currency_selection?: boolean | undefined;
|
|
435
|
+
allow_discount_code?: boolean | undefined;
|
|
436
|
+
allow_phone_number_collection?: boolean | undefined;
|
|
437
|
+
allow_tax_id?: boolean | undefined;
|
|
438
|
+
always_create_new_customer?: boolean | undefined;
|
|
439
|
+
}>>;
|
|
440
|
+
subscription_data: import("zod/v3").ZodOptional<import("zod/v3").ZodObject<{
|
|
441
|
+
trial_period_days: import("zod/v3").ZodOptional<import("zod/v3").ZodNumber>;
|
|
442
|
+
}, "strip", import("zod/v3").ZodTypeAny, {
|
|
443
|
+
trial_period_days?: number | undefined;
|
|
444
|
+
}, {
|
|
445
|
+
trial_period_days?: number | undefined;
|
|
446
|
+
}>>;
|
|
447
|
+
}, "strip", import("zod/v3").ZodTypeAny, {
|
|
448
|
+
product_cart?: {
|
|
449
|
+
quantity: number;
|
|
450
|
+
product_id: string;
|
|
451
|
+
}[] | undefined;
|
|
452
|
+
customer?: {
|
|
453
|
+
email?: string | undefined;
|
|
454
|
+
name?: string | undefined;
|
|
455
|
+
phone_number?: string | undefined;
|
|
456
|
+
} | undefined;
|
|
457
|
+
metadata?: Record<string, string> | undefined;
|
|
458
|
+
slug?: string | undefined;
|
|
459
|
+
referenceId?: string | undefined;
|
|
460
|
+
billing_address?: {
|
|
461
|
+
country: string;
|
|
462
|
+
city?: string | undefined;
|
|
463
|
+
state?: string | undefined;
|
|
464
|
+
street?: string | undefined;
|
|
465
|
+
zipcode?: string | undefined;
|
|
466
|
+
} | undefined;
|
|
467
|
+
return_url?: string | undefined;
|
|
468
|
+
allowed_payment_method_types?: ("credit" | "debit" | "upi_collect" | "upi_intent" | "apple_pay" | "google_pay" | "amazon_pay" | "klarna" | "affirm" | "afterpay_clearpay" | "sepa" | "ach")[] | undefined;
|
|
469
|
+
billing_currency?: string | undefined;
|
|
470
|
+
show_saved_payment_methods?: boolean | undefined;
|
|
471
|
+
confirm?: boolean | undefined;
|
|
472
|
+
discount_code?: string | undefined;
|
|
473
|
+
customization?: {
|
|
474
|
+
theme?: "light" | "dark" | "system" | undefined;
|
|
475
|
+
show_order_details?: boolean | undefined;
|
|
476
|
+
show_on_demand_tag?: boolean | undefined;
|
|
477
|
+
} | undefined;
|
|
478
|
+
feature_flags?: {
|
|
479
|
+
allow_currency_selection?: boolean | undefined;
|
|
480
|
+
allow_discount_code?: boolean | undefined;
|
|
481
|
+
allow_phone_number_collection?: boolean | undefined;
|
|
482
|
+
allow_tax_id?: boolean | undefined;
|
|
483
|
+
always_create_new_customer?: boolean | undefined;
|
|
484
|
+
} | undefined;
|
|
485
|
+
subscription_data?: {
|
|
486
|
+
trial_period_days?: number | undefined;
|
|
487
|
+
} | undefined;
|
|
488
|
+
}, {
|
|
489
|
+
product_cart?: {
|
|
490
|
+
quantity: number;
|
|
491
|
+
product_id: string;
|
|
492
|
+
}[] | undefined;
|
|
493
|
+
customer?: {
|
|
494
|
+
email?: string | undefined;
|
|
495
|
+
name?: string | undefined;
|
|
496
|
+
phone_number?: string | undefined;
|
|
497
|
+
} | undefined;
|
|
498
|
+
metadata?: Record<string, string> | undefined;
|
|
499
|
+
slug?: string | undefined;
|
|
500
|
+
referenceId?: string | undefined;
|
|
501
|
+
billing_address?: {
|
|
502
|
+
country: string;
|
|
503
|
+
city?: string | undefined;
|
|
504
|
+
state?: string | undefined;
|
|
505
|
+
street?: string | undefined;
|
|
506
|
+
zipcode?: string | undefined;
|
|
507
|
+
} | undefined;
|
|
508
|
+
return_url?: string | undefined;
|
|
509
|
+
allowed_payment_method_types?: ("credit" | "debit" | "upi_collect" | "upi_intent" | "apple_pay" | "google_pay" | "amazon_pay" | "klarna" | "affirm" | "afterpay_clearpay" | "sepa" | "ach")[] | undefined;
|
|
510
|
+
billing_currency?: string | undefined;
|
|
511
|
+
show_saved_payment_methods?: boolean | undefined;
|
|
512
|
+
confirm?: boolean | undefined;
|
|
513
|
+
discount_code?: string | undefined;
|
|
514
|
+
customization?: {
|
|
515
|
+
theme?: "light" | "dark" | "system" | undefined;
|
|
516
|
+
show_order_details?: boolean | undefined;
|
|
517
|
+
show_on_demand_tag?: boolean | undefined;
|
|
518
|
+
} | undefined;
|
|
519
|
+
feature_flags?: {
|
|
520
|
+
allow_currency_selection?: boolean | undefined;
|
|
521
|
+
allow_discount_code?: boolean | undefined;
|
|
522
|
+
allow_phone_number_collection?: boolean | undefined;
|
|
523
|
+
allow_tax_id?: boolean | undefined;
|
|
524
|
+
always_create_new_customer?: boolean | undefined;
|
|
525
|
+
} | undefined;
|
|
526
|
+
subscription_data?: {
|
|
527
|
+
trial_period_days?: number | undefined;
|
|
528
|
+
} | undefined;
|
|
529
|
+
}>;
|
|
530
|
+
requireRequest: true;
|
|
531
|
+
} & {
|
|
532
|
+
use: any[];
|
|
533
|
+
};
|
|
534
|
+
path: "/dodopayments/checkout-session";
|
|
535
|
+
};
|
|
288
536
|
} | {
|
|
289
537
|
portal: {
|
|
290
538
|
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
|
|
@@ -372,11 +620,11 @@ export declare const dodopayments: (options: DodoPaymentsOptions) => {
|
|
|
372
620
|
} : import("./types").SubscriptionItems>;
|
|
373
621
|
options: {
|
|
374
622
|
method: "GET";
|
|
375
|
-
query: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
376
|
-
page: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
377
|
-
limit: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
378
|
-
status: import("zod").ZodOptional<import("zod").ZodEnum<["active", "cancelled", "on_hold", "pending", "failed", "expired"]>>;
|
|
379
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
623
|
+
query: import("zod/v3").ZodOptional<import("zod/v3").ZodObject<{
|
|
624
|
+
page: import("zod/v3").ZodOptional<import("zod/v3").ZodNumber>;
|
|
625
|
+
limit: import("zod/v3").ZodOptional<import("zod/v3").ZodNumber>;
|
|
626
|
+
status: import("zod/v3").ZodOptional<import("zod/v3").ZodEnum<["active", "cancelled", "on_hold", "pending", "failed", "expired"]>>;
|
|
627
|
+
}, "strip", import("zod/v3").ZodTypeAny, {
|
|
380
628
|
status?: "active" | "cancelled" | "on_hold" | "pending" | "failed" | "expired" | undefined;
|
|
381
629
|
page?: number | undefined;
|
|
382
630
|
limit?: number | undefined;
|
|
@@ -444,11 +692,11 @@ export declare const dodopayments: (options: DodoPaymentsOptions) => {
|
|
|
444
692
|
} : import("./types").PaymentItems>;
|
|
445
693
|
options: {
|
|
446
694
|
method: "GET";
|
|
447
|
-
query: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
448
|
-
page: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
449
|
-
limit: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
450
|
-
status: import("zod").ZodOptional<import("zod").ZodEnum<["succeeded", "failed", "cancelled", "processing", "requires_customer_action", "requires_merchant_action", "requires_payment_method", "requires_confirmation", "requires_capture", "partially_captured", "partially_captured_and_capturable"]>>;
|
|
451
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
695
|
+
query: import("zod/v3").ZodOptional<import("zod/v3").ZodObject<{
|
|
696
|
+
page: import("zod/v3").ZodOptional<import("zod/v3").ZodNumber>;
|
|
697
|
+
limit: import("zod/v3").ZodOptional<import("zod/v3").ZodNumber>;
|
|
698
|
+
status: import("zod/v3").ZodOptional<import("zod/v3").ZodEnum<["succeeded", "failed", "cancelled", "processing", "requires_customer_action", "requires_merchant_action", "requires_payment_method", "requires_confirmation", "requires_capture", "partially_captured", "partially_captured_and_capturable"]>>;
|
|
699
|
+
}, "strip", import("zod/v3").ZodTypeAny, {
|
|
452
700
|
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;
|
|
453
701
|
page?: number | undefined;
|
|
454
702
|
limit?: number | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type DodoPayments from "dodopayments";
|
|
2
|
-
import { z } from "zod";
|
|
2
|
+
import { z } from "zod/v3";
|
|
3
3
|
import type { CreateCheckoutResponse, Product } from "../types";
|
|
4
4
|
export interface CheckoutOptions {
|
|
5
5
|
/**
|
|
@@ -16,6 +16,9 @@ export interface CheckoutOptions {
|
|
|
16
16
|
authenticatedUsersOnly?: boolean;
|
|
17
17
|
}
|
|
18
18
|
export declare const checkout: (checkoutOptions?: CheckoutOptions) => (dodopayments: DodoPayments) => {
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated
|
|
21
|
+
*/
|
|
19
22
|
checkout: {
|
|
20
23
|
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
21
24
|
body: z.objectInputType<{
|
|
@@ -294,4 +297,252 @@ export declare const checkout: (checkoutOptions?: CheckoutOptions) => (dodopayme
|
|
|
294
297
|
};
|
|
295
298
|
path: "/dodopayments/checkout";
|
|
296
299
|
};
|
|
300
|
+
checkoutSession: {
|
|
301
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
302
|
+
body: {
|
|
303
|
+
product_cart?: {
|
|
304
|
+
quantity: number;
|
|
305
|
+
product_id: string;
|
|
306
|
+
}[] | undefined;
|
|
307
|
+
customer?: {
|
|
308
|
+
email?: string | undefined;
|
|
309
|
+
name?: string | undefined;
|
|
310
|
+
phone_number?: string | undefined;
|
|
311
|
+
} | undefined;
|
|
312
|
+
metadata?: Record<string, string> | undefined;
|
|
313
|
+
slug?: string | undefined;
|
|
314
|
+
referenceId?: string | undefined;
|
|
315
|
+
billing_address?: {
|
|
316
|
+
country: string;
|
|
317
|
+
city?: string | undefined;
|
|
318
|
+
state?: string | undefined;
|
|
319
|
+
street?: string | undefined;
|
|
320
|
+
zipcode?: string | undefined;
|
|
321
|
+
} | undefined;
|
|
322
|
+
return_url?: string | undefined;
|
|
323
|
+
allowed_payment_method_types?: ("credit" | "debit" | "upi_collect" | "upi_intent" | "apple_pay" | "google_pay" | "amazon_pay" | "klarna" | "affirm" | "afterpay_clearpay" | "sepa" | "ach")[] | undefined;
|
|
324
|
+
billing_currency?: string | undefined;
|
|
325
|
+
show_saved_payment_methods?: boolean | undefined;
|
|
326
|
+
confirm?: boolean | undefined;
|
|
327
|
+
discount_code?: string | undefined;
|
|
328
|
+
customization?: {
|
|
329
|
+
theme?: "light" | "dark" | "system" | undefined;
|
|
330
|
+
show_order_details?: boolean | undefined;
|
|
331
|
+
show_on_demand_tag?: boolean | undefined;
|
|
332
|
+
} | undefined;
|
|
333
|
+
feature_flags?: {
|
|
334
|
+
allow_currency_selection?: boolean | undefined;
|
|
335
|
+
allow_discount_code?: boolean | undefined;
|
|
336
|
+
allow_phone_number_collection?: boolean | undefined;
|
|
337
|
+
allow_tax_id?: boolean | undefined;
|
|
338
|
+
always_create_new_customer?: boolean | undefined;
|
|
339
|
+
} | undefined;
|
|
340
|
+
subscription_data?: {
|
|
341
|
+
trial_period_days?: number | undefined;
|
|
342
|
+
} | undefined;
|
|
343
|
+
};
|
|
344
|
+
} & {
|
|
345
|
+
method?: "POST" | undefined;
|
|
346
|
+
} & {
|
|
347
|
+
query?: Record<string, any> | undefined;
|
|
348
|
+
} & {
|
|
349
|
+
params?: Record<string, any>;
|
|
350
|
+
} & {
|
|
351
|
+
request: Request;
|
|
352
|
+
} & {
|
|
353
|
+
headers?: HeadersInit;
|
|
354
|
+
} & {
|
|
355
|
+
asResponse?: boolean;
|
|
356
|
+
returnHeaders?: boolean;
|
|
357
|
+
use?: import("better-call").Middleware[];
|
|
358
|
+
path?: string;
|
|
359
|
+
} & {
|
|
360
|
+
asResponse?: AsResponse | undefined;
|
|
361
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
362
|
+
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
363
|
+
headers: Headers;
|
|
364
|
+
response: CreateCheckoutResponse;
|
|
365
|
+
} : CreateCheckoutResponse>;
|
|
366
|
+
options: {
|
|
367
|
+
method: "POST";
|
|
368
|
+
body: z.ZodObject<{
|
|
369
|
+
product_cart: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
370
|
+
product_id: z.ZodString;
|
|
371
|
+
quantity: z.ZodNumber;
|
|
372
|
+
}, "strip", z.ZodTypeAny, {
|
|
373
|
+
quantity: number;
|
|
374
|
+
product_id: string;
|
|
375
|
+
}, {
|
|
376
|
+
quantity: number;
|
|
377
|
+
product_id: string;
|
|
378
|
+
}>, "many">>;
|
|
379
|
+
customer: z.ZodOptional<z.ZodObject<{
|
|
380
|
+
email: z.ZodOptional<z.ZodString>;
|
|
381
|
+
name: z.ZodOptional<z.ZodString>;
|
|
382
|
+
phone_number: z.ZodOptional<z.ZodString>;
|
|
383
|
+
}, "strip", z.ZodTypeAny, {
|
|
384
|
+
email?: string | undefined;
|
|
385
|
+
name?: string | undefined;
|
|
386
|
+
phone_number?: string | undefined;
|
|
387
|
+
}, {
|
|
388
|
+
email?: string | undefined;
|
|
389
|
+
name?: string | undefined;
|
|
390
|
+
phone_number?: string | undefined;
|
|
391
|
+
}>>;
|
|
392
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
393
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
394
|
+
referenceId: z.ZodOptional<z.ZodString>;
|
|
395
|
+
billing_address: z.ZodOptional<z.ZodObject<{
|
|
396
|
+
street: z.ZodOptional<z.ZodString>;
|
|
397
|
+
city: z.ZodOptional<z.ZodString>;
|
|
398
|
+
state: z.ZodOptional<z.ZodString>;
|
|
399
|
+
country: z.ZodString;
|
|
400
|
+
zipcode: z.ZodOptional<z.ZodString>;
|
|
401
|
+
}, "strip", z.ZodTypeAny, {
|
|
402
|
+
country: string;
|
|
403
|
+
city?: string | undefined;
|
|
404
|
+
state?: string | undefined;
|
|
405
|
+
street?: string | undefined;
|
|
406
|
+
zipcode?: string | undefined;
|
|
407
|
+
}, {
|
|
408
|
+
country: string;
|
|
409
|
+
city?: string | undefined;
|
|
410
|
+
state?: string | undefined;
|
|
411
|
+
street?: string | undefined;
|
|
412
|
+
zipcode?: string | undefined;
|
|
413
|
+
}>>;
|
|
414
|
+
return_url: z.ZodOptional<z.ZodString>;
|
|
415
|
+
allowed_payment_method_types: z.ZodOptional<z.ZodArray<z.ZodEnum<["credit", "debit", "upi_collect", "upi_intent", "apple_pay", "google_pay", "amazon_pay", "klarna", "affirm", "afterpay_clearpay", "sepa", "ach"]>, "many">>;
|
|
416
|
+
billing_currency: z.ZodOptional<z.ZodString>;
|
|
417
|
+
show_saved_payment_methods: z.ZodOptional<z.ZodBoolean>;
|
|
418
|
+
confirm: z.ZodOptional<z.ZodBoolean>;
|
|
419
|
+
discount_code: z.ZodOptional<z.ZodString>;
|
|
420
|
+
customization: z.ZodOptional<z.ZodObject<{
|
|
421
|
+
theme: z.ZodOptional<z.ZodEnum<["light", "dark", "system"]>>;
|
|
422
|
+
show_order_details: z.ZodOptional<z.ZodBoolean>;
|
|
423
|
+
show_on_demand_tag: z.ZodOptional<z.ZodBoolean>;
|
|
424
|
+
}, "strip", z.ZodTypeAny, {
|
|
425
|
+
theme?: "light" | "dark" | "system" | undefined;
|
|
426
|
+
show_order_details?: boolean | undefined;
|
|
427
|
+
show_on_demand_tag?: boolean | undefined;
|
|
428
|
+
}, {
|
|
429
|
+
theme?: "light" | "dark" | "system" | undefined;
|
|
430
|
+
show_order_details?: boolean | undefined;
|
|
431
|
+
show_on_demand_tag?: boolean | undefined;
|
|
432
|
+
}>>;
|
|
433
|
+
feature_flags: z.ZodOptional<z.ZodObject<{
|
|
434
|
+
allow_currency_selection: z.ZodOptional<z.ZodBoolean>;
|
|
435
|
+
allow_discount_code: z.ZodOptional<z.ZodBoolean>;
|
|
436
|
+
allow_phone_number_collection: z.ZodOptional<z.ZodBoolean>;
|
|
437
|
+
allow_tax_id: z.ZodOptional<z.ZodBoolean>;
|
|
438
|
+
always_create_new_customer: z.ZodOptional<z.ZodBoolean>;
|
|
439
|
+
}, "strip", z.ZodTypeAny, {
|
|
440
|
+
allow_currency_selection?: boolean | undefined;
|
|
441
|
+
allow_discount_code?: boolean | undefined;
|
|
442
|
+
allow_phone_number_collection?: boolean | undefined;
|
|
443
|
+
allow_tax_id?: boolean | undefined;
|
|
444
|
+
always_create_new_customer?: boolean | undefined;
|
|
445
|
+
}, {
|
|
446
|
+
allow_currency_selection?: boolean | undefined;
|
|
447
|
+
allow_discount_code?: boolean | undefined;
|
|
448
|
+
allow_phone_number_collection?: boolean | undefined;
|
|
449
|
+
allow_tax_id?: boolean | undefined;
|
|
450
|
+
always_create_new_customer?: boolean | undefined;
|
|
451
|
+
}>>;
|
|
452
|
+
subscription_data: z.ZodOptional<z.ZodObject<{
|
|
453
|
+
trial_period_days: z.ZodOptional<z.ZodNumber>;
|
|
454
|
+
}, "strip", z.ZodTypeAny, {
|
|
455
|
+
trial_period_days?: number | undefined;
|
|
456
|
+
}, {
|
|
457
|
+
trial_period_days?: number | undefined;
|
|
458
|
+
}>>;
|
|
459
|
+
}, "strip", z.ZodTypeAny, {
|
|
460
|
+
product_cart?: {
|
|
461
|
+
quantity: number;
|
|
462
|
+
product_id: string;
|
|
463
|
+
}[] | undefined;
|
|
464
|
+
customer?: {
|
|
465
|
+
email?: string | undefined;
|
|
466
|
+
name?: string | undefined;
|
|
467
|
+
phone_number?: string | undefined;
|
|
468
|
+
} | undefined;
|
|
469
|
+
metadata?: Record<string, string> | undefined;
|
|
470
|
+
slug?: string | undefined;
|
|
471
|
+
referenceId?: string | undefined;
|
|
472
|
+
billing_address?: {
|
|
473
|
+
country: string;
|
|
474
|
+
city?: string | undefined;
|
|
475
|
+
state?: string | undefined;
|
|
476
|
+
street?: string | undefined;
|
|
477
|
+
zipcode?: string | undefined;
|
|
478
|
+
} | undefined;
|
|
479
|
+
return_url?: string | undefined;
|
|
480
|
+
allowed_payment_method_types?: ("credit" | "debit" | "upi_collect" | "upi_intent" | "apple_pay" | "google_pay" | "amazon_pay" | "klarna" | "affirm" | "afterpay_clearpay" | "sepa" | "ach")[] | undefined;
|
|
481
|
+
billing_currency?: string | undefined;
|
|
482
|
+
show_saved_payment_methods?: boolean | undefined;
|
|
483
|
+
confirm?: boolean | undefined;
|
|
484
|
+
discount_code?: string | undefined;
|
|
485
|
+
customization?: {
|
|
486
|
+
theme?: "light" | "dark" | "system" | undefined;
|
|
487
|
+
show_order_details?: boolean | undefined;
|
|
488
|
+
show_on_demand_tag?: boolean | undefined;
|
|
489
|
+
} | undefined;
|
|
490
|
+
feature_flags?: {
|
|
491
|
+
allow_currency_selection?: boolean | undefined;
|
|
492
|
+
allow_discount_code?: boolean | undefined;
|
|
493
|
+
allow_phone_number_collection?: boolean | undefined;
|
|
494
|
+
allow_tax_id?: boolean | undefined;
|
|
495
|
+
always_create_new_customer?: boolean | undefined;
|
|
496
|
+
} | undefined;
|
|
497
|
+
subscription_data?: {
|
|
498
|
+
trial_period_days?: number | undefined;
|
|
499
|
+
} | undefined;
|
|
500
|
+
}, {
|
|
501
|
+
product_cart?: {
|
|
502
|
+
quantity: number;
|
|
503
|
+
product_id: string;
|
|
504
|
+
}[] | undefined;
|
|
505
|
+
customer?: {
|
|
506
|
+
email?: string | undefined;
|
|
507
|
+
name?: string | undefined;
|
|
508
|
+
phone_number?: string | undefined;
|
|
509
|
+
} | undefined;
|
|
510
|
+
metadata?: Record<string, string> | undefined;
|
|
511
|
+
slug?: string | undefined;
|
|
512
|
+
referenceId?: string | undefined;
|
|
513
|
+
billing_address?: {
|
|
514
|
+
country: string;
|
|
515
|
+
city?: string | undefined;
|
|
516
|
+
state?: string | undefined;
|
|
517
|
+
street?: string | undefined;
|
|
518
|
+
zipcode?: string | undefined;
|
|
519
|
+
} | undefined;
|
|
520
|
+
return_url?: string | undefined;
|
|
521
|
+
allowed_payment_method_types?: ("credit" | "debit" | "upi_collect" | "upi_intent" | "apple_pay" | "google_pay" | "amazon_pay" | "klarna" | "affirm" | "afterpay_clearpay" | "sepa" | "ach")[] | undefined;
|
|
522
|
+
billing_currency?: string | undefined;
|
|
523
|
+
show_saved_payment_methods?: boolean | undefined;
|
|
524
|
+
confirm?: boolean | undefined;
|
|
525
|
+
discount_code?: string | undefined;
|
|
526
|
+
customization?: {
|
|
527
|
+
theme?: "light" | "dark" | "system" | undefined;
|
|
528
|
+
show_order_details?: boolean | undefined;
|
|
529
|
+
show_on_demand_tag?: boolean | undefined;
|
|
530
|
+
} | undefined;
|
|
531
|
+
feature_flags?: {
|
|
532
|
+
allow_currency_selection?: boolean | undefined;
|
|
533
|
+
allow_discount_code?: boolean | undefined;
|
|
534
|
+
allow_phone_number_collection?: boolean | undefined;
|
|
535
|
+
allow_tax_id?: boolean | undefined;
|
|
536
|
+
always_create_new_customer?: boolean | undefined;
|
|
537
|
+
} | undefined;
|
|
538
|
+
subscription_data?: {
|
|
539
|
+
trial_period_days?: number | undefined;
|
|
540
|
+
} | undefined;
|
|
541
|
+
}>;
|
|
542
|
+
requireRequest: true;
|
|
543
|
+
} & {
|
|
544
|
+
use: any[];
|
|
545
|
+
};
|
|
546
|
+
path: "/dodopayments/checkout-session";
|
|
547
|
+
};
|
|
297
548
|
};
|
package/dist/plugins/checkout.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { APIError, getSessionFromCtx } from "better-auth/api";
|
|
2
2
|
import { createAuthEndpoint } from "better-auth/plugins";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import { buildCheckoutUrl, dynamicCheckoutBodySchema, } from "@dodopayments/core/checkout";
|
|
3
|
+
import { z } from "zod/v3";
|
|
4
|
+
import { buildCheckoutUrl, checkoutSessionPayloadSchema, dynamicCheckoutBodySchema, } from "@dodopayments/core/checkout";
|
|
5
5
|
export const checkout = (checkoutOptions = {}) => (dodopayments) => {
|
|
6
6
|
return {
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated
|
|
9
|
+
*/
|
|
7
10
|
checkout: createAuthEndpoint("/dodopayments/checkout", {
|
|
8
11
|
method: "POST",
|
|
9
12
|
body: dynamicCheckoutBodySchema.extend({
|
|
@@ -15,10 +18,9 @@ export const checkout = (checkoutOptions = {}) => (dodopayments) => {
|
|
|
15
18
|
const session = await getSessionFromCtx(ctx);
|
|
16
19
|
let dodoPaymentsProductId;
|
|
17
20
|
if (ctx.body?.slug) {
|
|
18
|
-
const resolvedProducts =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
: checkoutOptions.products);
|
|
21
|
+
const resolvedProducts = typeof checkoutOptions.products === "function"
|
|
22
|
+
? await checkoutOptions.products()
|
|
23
|
+
: checkoutOptions.products;
|
|
22
24
|
const productId = resolvedProducts?.find((product) => product.slug === ctx.body.slug)?.productId;
|
|
23
25
|
if (!productId) {
|
|
24
26
|
throw new APIError("BAD_REQUEST", {
|
|
@@ -84,5 +86,86 @@ export const checkout = (checkoutOptions = {}) => (dodopayments) => {
|
|
|
84
86
|
});
|
|
85
87
|
}
|
|
86
88
|
}),
|
|
89
|
+
checkoutSession: createAuthEndpoint("/dodopayments/checkout-session", {
|
|
90
|
+
method: "POST",
|
|
91
|
+
body: checkoutSessionPayloadSchema
|
|
92
|
+
.extend({
|
|
93
|
+
slug: z.string().optional(),
|
|
94
|
+
referenceId: z.string().optional(),
|
|
95
|
+
})
|
|
96
|
+
.partial({
|
|
97
|
+
product_cart: true,
|
|
98
|
+
}),
|
|
99
|
+
requireRequest: true,
|
|
100
|
+
}, async (ctx) => {
|
|
101
|
+
const session = await getSessionFromCtx(ctx);
|
|
102
|
+
let dodoPaymentsProductId;
|
|
103
|
+
if (ctx.body?.slug) {
|
|
104
|
+
const resolvedProducts = typeof checkoutOptions.products === "function"
|
|
105
|
+
? await checkoutOptions.products()
|
|
106
|
+
: checkoutOptions.products;
|
|
107
|
+
const productId = resolvedProducts?.find((product) => product.slug === ctx.body.slug)?.productId;
|
|
108
|
+
if (!productId) {
|
|
109
|
+
throw new APIError("BAD_REQUEST", {
|
|
110
|
+
message: "Product not found",
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
dodoPaymentsProductId = productId;
|
|
114
|
+
}
|
|
115
|
+
if (checkoutOptions.authenticatedUsersOnly && !session?.user.id) {
|
|
116
|
+
throw new APIError("UNAUTHORIZED", {
|
|
117
|
+
message: "You must be logged in to checkout",
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
// Ensure we have a product_cart
|
|
121
|
+
const product_cart = dodoPaymentsProductId
|
|
122
|
+
? [{ product_id: dodoPaymentsProductId, quantity: 1 }]
|
|
123
|
+
: ctx.body.product_cart;
|
|
124
|
+
if (!product_cart || product_cart.length === 0) {
|
|
125
|
+
throw new APIError("BAD_REQUEST", {
|
|
126
|
+
message: "Neither product_cart nor slug was provided",
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
const checkoutUrl = await buildCheckoutUrl({
|
|
131
|
+
sessionPayload: {
|
|
132
|
+
...ctx.body,
|
|
133
|
+
product_cart,
|
|
134
|
+
customer: {
|
|
135
|
+
email: session?.user.email,
|
|
136
|
+
name: session?.user.name,
|
|
137
|
+
...ctx.body.customer,
|
|
138
|
+
},
|
|
139
|
+
metadata: ctx.body.referenceId
|
|
140
|
+
? {
|
|
141
|
+
referenceId: ctx.body.referenceId,
|
|
142
|
+
...ctx.body.metadata,
|
|
143
|
+
}
|
|
144
|
+
: ctx.body.metadata,
|
|
145
|
+
return_url: checkoutOptions.successUrl
|
|
146
|
+
? new URL(checkoutOptions.successUrl, ctx.request?.url).toString()
|
|
147
|
+
: undefined,
|
|
148
|
+
},
|
|
149
|
+
bearerToken: dodopayments.bearerToken,
|
|
150
|
+
environment: dodopayments.baseURL.includes("test")
|
|
151
|
+
? "test_mode"
|
|
152
|
+
: "live_mode",
|
|
153
|
+
type: "session",
|
|
154
|
+
});
|
|
155
|
+
const redirectUrl = new URL(checkoutUrl);
|
|
156
|
+
return ctx.json({
|
|
157
|
+
url: redirectUrl.toString(),
|
|
158
|
+
redirect: true,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
catch (e) {
|
|
162
|
+
if (e instanceof Error) {
|
|
163
|
+
ctx.context.logger.error(`DodoPayments checkout creation failed. Error: ${e.message}`);
|
|
164
|
+
}
|
|
165
|
+
throw new APIError("INTERNAL_SERVER_ERROR", {
|
|
166
|
+
message: "Checkout session creation failed",
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}),
|
|
87
170
|
};
|
|
88
171
|
};
|
package/dist/plugins/portal.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DodoPayments } from "dodopayments";
|
|
2
|
-
import { z } from "zod";
|
|
2
|
+
import { z } from "zod/v3";
|
|
3
3
|
import { CustomerPortalResponse, PaymentItems, SubscriptionItems } from "../types";
|
|
4
4
|
export declare const portal: () => (dodopayments: DodoPayments) => {
|
|
5
5
|
portal: {
|
package/dist/plugins/portal.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { APIError } from "better-auth/api";
|
|
2
2
|
import { sessionMiddleware } from "better-auth/api";
|
|
3
3
|
import { createAuthEndpoint } from "better-auth/plugins";
|
|
4
|
-
import { z } from "zod";
|
|
4
|
+
import { z } from "zod/v3";
|
|
5
5
|
export const portal = () => (dodopayments) => {
|
|
6
6
|
return {
|
|
7
7
|
portal: createAuthEndpoint("/dodopayments/customer/portal", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dodopayments/better-auth",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"types": "./dist/index.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dodopayments/core": "^0.
|
|
21
|
+
"@dodopayments/core": "^0.3.1"
|
|
22
22
|
},
|
|
23
23
|
"engines": {
|
|
24
24
|
"node": ">=16.0.0"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"rollup-plugin-dts": "^6.1.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"zod": "^3.0.0"
|
|
50
|
+
"zod": "^3.25.0 || ^4.0.0"
|
|
51
51
|
},
|
|
52
52
|
"type": "module",
|
|
53
53
|
"files": [
|