@better-auth/stripe 1.2.2-beta.5 → 1.2.2

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,15 +1,15 @@
1
1
 
2
- > @better-auth/stripe@1.2.2-beta.5 build /home/runner/work/better-auth/better-auth/packages/stripe
2
+ > @better-auth/stripe@1.2.2 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: 30.7 kB, chunk size: 30.7 kB, exports: stripe)
8
+ [log] dist/index.cjs (total size: 30.6 kB, chunk size: 30.6 kB, exports: stripe)
9
9
 
10
10
  [log] dist/client.cjs (total size: 160 B, chunk size: 160 B, exports: stripeClient)
11
11
 
12
- [log] dist/index.mjs (total size: 30.5 kB, chunk size: 30.5 kB, exports: stripe)
12
+ [log] dist/index.mjs (total size: 30.4 kB, chunk size: 30.4 kB, exports: stripe)
13
13
 
14
14
  [log] dist/client.mjs (total size: 133 B, chunk size: 133 B, exports: stripeClient)
15
15
 
package/dist/index.cjs CHANGED
@@ -51,7 +51,6 @@ async function onCheckoutSessionCompleted(ctx, options, event) {
51
51
  periodEnd: new Date(subscription.current_period_end * 1e3),
52
52
  stripeSubscriptionId: checkoutSession.subscription,
53
53
  seats,
54
- stripeCustomerId: subscription.customer.toString(),
55
54
  ...trial
56
55
  },
57
56
  where: [
@@ -97,7 +96,7 @@ async function onSubscriptionUpdated(ctx, options, event) {
97
96
  const priceId = subscriptionUpdated.items.data[0].price.id;
98
97
  const plan = await getPlanByPriceId(options, priceId);
99
98
  const referenceId = subscriptionUpdated.metadata?.referenceId;
100
- const customerId = subscriptionUpdated.customer.toString();
99
+ const customerId = subscriptionUpdated.customer?.toString();
101
100
  let subscription = await ctx.context.adapter.findOne({
102
101
  model: "subscription",
103
102
  where: referenceId ? [{ field: "referenceId", value: referenceId }] : [{ field: "stripeSubscriptionId", value: subscriptionUpdated.id }]
@@ -128,7 +127,6 @@ async function onSubscriptionUpdated(ctx, options, event) {
128
127
  periodStart: new Date(subscriptionUpdated.current_period_start * 1e3),
129
128
  periodEnd: new Date(subscriptionUpdated.current_period_end * 1e3),
130
129
  cancelAtPeriodEnd: subscriptionUpdated.cancel_at_period_end,
131
- stripeCustomerId: subscriptionUpdated.customer.toString(),
132
130
  seats,
133
131
  stripeSubscriptionId: subscriptionUpdated.id
134
132
  },
package/dist/index.mjs CHANGED
@@ -49,7 +49,6 @@ async function onCheckoutSessionCompleted(ctx, options, event) {
49
49
  periodEnd: new Date(subscription.current_period_end * 1e3),
50
50
  stripeSubscriptionId: checkoutSession.subscription,
51
51
  seats,
52
- stripeCustomerId: subscription.customer.toString(),
53
52
  ...trial
54
53
  },
55
54
  where: [
@@ -95,7 +94,7 @@ async function onSubscriptionUpdated(ctx, options, event) {
95
94
  const priceId = subscriptionUpdated.items.data[0].price.id;
96
95
  const plan = await getPlanByPriceId(options, priceId);
97
96
  const referenceId = subscriptionUpdated.metadata?.referenceId;
98
- const customerId = subscriptionUpdated.customer.toString();
97
+ const customerId = subscriptionUpdated.customer?.toString();
99
98
  let subscription = await ctx.context.adapter.findOne({
100
99
  model: "subscription",
101
100
  where: referenceId ? [{ field: "referenceId", value: referenceId }] : [{ field: "stripeSubscriptionId", value: subscriptionUpdated.id }]
@@ -126,7 +125,6 @@ async function onSubscriptionUpdated(ctx, options, event) {
126
125
  periodStart: new Date(subscriptionUpdated.current_period_start * 1e3),
127
126
  periodEnd: new Date(subscriptionUpdated.current_period_end * 1e3),
128
127
  cancelAtPeriodEnd: subscriptionUpdated.cancel_at_period_end,
129
- stripeCustomerId: subscriptionUpdated.customer.toString(),
130
128
  seats,
131
129
  stripeSubscriptionId: subscriptionUpdated.id
132
130
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@better-auth/stripe",
3
3
  "author": "Bereket Engida",
4
- "version": "1.2.2-beta.5",
4
+ "version": "1.2.2",
5
5
  "main": "dist/index.cjs",
6
6
  "license": "MIT",
7
7
  "keywords": [
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "zod": "^3.24.1",
38
- "better-auth": "^1.2.2-beta.5"
38
+ "better-auth": "^1.2.2"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/better-sqlite3": "^7.6.12",
package/src/hooks.ts CHANGED
@@ -43,7 +43,6 @@ export async function onCheckoutSessionCompleted(
43
43
  periodEnd: new Date(subscription.current_period_end * 1000),
44
44
  stripeSubscriptionId: checkoutSession.subscription as string,
45
45
  seats,
46
- stripeCustomerId: subscription.customer.toString(),
47
46
  ...trial,
48
47
  },
49
48
  where: [
@@ -97,7 +96,7 @@ export async function onSubscriptionUpdated(
97
96
  const plan = await getPlanByPriceId(options, priceId);
98
97
 
99
98
  const referenceId = subscriptionUpdated.metadata?.referenceId;
100
- const customerId = subscriptionUpdated.customer.toString();
99
+ const customerId = subscriptionUpdated.customer?.toString();
101
100
  let subscription = await ctx.context.adapter.findOne<Subscription>({
102
101
  model: "subscription",
103
102
  where: referenceId
@@ -133,7 +132,6 @@ export async function onSubscriptionUpdated(
133
132
  periodStart: new Date(subscriptionUpdated.current_period_start * 1000),
134
133
  periodEnd: new Date(subscriptionUpdated.current_period_end * 1000),
135
134
  cancelAtPeriodEnd: subscriptionUpdated.cancel_at_period_end,
136
- stripeCustomerId: subscriptionUpdated.customer.toString(),
137
135
  seats,
138
136
  stripeSubscriptionId: subscriptionUpdated.id,
139
137
  },
@@ -341,6 +341,7 @@ describe("stripe", async () => {
341
341
  },
342
342
  ],
343
343
  });
344
+
344
345
  expect(updatedSubscription).toMatchObject({
345
346
  id: testSubscriptionId,
346
347
  status: "active",