diff --git a/.changeset/common-walls-agree.md b/.changeset/common-walls-agree.md new file mode 100644 index 0000000000000..095ee674b7d53 --- /dev/null +++ b/.changeset/common-walls-agree.md @@ -0,0 +1,5 @@ +--- +"@medusajs/payment-stripe": patch +--- + +Modify the `deleteAccountHolder` implementation for the Stripe payment provider to prevent the permanent deletion of the underlying Stripe customer. \ No newline at end of file diff --git a/packages/modules/providers/payment-stripe/src/core/stripe-base.ts b/packages/modules/providers/payment-stripe/src/core/stripe-base.ts index ec86a32e1b0c5..4555d82b4a77a 100644 --- a/packages/modules/providers/payment-stripe/src/core/stripe-base.ts +++ b/packages/modules/providers/payment-stripe/src/core/stripe-base.ts @@ -525,24 +525,9 @@ abstract class StripeBase extends AbstractPaymentProvider { } } - async deleteAccountHolder({ - context, - }: DeleteAccountHolderInput): Promise { - const { account_holder } = context - const accountHolderId = account_holder?.data?.id as string | undefined - if (!accountHolderId) { - throw this.buildError( - "No account holder in context", - new Error("No account holder provided while deleting account holder") - ) - } - - try { - await this.stripe_.customers.del(accountHolderId) - return {} - } catch (e) { - throw this.buildError("An error occurred in deleteAccountHolder", e) - } + async deleteAccountHolder(_: DeleteAccountHolderInput): Promise { + // We cannot delete an account from Stripe as it is a permanent operation. + return {} } async listPaymentMethods({