[PR #3065] [CLOSED] feat(stripe): add customer email update callbacks and enhance email update logic #21530

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3065
Author: @iamsg97
Created: 6/18/2025
Status: Closed

Base: v1.3Head: feature/fix-2385


📝 Commits (7)

📊 Changes

2 files changed (+86 additions, -8 deletions)

View changed files

📝 packages/stripe/src/index.ts (+62 -8)
📝 packages/stripe/src/types.ts (+24 -0)

📄 Description

This pull request introduces changes to enhance Stripe integration in the packages/stripe module, focusing on email synchronization, error handling, and code organization. The most significant updates include adding functionality to sync user email changes with Stripe, introducing callbacks for handling email update success and failure, and reorganizing imports for improved readability.

Enhancements to Stripe email synchronization:

  • Added a new update.after method in the stripe plugin to sync user email changes with Stripe when the email is verified. This includes error handling and support for invoking callbacks on success or failure. (packages/stripe/src/index.ts, packages/stripe/src/index.tsR1041-R1117)

New callback functionality:

  • Introduced onCustomerEmailUpdate and onCustomerEmailUpdateError callbacks in the StripeOptions interface to handle post-update actions and errors, such as logging or notifying users. (packages/stripe/src/types.ts, packages/stripe/src/types.tsR204-R236)

Code organization improvements:

  • Reorganized imports in packages/stripe/src/index.ts for better readability and consistency. (packages/stripe/src/index.ts, [1] [2]
  • Adjusted the order of exported types for consistency. (packages/stripe/src/index.ts, packages/stripe/src/index.tsL1050-R1127)

The above changes were done to fix the raised issue: 2385

Here is the source branch and the commits are mentioned in the above issue's comments


🔄 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/3065 **Author:** [@iamsg97](https://github.com/iamsg97) **Created:** 6/18/2025 **Status:** ❌ Closed **Base:** `v1.3` ← **Head:** `feature/fix-2385` --- ### 📝 Commits (7) - [`eed020c`](https://github.com/better-auth/better-auth/commit/eed020c1631682831f6a4290eaa41c9a607ba2c0) feat(stripe): add customer email update callbacks and enhance email update logic - [`636ee17`](https://github.com/better-auth/better-auth/commit/636ee178976f3dff49d6aadfc9c3f0e3e89e8410) feat(stripe): refactor customer email update logic to handle email verification and improve error handling - [`80cbb13`](https://github.com/better-auth/better-auth/commit/80cbb13ff6c67505b151e0ed8bf0ffa487f24228) Merge branch 'main' of https://github.com/iamsg97/better-auth into feature/fix-2385 - [`9bb102b`](https://github.com/better-auth/better-auth/commit/9bb102bf4cadcd7b253660536d817a0283fcd578) refactor(stripe): remove unnecessary logging for email verification checks - [`7901af0`](https://github.com/better-auth/better-auth/commit/7901af06dfd1806e9c5c6c8ac2b9abab99018645) Merge branch 'main' of https://github.com/iamsg97/better-auth into feature/fix-2385 - [`596ba39`](https://github.com/better-auth/better-auth/commit/596ba395d82737ed6bea910200d28ffbb9093d86) cleanup - [`b72f86f`](https://github.com/better-auth/better-auth/commit/b72f86fd65dd8480c96b107c40373dcc5e44253c) Merge branch 'v1.3' into pr/3065 ### 📊 Changes **2 files changed** (+86 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `packages/stripe/src/index.ts` (+62 -8) 📝 `packages/stripe/src/types.ts` (+24 -0) </details> ### 📄 Description This pull request introduces changes to enhance Stripe integration in the `packages/stripe` module, focusing on email synchronization, error handling, and code organization. The most significant updates include adding functionality to sync user email changes with Stripe, introducing callbacks for handling email update success and failure, and reorganizing imports for improved readability. ### Enhancements to Stripe email synchronization: * Added a new `update.after` method in the `stripe` plugin to sync user email changes with Stripe when the email is verified. This includes error handling and support for invoking callbacks on success or failure. (`packages/stripe/src/index.ts`, [packages/stripe/src/index.tsR1041-R1117](diffhunk://#diff-ccb5282d4490ceec8e8c99f978be2383dd1915db21316f3baba6066420070b08R1041-R1117)) ### New callback functionality: * Introduced `onCustomerEmailUpdate` and `onCustomerEmailUpdateError` callbacks in the `StripeOptions` interface to handle post-update actions and errors, such as logging or notifying users. (`packages/stripe/src/types.ts`, [packages/stripe/src/types.tsR204-R236](diffhunk://#diff-34efa9c605b726e157bb1f56b408f03c2a1abceb7b49c3f60d86c60d8fd0e55dR204-R236)) ### Code organization improvements: * Reorganized imports in `packages/stripe/src/index.ts` for better readability and consistency. (`packages/stripe/src/index.ts`, [[1]](diffhunk://#diff-ccb5282d4490ceec8e8c99f978be2383dd1915db21316f3baba6066420070b08L2-R21) [[2]](diffhunk://#diff-ccb5282d4490ceec8e8c99f978be2383dd1915db21316f3baba6066420070b08L29) * Adjusted the order of exported types for consistency. (`packages/stripe/src/index.ts`, [packages/stripe/src/index.tsL1050-R1127](diffhunk://#diff-ccb5282d4490ceec8e8c99f978be2383dd1915db21316f3baba6066420070b08L1050-R1127)) -------------------------------------------------------------------------------------------------- The above changes were done to fix the raised issue: [2385](https://github.com/better-auth/better-auth/issues/2385) [Here](https://github.com/iamsg97/better-auth/tree/feature/issue-2385) is the source branch and the commits are mentioned in the above issue's comments --- <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:25:26 -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#21530