[PR #4562] [MERGED] fix(stripe): prevent multiple free trials for same user #22350

Closed
opened 2026-04-15 20:59:05 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4562
Author: @RikhiSingh
Created: 9/10/2025
Status: Merged
Merged: 9/11/2025
Merged by: @himself65

Base: canaryHead: fix/stripe-trial-abuse-prevention


📝 Commits (3)

  • 7f57d2e fix(stripe): prevent multiple free trials for same user
  • 65f6677 refactor(stripe): update subscription test to prevent multiple free trials
  • dc0dfed Chore(lint errors fixed)

📊 Changes

5 files changed (+174 additions, -42 deletions)

View changed files

📝 biome.json (+1 -1)
📝 docs/components/nav-mobile.tsx (+1 -2)
📝 docs/content/docs/plugins/stripe.mdx (+20 -1)
📝 packages/stripe/src/index.ts (+3 -2)
📝 packages/stripe/src/stripe.test.ts (+149 -36)

📄 Description

  • Modified trial eligibility logic to check across all plans, not just same plan
  • Users can now only get one trial regardless of plan switching
  • Prevents trial abuse through cancel/resubscribe cycles
  • Added comprehensive tests for trial prevention scenarios

Closes #4539


Summary by cubic

Enforces one free trial per user across all plans in the Stripe plugin. Closes #4539 and stops trial abuse from plan switching or cancel/resubscribe loops.

  • Bug Fixes
    • Trial eligibility now checks a user’s full history, not just the same plan.
    • Users with any prior trial won’t receive new trials on any plan.
    • Added tests for resubscribe and cross‑plan scenarios.
    • Updated Stripe plugin docs to note automatic trial abuse prevention.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/4562 **Author:** [@RikhiSingh](https://github.com/RikhiSingh) **Created:** 9/10/2025 **Status:** ✅ Merged **Merged:** 9/11/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `fix/stripe-trial-abuse-prevention` --- ### 📝 Commits (3) - [`7f57d2e`](https://github.com/better-auth/better-auth/commit/7f57d2e3ba7c6accca6f0e55959bb25bcfc5bb36) fix(stripe): prevent multiple free trials for same user - [`65f6677`](https://github.com/better-auth/better-auth/commit/65f667784778a8bcb1aed89377bd029fb282ccdc) refactor(stripe): update subscription test to prevent multiple free trials - [`dc0dfed`](https://github.com/better-auth/better-auth/commit/dc0dfedb1d54ec27ddb2d69c75c874b0e4211570) Chore(lint errors fixed) ### 📊 Changes **5 files changed** (+174 additions, -42 deletions) <details> <summary>View changed files</summary> 📝 `biome.json` (+1 -1) 📝 `docs/components/nav-mobile.tsx` (+1 -2) 📝 `docs/content/docs/plugins/stripe.mdx` (+20 -1) 📝 `packages/stripe/src/index.ts` (+3 -2) 📝 `packages/stripe/src/stripe.test.ts` (+149 -36) </details> ### 📄 Description - Modified trial eligibility logic to check across all plans, not just same plan - Users can now only get one trial regardless of plan switching - Prevents trial abuse through cancel/resubscribe cycles - Added comprehensive tests for trial prevention scenarios Closes #4539 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Enforces one free trial per user across all plans in the Stripe plugin. Closes #4539 and stops trial abuse from plan switching or cancel/resubscribe loops. - **Bug Fixes** - Trial eligibility now checks a user’s full history, not just the same plan. - Users with any prior trial won’t receive new trials on any plan. - Added tests for resubscribe and cross‑plan scenarios. - Updated Stripe plugin docs to note automatic trial abuse prevention. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-15 20:59:05 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#22350