@better-auth/stripe 1.3.11 → 1.3.13

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.
@@ -1,11 +1,11 @@
1
1
 
2
- > @better-auth/stripe@1.3.11 build /home/runner/work/better-auth/better-auth/packages/stripe
2
+ > @better-auth/stripe@1.3.13 build /home/runner/work/better-auth/better-auth/packages/stripe
3
3
  > unbuild
4
4
 
5
5
  [info] Automatically detected entries: src/index, src/client [esm] [cjs] [dts]
6
6
  [info] Building stripe
7
7
  [success] Build succeeded for stripe
8
- [log] dist/index.cjs (total size: 45.4 kB, chunk size: 45.4 kB, exports: stripe)
8
+ [log] dist/index.cjs (total size: 45.3 kB, chunk size: 45.3 kB, exports: stripe)
9
9
 
10
10
  [log] dist/client.cjs (total size: 270 B, chunk size: 270 B, exports: stripeClient)
11
11
 
package/dist/index.cjs CHANGED
@@ -1321,20 +1321,19 @@ const stripe = (options) => {
1321
1321
  userId: user.id
1322
1322
  }
1323
1323
  });
1324
- const updatedUser = await ctx2.context.internalAdapter.updateUser(user.id, {
1324
+ await ctx2.context.internalAdapter.updateUser(user.id, {
1325
1325
  stripeCustomerId: stripeCustomer.id
1326
1326
  });
1327
- if (!updatedUser) {
1328
- betterAuth.logger.error("#BETTER_AUTH: Failed to create customer");
1329
- } else {
1330
- await options.onCustomerCreate?.(
1331
- {
1332
- stripeCustomer,
1333
- user
1334
- },
1335
- ctx2
1336
- );
1337
- }
1327
+ await options.onCustomerCreate?.(
1328
+ {
1329
+ stripeCustomer,
1330
+ user: {
1331
+ ...user,
1332
+ stripeCustomerId: stripeCustomer.id
1333
+ }
1334
+ },
1335
+ ctx2
1336
+ );
1338
1337
  }
1339
1338
  }
1340
1339
  }
package/dist/index.d.cts CHANGED
@@ -230,7 +230,9 @@ interface StripeOptions {
230
230
  */
231
231
  onCustomerCreate?: (data: {
232
232
  stripeCustomer: Stripe.Customer;
233
- user: User;
233
+ user: User & {
234
+ stripeCustomerId: string;
235
+ };
234
236
  }, ctx: GenericEndpointContext) => Promise<void>;
235
237
  /**
236
238
  * A custom function to get the customer create
package/dist/index.d.mts CHANGED
@@ -230,7 +230,9 @@ interface StripeOptions {
230
230
  */
231
231
  onCustomerCreate?: (data: {
232
232
  stripeCustomer: Stripe.Customer;
233
- user: User;
233
+ user: User & {
234
+ stripeCustomerId: string;
235
+ };
234
236
  }, ctx: GenericEndpointContext) => Promise<void>;
235
237
  /**
236
238
  * A custom function to get the customer create
package/dist/index.d.ts CHANGED
@@ -230,7 +230,9 @@ interface StripeOptions {
230
230
  */
231
231
  onCustomerCreate?: (data: {
232
232
  stripeCustomer: Stripe.Customer;
233
- user: User;
233
+ user: User & {
234
+ stripeCustomerId: string;
235
+ };
234
236
  }, ctx: GenericEndpointContext) => Promise<void>;
235
237
  /**
236
238
  * A custom function to get the customer create
package/dist/index.mjs CHANGED
@@ -1305,20 +1305,19 @@ const stripe = (options) => {
1305
1305
  userId: user.id
1306
1306
  }
1307
1307
  });
1308
- const updatedUser = await ctx2.context.internalAdapter.updateUser(user.id, {
1308
+ await ctx2.context.internalAdapter.updateUser(user.id, {
1309
1309
  stripeCustomerId: stripeCustomer.id
1310
1310
  });
1311
- if (!updatedUser) {
1312
- logger.error("#BETTER_AUTH: Failed to create customer");
1313
- } else {
1314
- await options.onCustomerCreate?.(
1315
- {
1316
- stripeCustomer,
1317
- user
1318
- },
1319
- ctx2
1320
- );
1321
- }
1311
+ await options.onCustomerCreate?.(
1312
+ {
1313
+ stripeCustomer,
1314
+ user: {
1315
+ ...user,
1316
+ stripeCustomerId: stripeCustomer.id
1317
+ }
1318
+ },
1319
+ ctx2
1320
+ );
1322
1321
  }
1323
1322
  }
1324
1323
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@better-auth/stripe",
3
3
  "author": "Bereket Engida",
4
- "version": "1.3.11",
4
+ "version": "1.3.13",
5
5
  "main": "dist/index.cjs",
6
6
  "license": "MIT",
7
7
  "keywords": [
@@ -41,13 +41,13 @@
41
41
  },
42
42
  "peerDependencies": {
43
43
  "stripe": "^18",
44
- "better-auth": "1.3.11"
44
+ "better-auth": "1.3.13"
45
45
  },
46
46
  "devDependencies": {
47
47
  "better-call": "1.0.19",
48
48
  "stripe": "^18.5.0",
49
49
  "unbuild": "3.6.1",
50
- "better-auth": "1.3.11"
50
+ "better-auth": "1.3.13"
51
51
  },
52
52
  "scripts": {
53
53
  "test": "vitest",
package/src/index.ts CHANGED
@@ -1242,21 +1242,19 @@ export const stripe = <O extends StripeOptions>(options: O) => {
1242
1242
  userId: user.id,
1243
1243
  },
1244
1244
  });
1245
- const updatedUser =
1246
- await ctx.context.internalAdapter.updateUser(user.id, {
1247
- stripeCustomerId: stripeCustomer.id,
1248
- });
1249
- if (!updatedUser) {
1250
- logger.error("#BETTER_AUTH: Failed to create customer");
1251
- } else {
1252
- await options.onCustomerCreate?.(
1253
- {
1254
- stripeCustomer,
1255
- user,
1245
+ await ctx.context.internalAdapter.updateUser(user.id, {
1246
+ stripeCustomerId: stripeCustomer.id,
1247
+ });
1248
+ await options.onCustomerCreate?.(
1249
+ {
1250
+ stripeCustomer,
1251
+ user: {
1252
+ ...user,
1253
+ stripeCustomerId: stripeCustomer.id,
1256
1254
  },
1257
- ctx,
1258
- );
1259
- }
1255
+ },
1256
+ ctx,
1257
+ );
1260
1258
  }
1261
1259
  },
1262
1260
  },
package/src/types.ts CHANGED
@@ -188,7 +188,7 @@ export interface StripeOptions {
188
188
  onCustomerCreate?: (
189
189
  data: {
190
190
  stripeCustomer: Stripe.Customer;
191
- user: User;
191
+ user: User & { stripeCustomerId: string };
192
192
  },
193
193
  ctx: GenericEndpointContext,
194
194
  ) => Promise<void>;