fix(payment-stripe): Prevent the Stripe payment provider to delete Stripe customers - FIXES #13667 #14112
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
What — What changes are introduced in this PR?
The
deleteAccountHoldermethod has been modified to make sure we never remove permanently customers for the Stripe provider, as it is undoable and will causes a lot of issues for customers in case that method is triggered.Why — Why are these changes relevant or necessary?
At the time of writing this PR, the current logic triggers the Stripe SDK to permanently delete a customer, thus preventing checkout and trapping the customer in a loop that cannot be escaped in case of a payment session error
How — How have these changes been implemented?
We just return an empty object for the
deleteAccountHolderabstract fn on the Stripe payment provider.Testing — How have these changes been tested, or how can the reviewer test the feature?
createAccountHolderStepwill try to use thedeleteAccountHolderfn from the serviceExamples
Check the Testing section above
Checklist
Please ensure the following before requesting a review:
yarn changesetand follow the promptsAdditional Context
Related to :
#13667
It's a bit radical, but I'm open to update this in case there's a better solution 🙌
Note
Stops permanently deleting Stripe customers by changing
deleteAccountHolderto return an empty result instead of calling Stripe’s delete API.packages/modules/providers/payment-stripe/src/core/stripe-base.ts: makedeleteAccountHoldera no-op (returns{}) and remove call tostripe.customers.del.@medusajs/payment-stripedescribing the change todeleteAccountHolder.Written by Cursor Bugbot for commit f190bec. This will update automatically on new commits. Configure here.