[PR #4995] [MERGED] fix(stripe): sync customer email on db change #13949

Closed
opened 2026-04-13 09:14:00 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4995
Author: @himself65
Created: 9/30/2025
Status: Merged
Merged: 9/30/2025
Merged by: @himself65

Base: canaryHead: himself65/2025/09/30/stripe-email-sync


📝 Commits (1)

  • 6be9f0c fix(stripe): sync customer email on db change

📊 Changes

2 files changed (+130 additions, -0 deletions)

View changed files

📝 packages/stripe/src/index.ts (+50 -0)
📝 packages/stripe/src/stripe.test.ts (+80 -0)

📄 Description

Fixes: https://github.com/better-auth/better-auth/issues/2385


Summary by cubic

Sync Stripe customer email when a user's email changes in our database. Keeps Stripe data consistent and prevents checkout/billing issues from mismatched emails.

  • Bug Fixes
    • Added after user.update hook to compare and update Stripe customer email when a stripeCustomerId exists.
    • Gracefully handle deleted customers and errors with logs (best-effort, no failures).
    • Added test verifying retrieve and update are called on email change.

🔄 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/4995 **Author:** [@himself65](https://github.com/himself65) **Created:** 9/30/2025 **Status:** ✅ Merged **Merged:** 9/30/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/09/30/stripe-email-sync` --- ### 📝 Commits (1) - [`6be9f0c`](https://github.com/better-auth/better-auth/commit/6be9f0c2576f00718151e3610634fcd88283f64d) fix(stripe): sync customer email on db change ### 📊 Changes **2 files changed** (+130 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/stripe/src/index.ts` (+50 -0) 📝 `packages/stripe/src/stripe.test.ts` (+80 -0) </details> ### 📄 Description Fixes: https://github.com/better-auth/better-auth/issues/2385 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Sync Stripe customer email when a user's email changes in our database. Keeps Stripe data consistent and prevents checkout/billing issues from mismatched emails. - **Bug Fixes** - Added after user.update hook to compare and update Stripe customer email when a stripeCustomerId exists. - Gracefully handle deleted customers and errors with logs (best-effort, no failures). - Added test verifying retrieve and update are called on email change. <!-- 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-13 09:14:00 -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#13949