@raideno/convex-stripe 0.2.3 → 0.2.5
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 +176 -2
- package/dist/server.js +86 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5,11 +5,13 @@ import { GenericDataModel } from 'convex/server';
|
|
|
5
5
|
import { GenericId } from 'convex/values';
|
|
6
6
|
import { GenericMutationCtx } from 'convex/server';
|
|
7
7
|
import { HttpRouter } from 'convex/server';
|
|
8
|
+
import { Infer } from 'convex/values';
|
|
8
9
|
import { RegisteredAction } from 'convex/server';
|
|
9
10
|
import { RegisteredMutation } from 'convex/server';
|
|
10
11
|
import { RoutableMethod } from 'convex/server';
|
|
11
12
|
import { SchemaDefinition } from 'convex/server';
|
|
12
13
|
import { TableDefinition } from 'convex/server';
|
|
14
|
+
import { Validator } from 'convex/values';
|
|
13
15
|
import { VAny } from 'convex/values';
|
|
14
16
|
import { VArray } from 'convex/values';
|
|
15
17
|
import { VBoolean } from 'convex/values';
|
|
@@ -21,6 +23,18 @@ import { VRecord } from 'convex/values';
|
|
|
21
23
|
import { VString } from 'convex/values';
|
|
22
24
|
import { VUnion } from 'convex/values';
|
|
23
25
|
|
|
26
|
+
declare type AllRedirectHandlers = (typeof REDIRECT_HANDLERS)[number];
|
|
27
|
+
|
|
28
|
+
declare type ArgSchema = Record<string, Validator<any, "optional" | "required", any>>;
|
|
29
|
+
|
|
30
|
+
export declare function buildSignedReturnUrl<O extends ReturnOrigin>({ configuration, origin, failureUrl, targetUrl, data, }: {
|
|
31
|
+
configuration: InternalConfiguration;
|
|
32
|
+
origin: O;
|
|
33
|
+
failureUrl?: string;
|
|
34
|
+
targetUrl: string;
|
|
35
|
+
data: ReturnDataMap[O];
|
|
36
|
+
}): Promise<string>;
|
|
37
|
+
|
|
24
38
|
export declare type CallbackAfterChange = (context: GenericMutationCtx<any>, operation: "upsert" | "delete" | "insert", event: CallbackEvent) => Promise<void>;
|
|
25
39
|
|
|
26
40
|
export declare type CallbackEvent = {
|
|
@@ -149,27 +163,63 @@ declare const CreateCustomerImplementation: {
|
|
|
149
163
|
}>;
|
|
150
164
|
};
|
|
151
165
|
|
|
166
|
+
export declare function defineRedirectHandler<const T extends readonly string[], S extends ArgSchema = {}>(handler: RedirectHandler<T, S>): RedirectHandler<T, S>;
|
|
167
|
+
|
|
168
|
+
declare type InferArgs<S extends ArgSchema> = {
|
|
169
|
+
[K in keyof S as S[K] extends Validator<any, "required", any> ? K : never]: Infer<S[K]>;
|
|
170
|
+
} & {
|
|
171
|
+
[K in keyof S as S[K] extends Validator<any, "optional", any> ? K : never]?: Infer<S[K]>;
|
|
172
|
+
};
|
|
173
|
+
|
|
152
174
|
export declare interface InputConfiguration {
|
|
153
175
|
stripe: {
|
|
176
|
+
/** Stripe API version to pin against (recommended for stability). */
|
|
154
177
|
version?: default_2.StripeConfig["apiVersion"];
|
|
178
|
+
/** Secret key for your Stripe account (starts with `sk_`). */
|
|
155
179
|
secret_key: string;
|
|
180
|
+
/** Webhook signing secret for account-level webhooks (starts with `whsec_`). */
|
|
156
181
|
account_webhook_secret: string;
|
|
182
|
+
/**
|
|
183
|
+
* Webhook signing secret for Stripe Connect webhooks (if you use Connect).
|
|
184
|
+
* If omitted, Connect webhooks are treated as disabled/unverified.
|
|
185
|
+
*/
|
|
157
186
|
connect_webhook_secret?: string;
|
|
158
187
|
};
|
|
159
188
|
sync: {
|
|
160
189
|
catalog?: {
|
|
190
|
+
/** Products to ensure exist in Stripe (optional bootstrap). */
|
|
161
191
|
products?: default_2.ProductCreateParams[];
|
|
192
|
+
/** Prices to ensure exist in Stripe (optional bootstrap). */
|
|
162
193
|
prices?: default_2.PriceCreateParams[];
|
|
163
194
|
behavior?: {
|
|
195
|
+
/**
|
|
196
|
+
* What to do if a product/price already exists in Stripe.
|
|
197
|
+
* - update: update fields
|
|
198
|
+
* - archive_and_recreate: archive and create a new object
|
|
199
|
+
* - skip: leave as-is
|
|
200
|
+
* - error: throw
|
|
201
|
+
*/
|
|
164
202
|
onExisting?: "update" | "archive_and_recreate" | "skip" | "error";
|
|
203
|
+
/**
|
|
204
|
+
* What to do if the "metadata key" is missing on an object.
|
|
205
|
+
* - create: create it
|
|
206
|
+
* - error: throw
|
|
207
|
+
*/
|
|
165
208
|
onMissingKey?: "create" | "error";
|
|
166
209
|
};
|
|
210
|
+
/**
|
|
211
|
+
* Metadata field used to match local definitions to Stripe objects.
|
|
212
|
+
* Example: "app_internal_key"
|
|
213
|
+
*/
|
|
167
214
|
metadataKey?: string;
|
|
168
215
|
};
|
|
169
216
|
webhooks?: {
|
|
170
217
|
account: {
|
|
218
|
+
/** Metadata applied when creating/updating the Stripe webhook endpoint. */
|
|
171
219
|
metadata?: Record<string, string>;
|
|
220
|
+
/** Description used for the Stripe webhook endpoint. */
|
|
172
221
|
description?: string;
|
|
222
|
+
/** Override the default path (otherwise your code uses `/stripe/webhook`). */
|
|
173
223
|
path?: string;
|
|
174
224
|
};
|
|
175
225
|
connect: {
|
|
@@ -178,22 +228,55 @@ export declare interface InputConfiguration {
|
|
|
178
228
|
path?: string;
|
|
179
229
|
};
|
|
180
230
|
};
|
|
231
|
+
/** Optional Billing Portal configuration to create/sync. */
|
|
181
232
|
portal?: default_2.BillingPortal.ConfigurationCreateParams;
|
|
233
|
+
/** Which Stripe tables you want to sync into Convex. */
|
|
182
234
|
tables: Record<keyof typeof stripeTables, boolean>;
|
|
183
235
|
};
|
|
184
236
|
callbacks?: {
|
|
237
|
+
/** Called after a row is inserted/upserted/deleted in your Stripe tables. */
|
|
185
238
|
afterChange?: CallbackAfterChange;
|
|
186
239
|
};
|
|
240
|
+
/**
|
|
241
|
+
* If true, avoids attaching routes/state globally (depends on your library meaning).
|
|
242
|
+
* Document your intended behavior here.
|
|
243
|
+
*/
|
|
187
244
|
detached?: boolean;
|
|
188
|
-
|
|
245
|
+
redirect?: {
|
|
246
|
+
/** TTL for redirect state (ms). */
|
|
247
|
+
ttlMs?: number;
|
|
248
|
+
/** Additional handlers for redirect-based flows (e.g. Checkout, OAuth). */
|
|
249
|
+
handlers?: Array<ReturnType<typeof defineRedirectHandler>>;
|
|
250
|
+
};
|
|
189
251
|
}
|
|
190
252
|
|
|
191
253
|
export declare type InputOptions = Partial<InternalOptions>;
|
|
192
254
|
|
|
193
255
|
export declare type InternalConfiguration = RecursiveDeepRequired<InputConfiguration>;
|
|
194
256
|
|
|
257
|
+
/**
|
|
258
|
+
* Initializes the Convex Stripe integration.
|
|
259
|
+
*
|
|
260
|
+
* Returns a set of utilities to wire up HTTP routes, trigger Stripe actions,
|
|
261
|
+
* and keep your Convex database in sync with Stripe events.
|
|
262
|
+
*
|
|
263
|
+
* @param configuration_ - Your Stripe and sync configuration.
|
|
264
|
+
* @param options_ - Optional internal options (logger, debug mode, etc.).
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* export const { stripe, store, sync } = internalConvexStripe({
|
|
268
|
+
* stripe: {
|
|
269
|
+
* secret_key: process.env.STRIPE_SECRET_KEY!,
|
|
270
|
+
* account_webhook_secret: process.env.STRIPE_WHSEC!,
|
|
271
|
+
* },
|
|
272
|
+
* sync: {
|
|
273
|
+
* tables: { customers: true, subscriptions: true },
|
|
274
|
+
* },
|
|
275
|
+
* });
|
|
276
|
+
*/
|
|
195
277
|
export declare const internalConvexStripe: (configuration_: InputConfiguration, options_?: InputOptions) => {
|
|
196
278
|
stripe: {
|
|
279
|
+
/** Raw HTTP handler descriptors. Prefer `addHttpRoutes` unless you need manual control. */
|
|
197
280
|
http: {
|
|
198
281
|
webhook: {
|
|
199
282
|
path: string;
|
|
@@ -206,12 +289,62 @@ export declare const internalConvexStripe: (configuration_: InputConfiguration,
|
|
|
206
289
|
readonly handler: (context: GenericActionCtx<GenericDataModel>, request: Request) => Promise<Response>;
|
|
207
290
|
};
|
|
208
291
|
};
|
|
292
|
+
/** A pre-configured Stripe SDK client using your `secret_key` and `version`. */
|
|
209
293
|
client: default_2;
|
|
294
|
+
/**
|
|
295
|
+
* Registers the Stripe webhook and redirect routes on your Convex `HttpRouter`.
|
|
296
|
+
* Call this inside your `convex/http.ts` file.
|
|
297
|
+
*
|
|
298
|
+
* - `POST /stripe/webhook` receives and verifies Stripe webhook events.
|
|
299
|
+
* - `GET /stripe/return/*` handles post-payment/portal redirect flows.
|
|
300
|
+
*
|
|
301
|
+
* @param http - Your Convex `HttpRouter` instance.
|
|
302
|
+
* @param config - Optional config override (defaults to the root configuration).
|
|
303
|
+
*
|
|
304
|
+
* @example
|
|
305
|
+
* // convex/http.ts
|
|
306
|
+
* import { httpRouter } from "convex/server";
|
|
307
|
+
* import { stripe } from "./stripe";
|
|
308
|
+
*
|
|
309
|
+
* const http = httpRouter();
|
|
310
|
+
* stripe.addHttpRoutes(http);
|
|
311
|
+
* export default http;
|
|
312
|
+
*/
|
|
210
313
|
addHttpRoutes: (http: HttpRouter, config?: InputConfiguration) => void;
|
|
314
|
+
/**
|
|
315
|
+
* Opens a Stripe Billing Portal session for an existing customer.
|
|
316
|
+
* Use this to let users manage their subscription, invoices, and payment methods.
|
|
317
|
+
*
|
|
318
|
+
* @param context - The Convex action context.
|
|
319
|
+
* @param args - Customer identifier and return URL.
|
|
320
|
+
* @param options - Optional overrides (e.g. portal configuration ID).
|
|
321
|
+
*/
|
|
211
322
|
portal: (context: GenericActionCtx<any>, args: Parameters<(typeof PortalImplementation)["handler"]>[1], options?: Parameters<(typeof PortalImplementation)["handler"]>[2]) => Promise<default_2.Response<default_2.BillingPortal.Session>>;
|
|
323
|
+
/**
|
|
324
|
+
* Creates a Stripe Checkout session in `subscription` mode.
|
|
325
|
+
* Redirects the user to Stripe Checkout to set up a recurring subscription.
|
|
326
|
+
*
|
|
327
|
+
* @param context - The Convex action context.
|
|
328
|
+
* @param args - Price ID, customer info, and success/cancel URLs.
|
|
329
|
+
* @param options - Optional overrides for the Checkout session.
|
|
330
|
+
*/
|
|
212
331
|
subscribe: (context: GenericActionCtx<any>, args: Parameters<(typeof SubscribeImplementation)["handler"]>[1], options?: Parameters<(typeof SubscribeImplementation)["handler"]>[2]) => Promise<default_2.Response<default_2.Checkout.Session>>;
|
|
332
|
+
/**
|
|
333
|
+
* Creates a Stripe Checkout session in `payment` mode (one-time payment).
|
|
334
|
+
*
|
|
335
|
+
* @param context - The Convex action context.
|
|
336
|
+
* @param args - Price ID, quantity, and success/cancel URLs.
|
|
337
|
+
* @param options - Optional overrides for the Checkout session.
|
|
338
|
+
*/
|
|
213
339
|
pay: (context: GenericActionCtx<any>, args: Parameters<(typeof PayImplementation)["handler"]>[1], options?: Parameters<(typeof PayImplementation)["handler"]>[2]) => Promise<default_2.Response<default_2.Checkout.Session>>;
|
|
214
340
|
customers: {
|
|
341
|
+
/**
|
|
342
|
+
* Creates a new Stripe Customer and stores it in your Convex database.
|
|
343
|
+
*
|
|
344
|
+
* @param context - The Convex action context.
|
|
345
|
+
* @param args - Customer details (email, name, metadata, etc.).
|
|
346
|
+
* @param options - Optional overrides for the customer creation.
|
|
347
|
+
*/
|
|
215
348
|
create: (context: GenericActionCtx<any>, args: Parameters<(typeof CreateCustomerImplementation)["handler"]>[1], options?: Parameters<(typeof CreateCustomerImplementation)["handler"]>[2]) => Promise<{
|
|
216
349
|
_id: GenericId<"stripeCustomers">;
|
|
217
350
|
_creationTime: number;
|
|
@@ -280,6 +413,14 @@ export declare const internalConvexStripe: (configuration_: InputConfiguration,
|
|
|
280
413
|
}>;
|
|
281
414
|
};
|
|
282
415
|
accounts: {
|
|
416
|
+
/**
|
|
417
|
+
* Creates a new Stripe Connect account (Express or Custom).
|
|
418
|
+
* Use this to onboard sellers, platforms, or service providers.
|
|
419
|
+
*
|
|
420
|
+
* @param context - The Convex action context.
|
|
421
|
+
* @param args - Account type, email, and capabilities.
|
|
422
|
+
* @param options - Optional overrides for the account creation.
|
|
423
|
+
*/
|
|
283
424
|
create: (context: GenericActionCtx<any>, args: Parameters<(typeof CreateAccountImplementation)["handler"]>[1], options?: Parameters<(typeof CreateAccountImplementation)["handler"]>[2]) => Promise<{
|
|
284
425
|
_id: GenericId<"stripeAccounts">;
|
|
285
426
|
_creationTime: number;
|
|
@@ -312,15 +453,27 @@ export declare const internalConvexStripe: (configuration_: InputConfiguration,
|
|
|
312
453
|
accountId: string;
|
|
313
454
|
lastSyncedAt: number;
|
|
314
455
|
}>;
|
|
456
|
+
/**
|
|
457
|
+
* Creates a Stripe Connect Account Link for onboarding.
|
|
458
|
+
* Redirects the connected account holder to Stripe's hosted onboarding flow.
|
|
459
|
+
*
|
|
460
|
+
* @param context - The Convex action context.
|
|
461
|
+
* @param args - Account ID, refresh URL, and return URL.
|
|
462
|
+
* @param options - Optional overrides for the account link.
|
|
463
|
+
*/
|
|
315
464
|
link: (context: GenericActionCtx<any>, args: Parameters<(typeof CreateAccountLinkImplementation)["handler"]>[1], options?: Parameters<(typeof CreateAccountLinkImplementation)["handler"]>[2]) => Promise<default_2.Response<default_2.AccountLink>>;
|
|
316
465
|
};
|
|
317
466
|
};
|
|
467
|
+
/**
|
|
468
|
+
* Internal Convex mutation that persists a Stripe object into your database.
|
|
469
|
+
* Typically called from within the webhook handler not meant for direct use.
|
|
470
|
+
*/
|
|
318
471
|
store: RegisteredMutation<"internal", {
|
|
319
472
|
id?: any;
|
|
320
473
|
value?: any;
|
|
474
|
+
data?: any;
|
|
321
475
|
indexName?: string | undefined;
|
|
322
476
|
idField?: string | undefined;
|
|
323
|
-
data?: any;
|
|
324
477
|
idValue?: any;
|
|
325
478
|
field?: string | undefined;
|
|
326
479
|
operation: string;
|
|
@@ -1444,6 +1597,11 @@ export declare const internalConvexStripe: (configuration_: InputConfiguration,
|
|
|
1444
1597
|
deleted?: undefined;
|
|
1445
1598
|
doc?: undefined;
|
|
1446
1599
|
} | undefined>>;
|
|
1600
|
+
/**
|
|
1601
|
+
* Internal Convex action that syncs Stripe catalog data (products, prices,
|
|
1602
|
+
* webhooks, portal config) into Stripe based on your `sync` configuration.
|
|
1603
|
+
* Run this manually or on deploy to keep Stripe in sync with your config.
|
|
1604
|
+
*/
|
|
1447
1605
|
sync: RegisteredAction<"internal", {
|
|
1448
1606
|
webhooks?: {
|
|
1449
1607
|
account?: boolean | undefined;
|
|
@@ -1500,6 +1658,22 @@ declare type RecursiveDeepRequired<T> = T extends (...args: any[]) => any ? T :
|
|
|
1500
1658
|
[K in keyof T]-?: RecursiveDeepRequired<T[K]>;
|
|
1501
1659
|
} : T;
|
|
1502
1660
|
|
|
1661
|
+
declare const REDIRECT_HANDLERS: RedirectHandler<readonly string[], ArgSchema>[];
|
|
1662
|
+
|
|
1663
|
+
export declare type RedirectHandler<TOrigins extends readonly string[], S extends ArgSchema = {}> = {
|
|
1664
|
+
origins: TOrigins;
|
|
1665
|
+
data?: S;
|
|
1666
|
+
handle: (origin: TOrigins[number], context: GenericActionCtx<StripeDataModel>, data: InferArgs<S>, configuration: InternalConfiguration, options: InternalOptions) => Promise<void>;
|
|
1667
|
+
};
|
|
1668
|
+
|
|
1669
|
+
declare const RETURN_ORIGINS: string[];
|
|
1670
|
+
|
|
1671
|
+
declare type ReturnDataMap = {
|
|
1672
|
+
[H in AllRedirectHandlers as H["origins"][number]]: H extends RedirectHandler<any, infer S> ? InferArgs<S> : never;
|
|
1673
|
+
};
|
|
1674
|
+
|
|
1675
|
+
declare type ReturnOrigin = (typeof RETURN_ORIGINS)[number];
|
|
1676
|
+
|
|
1503
1677
|
declare type StripeDataModel = DataModelFromSchemaDefinition<typeof stripeSchema>;
|
|
1504
1678
|
|
|
1505
1679
|
declare const stripeSchema: SchemaDefinition< {
|
package/dist/server.js
CHANGED
|
@@ -5628,7 +5628,10 @@ const DEFAULT_CONFIGURATION = {
|
|
|
5628
5628
|
account_webhook_secret: "",
|
|
5629
5629
|
connect_webhook_secret: ""
|
|
5630
5630
|
},
|
|
5631
|
-
|
|
5631
|
+
redirect: {
|
|
5632
|
+
ttlMs: 15 * 60 * 1e3,
|
|
5633
|
+
handlers: []
|
|
5634
|
+
},
|
|
5632
5635
|
detached: false,
|
|
5633
5636
|
callbacks: {
|
|
5634
5637
|
afterChange: async () => {
|
|
@@ -6322,7 +6325,7 @@ async function buildSignedReturnUrl({
|
|
|
6322
6325
|
data,
|
|
6323
6326
|
targetUrl,
|
|
6324
6327
|
failureUrl,
|
|
6325
|
-
exp: Date.now() + configuration.
|
|
6328
|
+
exp: Date.now() + configuration.redirect.ttlMs
|
|
6326
6329
|
};
|
|
6327
6330
|
const data_ = toBase64Url(JSON.stringify(payload));
|
|
6328
6331
|
const expected = await signData(
|
|
@@ -6365,10 +6368,11 @@ REDIRECT_HANDLERS.map(
|
|
|
6365
6368
|
(handler) => handler.origins
|
|
6366
6369
|
).flat();
|
|
6367
6370
|
const redirectImplementation = async (configuration, options, context, request) => {
|
|
6371
|
+
const handlers = [...REDIRECT_HANDLERS, ...configuration.redirect.handlers];
|
|
6368
6372
|
const url = new URL(request.url);
|
|
6369
6373
|
const segments = url.pathname.split("/").filter(Boolean);
|
|
6370
6374
|
const origin_ = segments[segments.length - 1];
|
|
6371
|
-
if (!origin_ || !
|
|
6375
|
+
if (!origin_ || !handlers.map((handler) => handler.origins).flat().includes(origin_)) {
|
|
6372
6376
|
return new Response("Invalid return origin", { status: 400 });
|
|
6373
6377
|
}
|
|
6374
6378
|
const origin = origin_;
|
|
@@ -6419,7 +6423,7 @@ const redirectImplementation = async (configuration, options, context, request)
|
|
|
6419
6423
|
}
|
|
6420
6424
|
return new Response("Invalid target", { status: 400 });
|
|
6421
6425
|
}
|
|
6422
|
-
for (const handler of
|
|
6426
|
+
for (const handler of handlers) {
|
|
6423
6427
|
if (handler.origins.includes(origin)) {
|
|
6424
6428
|
try {
|
|
6425
6429
|
await handler.handle(
|
|
@@ -9696,10 +9700,31 @@ const internalConvexStripe = (configuration_, options_) => {
|
|
|
9696
9700
|
);
|
|
9697
9701
|
return {
|
|
9698
9702
|
stripe: {
|
|
9703
|
+
/** Raw HTTP handler descriptors. Prefer `addHttpRoutes` unless you need manual control. */
|
|
9699
9704
|
http: http_,
|
|
9705
|
+
/** A pre-configured Stripe SDK client using your `secret_key` and `version`. */
|
|
9700
9706
|
client: new Stripe(ConvexStripeInternalConfiguration.stripe.secret_key, {
|
|
9701
9707
|
apiVersion: ConvexStripeInternalConfiguration.stripe.version
|
|
9702
9708
|
}),
|
|
9709
|
+
/**
|
|
9710
|
+
* Registers the Stripe webhook and redirect routes on your Convex `HttpRouter`.
|
|
9711
|
+
* Call this inside your `convex/http.ts` file.
|
|
9712
|
+
*
|
|
9713
|
+
* - `POST /stripe/webhook` receives and verifies Stripe webhook events.
|
|
9714
|
+
* - `GET /stripe/return/*` handles post-payment/portal redirect flows.
|
|
9715
|
+
*
|
|
9716
|
+
* @param http - Your Convex `HttpRouter` instance.
|
|
9717
|
+
* @param config - Optional config override (defaults to the root configuration).
|
|
9718
|
+
*
|
|
9719
|
+
* @example
|
|
9720
|
+
* // convex/http.ts
|
|
9721
|
+
* import { httpRouter } from "convex/server";
|
|
9722
|
+
* import { stripe } from "./stripe";
|
|
9723
|
+
*
|
|
9724
|
+
* const http = httpRouter();
|
|
9725
|
+
* stripe.addHttpRoutes(http);
|
|
9726
|
+
* export default http;
|
|
9727
|
+
*/
|
|
9703
9728
|
addHttpRoutes: (http, config) => {
|
|
9704
9729
|
config = normalizeConfiguration(config || configuration_);
|
|
9705
9730
|
http.route({
|
|
@@ -9717,6 +9742,14 @@ const internalConvexStripe = (configuration_, options_) => {
|
|
|
9717
9742
|
})
|
|
9718
9743
|
});
|
|
9719
9744
|
},
|
|
9745
|
+
/**
|
|
9746
|
+
* Opens a Stripe Billing Portal session for an existing customer.
|
|
9747
|
+
* Use this to let users manage their subscription, invoices, and payment methods.
|
|
9748
|
+
*
|
|
9749
|
+
* @param context - The Convex action context.
|
|
9750
|
+
* @param args - Customer identifier and return URL.
|
|
9751
|
+
* @param options - Optional overrides (e.g. portal configuration ID).
|
|
9752
|
+
*/
|
|
9720
9753
|
portal: (context, args, options = {}) => PortalImplementation.handler(
|
|
9721
9754
|
context,
|
|
9722
9755
|
args,
|
|
@@ -9724,6 +9757,14 @@ const internalConvexStripe = (configuration_, options_) => {
|
|
|
9724
9757
|
ConvexStripeInternalConfiguration,
|
|
9725
9758
|
ConvexStripeInternalOptions
|
|
9726
9759
|
),
|
|
9760
|
+
/**
|
|
9761
|
+
* Creates a Stripe Checkout session in `subscription` mode.
|
|
9762
|
+
* Redirects the user to Stripe Checkout to set up a recurring subscription.
|
|
9763
|
+
*
|
|
9764
|
+
* @param context - The Convex action context.
|
|
9765
|
+
* @param args - Price ID, customer info, and success/cancel URLs.
|
|
9766
|
+
* @param options - Optional overrides for the Checkout session.
|
|
9767
|
+
*/
|
|
9727
9768
|
subscribe: (context, args, options = {}) => SubscribeImplementation.handler(
|
|
9728
9769
|
context,
|
|
9729
9770
|
args,
|
|
@@ -9731,6 +9772,13 @@ const internalConvexStripe = (configuration_, options_) => {
|
|
|
9731
9772
|
ConvexStripeInternalConfiguration,
|
|
9732
9773
|
ConvexStripeInternalOptions
|
|
9733
9774
|
),
|
|
9775
|
+
/**
|
|
9776
|
+
* Creates a Stripe Checkout session in `payment` mode (one-time payment).
|
|
9777
|
+
*
|
|
9778
|
+
* @param context - The Convex action context.
|
|
9779
|
+
* @param args - Price ID, quantity, and success/cancel URLs.
|
|
9780
|
+
* @param options - Optional overrides for the Checkout session.
|
|
9781
|
+
*/
|
|
9734
9782
|
pay: (context, args, options = {}) => PayImplementation.handler(
|
|
9735
9783
|
context,
|
|
9736
9784
|
args,
|
|
@@ -9739,6 +9787,13 @@ const internalConvexStripe = (configuration_, options_) => {
|
|
|
9739
9787
|
ConvexStripeInternalOptions
|
|
9740
9788
|
),
|
|
9741
9789
|
customers: {
|
|
9790
|
+
/**
|
|
9791
|
+
* Creates a new Stripe Customer and stores it in your Convex database.
|
|
9792
|
+
*
|
|
9793
|
+
* @param context - The Convex action context.
|
|
9794
|
+
* @param args - Customer details (email, name, metadata, etc.).
|
|
9795
|
+
* @param options - Optional overrides for the customer creation.
|
|
9796
|
+
*/
|
|
9742
9797
|
create: (context, args, options = {}) => CreateCustomerImplementation.handler(
|
|
9743
9798
|
context,
|
|
9744
9799
|
args,
|
|
@@ -9748,6 +9803,14 @@ const internalConvexStripe = (configuration_, options_) => {
|
|
|
9748
9803
|
)
|
|
9749
9804
|
},
|
|
9750
9805
|
accounts: {
|
|
9806
|
+
/**
|
|
9807
|
+
* Creates a new Stripe Connect account (Express or Custom).
|
|
9808
|
+
* Use this to onboard sellers, platforms, or service providers.
|
|
9809
|
+
*
|
|
9810
|
+
* @param context - The Convex action context.
|
|
9811
|
+
* @param args - Account type, email, and capabilities.
|
|
9812
|
+
* @param options - Optional overrides for the account creation.
|
|
9813
|
+
*/
|
|
9751
9814
|
create: (context, args, options = {}) => CreateAccountImplementation.handler(
|
|
9752
9815
|
context,
|
|
9753
9816
|
args,
|
|
@@ -9755,6 +9818,14 @@ const internalConvexStripe = (configuration_, options_) => {
|
|
|
9755
9818
|
ConvexStripeInternalConfiguration,
|
|
9756
9819
|
ConvexStripeInternalOptions
|
|
9757
9820
|
),
|
|
9821
|
+
/**
|
|
9822
|
+
* Creates a Stripe Connect Account Link for onboarding.
|
|
9823
|
+
* Redirects the connected account holder to Stripe's hosted onboarding flow.
|
|
9824
|
+
*
|
|
9825
|
+
* @param context - The Convex action context.
|
|
9826
|
+
* @param args - Account ID, refresh URL, and return URL.
|
|
9827
|
+
* @param options - Optional overrides for the account link.
|
|
9828
|
+
*/
|
|
9758
9829
|
link: (context, args, options = {}) => {
|
|
9759
9830
|
return CreateAccountLinkImplementation.handler(
|
|
9760
9831
|
context,
|
|
@@ -9766,6 +9837,10 @@ const internalConvexStripe = (configuration_, options_) => {
|
|
|
9766
9837
|
}
|
|
9767
9838
|
}
|
|
9768
9839
|
},
|
|
9840
|
+
/**
|
|
9841
|
+
* Internal Convex mutation that persists a Stripe object into your database.
|
|
9842
|
+
* Typically called from within the webhook handler not meant for direct use.
|
|
9843
|
+
*/
|
|
9769
9844
|
store: internalMutationGeneric({
|
|
9770
9845
|
args: StoreImplementation.args,
|
|
9771
9846
|
handler: async (context, args) => StoreImplementation.handler(
|
|
@@ -9775,6 +9850,11 @@ const internalConvexStripe = (configuration_, options_) => {
|
|
|
9775
9850
|
ConvexStripeInternalOptions
|
|
9776
9851
|
)
|
|
9777
9852
|
}),
|
|
9853
|
+
/**
|
|
9854
|
+
* Internal Convex action that syncs Stripe catalog data (products, prices,
|
|
9855
|
+
* webhooks, portal config) into Stripe based on your `sync` configuration.
|
|
9856
|
+
* Run this manually or on deploy to keep Stripe in sync with your config.
|
|
9857
|
+
*/
|
|
9778
9858
|
sync: internalActionGeneric({
|
|
9779
9859
|
args: SyncImplementation.args,
|
|
9780
9860
|
handler: (context, args) => SyncImplementation.handler(
|
|
@@ -9788,6 +9868,8 @@ const internalConvexStripe = (configuration_, options_) => {
|
|
|
9788
9868
|
};
|
|
9789
9869
|
export {
|
|
9790
9870
|
Logger,
|
|
9871
|
+
buildSignedReturnUrl,
|
|
9872
|
+
defineRedirectHandler,
|
|
9791
9873
|
internalConvexStripe,
|
|
9792
9874
|
stripeTables,
|
|
9793
9875
|
syncAllTables,
|