[PR #5818] [CLOSED] fix(stripe): handle billing portal cancellation with cancel_at field #6248

Closed
opened 2026-03-13 12:52:21 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5818
Author: @bytaesu
Created: 11/7/2025
Status: Closed

Base: canaryHead: 2025-11-07/stripe-portal-cancellation


📝 Commits (2)

  • 0049982 fix: handle billing portal cancellation with cancel_at field
  • f42f5a0 test: add billing portal cancellation test cases

📊 Changes

2 files changed (+414 additions, -2 deletions)

View changed files

📝 packages/stripe/src/hooks.ts (+5 -2)
📝 packages/stripe/src/stripe.test.ts (+409 -0)

📄 Description

Source: https://docs.stripe.com/billing/subscriptions/cancel

Closes https://github.com/better-auth/better-auth/issues/5780


Summary by cubic

Handle Stripe Billing Portal cancellations that use the cancel_at field. We now treat either cancel_at or cancel_at_period_end as scheduled cancel, persist cancelAtPeriodEnd, and fire onSubscriptionCancel.

  • Bug Fixes
    • In onSubscriptionUpdated, set cancelAtPeriodEnd if cancel_at_period_end is true or cancel_at is present.
    • Trigger onSubscriptionCancel when an active subscription is newly marked as canceled via either field.
    • Added tests for cancel_at, cancel_at_period_end, and both fields to prevent regressions.

Written for commit f42f5a01e4. Summary will update automatically on new commits.


🔄 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/5818 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 11/7/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `2025-11-07/stripe-portal-cancellation` --- ### 📝 Commits (2) - [`0049982`](https://github.com/better-auth/better-auth/commit/0049982c87a8ff3ac82d301c7f1d322cefed7acd) fix: handle billing portal cancellation with cancel_at field - [`f42f5a0`](https://github.com/better-auth/better-auth/commit/f42f5a01e46d89890709cb4eff7aef301ec2c35c) test: add billing portal cancellation test cases ### 📊 Changes **2 files changed** (+414 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/stripe/src/hooks.ts` (+5 -2) 📝 `packages/stripe/src/stripe.test.ts` (+409 -0) </details> ### 📄 Description Source: https://docs.stripe.com/billing/subscriptions/cancel Closes https://github.com/better-auth/better-auth/issues/5780 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Handle Stripe Billing Portal cancellations that use the cancel_at field. We now treat either cancel_at or cancel_at_period_end as scheduled cancel, persist cancelAtPeriodEnd, and fire onSubscriptionCancel. - **Bug Fixes** - In onSubscriptionUpdated, set cancelAtPeriodEnd if cancel_at_period_end is true or cancel_at is present. - Trigger onSubscriptionCancel when an active subscription is newly marked as canceled via either field. - Added tests for cancel_at, cancel_at_period_end, and both fields to prevent regressions. <sup>Written for commit f42f5a01e46d89890709cb4eff7aef301ec2c35c. Summary will update automatically on new commits.</sup> <!-- 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-03-13 12:52:21 -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#6248