@raideno/convex-stripe 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -3
- package/dist/index.d.ts +44 -26
- package/dist/server.js +1356 -1476
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -45,13 +45,16 @@ export default defineSchema({
|
|
|
45
45
|
```ts
|
|
46
46
|
// convex/stripe.ts
|
|
47
47
|
|
|
48
|
-
import { internalConvexStripe } from "@raideno/convex-stripe/server";
|
|
48
|
+
import { internalConvexStripe, syncAllTables } from "@raideno/convex-stripe/server";
|
|
49
49
|
|
|
50
50
|
export const { stripe, store, sync } = internalConvexStripe({
|
|
51
51
|
stripe: {
|
|
52
52
|
secret_key: process.env.STRIPE_SECRET_KEY!,
|
|
53
53
|
account_webhook_secret: process.env.STRIPE_ACCOUNT_WEBHOOK_SECRET!,
|
|
54
54
|
},
|
|
55
|
+
sync: {
|
|
56
|
+
tables: syncAllTables(),
|
|
57
|
+
},
|
|
55
58
|
});
|
|
56
59
|
|
|
57
60
|
export const createCustomer = internalAction({
|
|
@@ -165,6 +168,9 @@ Now you can use the provided functions to:
|
|
|
165
168
|
|
|
166
169
|
If you wish to also add stripe connect, below is a guide on how to do it. You can find a full example in [`examples/marketplaces/README.md`](examples/marketplace/README.md).
|
|
167
170
|
|
|
171
|
+
### 0. Enable connect on your stripe dashboard.
|
|
172
|
+
...
|
|
173
|
+
|
|
168
174
|
### 1. Create a connect webhook using `sync` method.
|
|
169
175
|
...
|
|
170
176
|
|
|
@@ -243,8 +249,8 @@ This action is typically manually called or setup to be automatically called in
|
|
|
243
249
|
}
|
|
244
250
|
```
|
|
245
251
|
|
|
246
|
-
- `
|
|
247
|
-
- `
|
|
252
|
+
- `tables` (optional, default: `true`): Syncs all existing Stripe resources to Convex tables.
|
|
253
|
+
- `tables.withConnect` (option, default: `false`): Syncs all existing Stripe resources from linked accounts to Convex tables.
|
|
248
254
|
- `webhook.account` (optional, default: `false`): Creates/updates the account webhook endpoint. Returns the webhook secret if a new endpoint is created. You must set it in your convex environment variables as `STRIPE_ACCOUNT_WEBHOOK_SECRET`.
|
|
249
255
|
- `webhook.connect` (optional, default: `false`): Creates/updates the connect webhook endpoint. Returns the webhook secret if a new endpoint is created. You must set it in your convex environment variables as `STRIPE_CONNECT_WEBHOOK_SECRET`.
|
|
250
256
|
- `portal` (optional, default: `false`): Creates the default billing portal configuration if it doesn't exist.
|
package/dist/index.d.ts
CHANGED
|
@@ -149,39 +149,49 @@ declare const CreateCustomerImplementation: {
|
|
|
149
149
|
}>;
|
|
150
150
|
};
|
|
151
151
|
|
|
152
|
-
export declare
|
|
153
|
-
|
|
154
|
-
export declare type InputOptions = WithOptional<InternalOptions, "store" | "debug" | "logger" | "base">;
|
|
155
|
-
|
|
156
|
-
export declare interface InternalConfiguration {
|
|
152
|
+
export declare interface InputConfiguration {
|
|
157
153
|
stripe: {
|
|
154
|
+
version?: default_2.StripeConfig["apiVersion"];
|
|
158
155
|
secret_key: string;
|
|
159
156
|
account_webhook_secret: string;
|
|
160
157
|
connect_webhook_secret?: string;
|
|
161
158
|
};
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
159
|
+
sync: {
|
|
160
|
+
catalog?: {
|
|
161
|
+
products?: default_2.ProductCreateParams[];
|
|
162
|
+
prices?: default_2.PriceCreateParams[];
|
|
163
|
+
behavior?: {
|
|
164
|
+
onExisting?: "update" | "archive_and_recreate" | "skip" | "error";
|
|
165
|
+
onMissingKey?: "create" | "error";
|
|
166
|
+
};
|
|
167
|
+
metadataKey?: string;
|
|
168
168
|
};
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
169
|
+
webhooks?: {
|
|
170
|
+
account: {
|
|
171
|
+
metadata?: Record<string, string>;
|
|
172
|
+
description?: string;
|
|
173
|
+
path?: string;
|
|
174
|
+
};
|
|
175
|
+
connect: {
|
|
176
|
+
metadata?: Record<string, string>;
|
|
177
|
+
description?: string;
|
|
178
|
+
path?: string;
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
portal?: default_2.BillingPortal.ConfigurationCreateParams;
|
|
182
|
+
tables: Record<keyof typeof stripeTables, boolean>;
|
|
175
183
|
};
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
unstable__afterChange?: CallbackAfterChange;
|
|
184
|
+
callbacks?: {
|
|
185
|
+
afterChange?: CallbackAfterChange;
|
|
179
186
|
};
|
|
180
|
-
detached
|
|
181
|
-
|
|
182
|
-
redirectTtlMs: number;
|
|
187
|
+
detached?: boolean;
|
|
188
|
+
redirectTtlMs?: number;
|
|
183
189
|
}
|
|
184
190
|
|
|
191
|
+
export declare type InputOptions = Partial<InternalOptions>;
|
|
192
|
+
|
|
193
|
+
export declare type InternalConfiguration = RecursiveDeepRequired<InputConfiguration>;
|
|
194
|
+
|
|
185
195
|
export declare const internalConvexStripe: (configuration_: InputConfiguration, options_?: InputOptions) => {
|
|
186
196
|
stripe: {
|
|
187
197
|
http: {
|
|
@@ -1435,13 +1445,13 @@ export declare const internalConvexStripe: (configuration_: InputConfiguration,
|
|
|
1435
1445
|
doc?: undefined;
|
|
1436
1446
|
} | undefined>>;
|
|
1437
1447
|
sync: RegisteredAction<"internal", {
|
|
1438
|
-
portal?: boolean | undefined;
|
|
1439
1448
|
webhooks?: {
|
|
1440
1449
|
account?: boolean | undefined;
|
|
1441
1450
|
connect?: boolean | undefined;
|
|
1442
1451
|
} | undefined;
|
|
1452
|
+
portal?: boolean | undefined;
|
|
1443
1453
|
unstable_catalog?: boolean | undefined;
|
|
1444
|
-
|
|
1454
|
+
tables: boolean | {
|
|
1445
1455
|
withConnect?: boolean | undefined;
|
|
1446
1456
|
};
|
|
1447
1457
|
}, Promise<void>>;
|
|
@@ -1486,6 +1496,10 @@ declare const PortalImplementation: {
|
|
|
1486
1496
|
} & Omit<default_2.BillingPortal.SessionCreateParams, "customer" | "return_url">, stripeOptions: default_2.RequestOptions, configuration: InternalConfiguration, options: InternalOptions) => Promise<default_2.Response<default_2.BillingPortal.Session>>;
|
|
1487
1497
|
};
|
|
1488
1498
|
|
|
1499
|
+
declare type RecursiveDeepRequired<T> = T extends (...args: any[]) => any ? T : T extends object ? {
|
|
1500
|
+
[K in keyof T]-?: RecursiveDeepRequired<T[K]>;
|
|
1501
|
+
} : T;
|
|
1502
|
+
|
|
1489
1503
|
declare type StripeDataModel = DataModelFromSchemaDefinition<typeof stripeSchema>;
|
|
1490
1504
|
|
|
1491
1505
|
declare const stripeSchema: SchemaDefinition< {
|
|
@@ -8857,6 +8871,10 @@ declare const SubscribeImplementation: {
|
|
|
8857
8871
|
} & Omit<default_2.Checkout.SessionCreateParams, "mode" | "customer" | "client_reference_id" | "line_items" | "success_url" | "ui_mode" | "cancel_url">, stripeOptions: default_2.RequestOptions, configuration: InternalConfiguration, options: InternalOptions) => Promise<default_2.Response<default_2.Checkout.Session>>;
|
|
8858
8872
|
};
|
|
8859
8873
|
|
|
8860
|
-
declare
|
|
8874
|
+
export declare const syncAllTables: () => Record<keyof typeof stripeTables, boolean>;
|
|
8875
|
+
|
|
8876
|
+
export declare const syncAllTablesExcept: (tables: Array<keyof typeof stripeTables>) => Record<keyof typeof stripeTables, boolean>;
|
|
8877
|
+
|
|
8878
|
+
export declare const syncOnlyTables: (tables: Array<keyof typeof stripeTables>) => Record<keyof typeof stripeTables, boolean>;
|
|
8861
8879
|
|
|
8862
8880
|
export { }
|