@better-auth/stripe 1.2.1 → 1.2.2-beta.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,5 +1,5 @@
1
1
 
2
- > @better-auth/stripe@1.2.1 build /home/runner/work/better-auth/better-auth/packages/stripe
2
+ > @better-auth/stripe@1.2.2-beta.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]
package/dist/index.cjs CHANGED
@@ -96,11 +96,10 @@ async function onSubscriptionUpdated(ctx, options, event) {
96
96
  const priceId = subscriptionUpdated.items.data[0].price.id;
97
97
  const plan = await getPlanByPriceId(options, priceId);
98
98
  const referenceId = subscriptionUpdated.metadata?.referenceId;
99
- const subscriptionId = subscriptionUpdated.id;
100
99
  const customerId = subscriptionUpdated.customer.toString();
101
100
  let subscription = await ctx.context.adapter.findOne({
102
101
  model: "subscription",
103
- where: referenceId ? [{ field: "referenceId", value: referenceId }] : subscriptionId ? [{ field: "stripeSubscriptionId", value: subscriptionId }] : []
102
+ where: referenceId ? [{ field: "referenceId", value: referenceId }] : [{ field: "stripeSubscriptionId", value: subscriptionUpdated.id }]
104
103
  });
105
104
  if (!subscription) {
106
105
  const subs = await ctx.context.adapter.findMany({
package/dist/index.mjs CHANGED
@@ -94,11 +94,10 @@ async function onSubscriptionUpdated(ctx, options, event) {
94
94
  const priceId = subscriptionUpdated.items.data[0].price.id;
95
95
  const plan = await getPlanByPriceId(options, priceId);
96
96
  const referenceId = subscriptionUpdated.metadata?.referenceId;
97
- const subscriptionId = subscriptionUpdated.id;
98
97
  const customerId = subscriptionUpdated.customer.toString();
99
98
  let subscription = await ctx.context.adapter.findOne({
100
99
  model: "subscription",
101
- where: referenceId ? [{ field: "referenceId", value: referenceId }] : subscriptionId ? [{ field: "stripeSubscriptionId", value: subscriptionId }] : []
100
+ where: referenceId ? [{ field: "referenceId", value: referenceId }] : [{ field: "stripeSubscriptionId", value: subscriptionUpdated.id }]
102
101
  });
103
102
  if (!subscription) {
104
103
  const subs = await ctx.context.adapter.findMany({
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.1",
4
+ "version": "1.2.2-beta.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.1"
38
+ "better-auth": "^1.2.2-beta.2"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/better-sqlite3": "^7.6.12",
package/src/hooks.ts CHANGED
@@ -96,15 +96,12 @@ export async function onSubscriptionUpdated(
96
96
  const plan = await getPlanByPriceId(options, priceId);
97
97
 
98
98
  const referenceId = subscriptionUpdated.metadata?.referenceId;
99
- const subscriptionId = subscriptionUpdated.id;
100
99
  const customerId = subscriptionUpdated.customer.toString();
101
100
  let subscription = await ctx.context.adapter.findOne<Subscription>({
102
101
  model: "subscription",
103
102
  where: referenceId
104
103
  ? [{ field: "referenceId", value: referenceId }]
105
- : subscriptionId
106
- ? [{ field: "stripeSubscriptionId", value: subscriptionId }]
107
- : [],
104
+ : [{ field: "stripeSubscriptionId", value: subscriptionUpdated.id }],
108
105
  });
109
106
  if (!subscription) {
110
107
  const subs = await ctx.context.adapter.findMany<Subscription>({