@better-auth/stripe 1.2.6 → 1.2.7

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,17 +1,17 @@
1
1
 
2
- > @better-auth/stripe@1.2.6 build /home/runner/work/better-auth/better-auth/packages/stripe
2
+ > @better-auth/stripe@1.2.7 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: 36.9 kB, chunk size: 36.9 kB, exports: stripe)
8
+ [log] dist/index.cjs (total size: 37 kB, chunk size: 37 kB, exports: stripe)
9
9
 
10
- [log] dist/client.cjs (total size: 160 B, chunk size: 160 B, exports: stripeClient)
10
+ [log] dist/client.cjs (total size: 224 B, chunk size: 224 B, exports: stripeClient)
11
11
 
12
- [log] dist/index.mjs (total size: 36.6 kB, chunk size: 36.6 kB, exports: stripe)
12
+ [log] dist/index.mjs (total size: 36.7 kB, chunk size: 36.7 kB, exports: stripe)
13
13
 
14
- [log] dist/client.mjs (total size: 133 B, chunk size: 133 B, exports: stripeClient)
14
+ [log] dist/client.mjs (total size: 197 B, chunk size: 197 B, exports: stripeClient)
15
15
 
16
- Σ Total dist size (byte size): 199 kB
16
+ Σ Total dist size (byte size): 200 kB
17
17
  [log]
package/dist/client.cjs CHANGED
@@ -3,7 +3,10 @@
3
3
  const stripeClient = (options) => {
4
4
  return {
5
5
  id: "stripe-client",
6
- $InferServerPlugin: {}
6
+ $InferServerPlugin: {},
7
+ pathMethods: {
8
+ "/subscription/restore": "POST"
9
+ }
7
10
  };
8
11
  };
9
12
 
package/dist/client.d.cts CHANGED
@@ -20,6 +20,9 @@ declare const stripeClient: <O extends {
20
20
  stripeClient: any;
21
21
  stripeWebhookSecret: string;
22
22
  }>>;
23
+ pathMethods: {
24
+ "/subscription/restore": "POST";
25
+ };
23
26
  };
24
27
 
25
28
  export { stripeClient };
package/dist/client.d.mts CHANGED
@@ -20,6 +20,9 @@ declare const stripeClient: <O extends {
20
20
  stripeClient: any;
21
21
  stripeWebhookSecret: string;
22
22
  }>>;
23
+ pathMethods: {
24
+ "/subscription/restore": "POST";
25
+ };
23
26
  };
24
27
 
25
28
  export { stripeClient };
package/dist/client.d.ts CHANGED
@@ -20,6 +20,9 @@ declare const stripeClient: <O extends {
20
20
  stripeClient: any;
21
21
  stripeWebhookSecret: string;
22
22
  }>>;
23
+ pathMethods: {
24
+ "/subscription/restore": "POST";
25
+ };
23
26
  };
24
27
 
25
28
  export { stripeClient };
package/dist/client.mjs CHANGED
@@ -1,7 +1,10 @@
1
1
  const stripeClient = (options) => {
2
2
  return {
3
3
  id: "stripe-client",
4
- $InferServerPlugin: {}
4
+ $InferServerPlugin: {},
5
+ pathMethods: {
6
+ "/subscription/restore": "POST"
7
+ }
5
8
  };
6
9
  };
7
10
 
package/dist/index.cjs CHANGED
@@ -817,9 +817,12 @@ const stripe = (options) => {
817
817
  });
818
818
  }
819
819
  const activeSubscription = await client.subscriptions.list({
820
- customer: subscription.stripeCustomerId,
821
- status: "active"
822
- }).then((res) => res.data[0]);
820
+ customer: subscription.stripeCustomerId
821
+ }).then(
822
+ (res) => res.data.filter(
823
+ (sub) => sub.status === "active" || sub.status === "trialing"
824
+ )[0]
825
+ );
823
826
  if (!activeSubscription) {
824
827
  throw ctx.error("BAD_REQUEST", {
825
828
  message: STRIPE_ERROR_CODES.SUBSCRIPTION_NOT_FOUND
package/dist/index.mjs CHANGED
@@ -815,9 +815,12 @@ const stripe = (options) => {
815
815
  });
816
816
  }
817
817
  const activeSubscription = await client.subscriptions.list({
818
- customer: subscription.stripeCustomerId,
819
- status: "active"
820
- }).then((res) => res.data[0]);
818
+ customer: subscription.stripeCustomerId
819
+ }).then(
820
+ (res) => res.data.filter(
821
+ (sub) => sub.status === "active" || sub.status === "trialing"
822
+ )[0]
823
+ );
821
824
  if (!activeSubscription) {
822
825
  throw ctx.error("BAD_REQUEST", {
823
826
  message: STRIPE_ERROR_CODES.SUBSCRIPTION_NOT_FOUND
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.6",
4
+ "version": "1.2.7",
5
5
  "main": "dist/index.cjs",
6
6
  "license": "MIT",
7
7
  "keywords": [
@@ -35,14 +35,14 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "zod": "^3.24.1",
38
- "better-auth": "^1.2.6"
38
+ "better-auth": "^1.2.7"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/better-sqlite3": "^7.6.12",
42
42
  "better-sqlite3": "^11.6.0",
43
43
  "vitest": "^1.6.0",
44
44
  "stripe": "^17.7.0",
45
- "better-call": "^1.0.7"
45
+ "better-call": "^1.0.8"
46
46
  },
47
47
  "scripts": {
48
48
  "test": "vitest",
package/src/client.ts CHANGED
@@ -27,5 +27,8 @@ export const stripeClient = <
27
27
  }
28
28
  >
29
29
  >,
30
+ pathMethods: {
31
+ "/subscription/restore": "POST",
32
+ },
30
33
  } satisfies BetterAuthClientPlugin;
31
34
  };
package/src/index.ts CHANGED
@@ -681,9 +681,13 @@ export const stripe = <O extends StripeOptions>(options: O) => {
681
681
  const activeSubscription = await client.subscriptions
682
682
  .list({
683
683
  customer: subscription.stripeCustomerId,
684
- status: "active",
685
684
  })
686
- .then((res) => res.data[0]);
685
+ .then(
686
+ (res) =>
687
+ res.data.filter(
688
+ (sub) => sub.status === "active" || sub.status === "trialing",
689
+ )[0],
690
+ );
687
691
  if (!activeSubscription) {
688
692
  throw ctx.error("BAD_REQUEST", {
689
693
  message: STRIPE_ERROR_CODES.SUBSCRIPTION_NOT_FOUND,