Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/common-walls-agree.md
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -525,24 +525,9 @@ abstract class StripeBase extends AbstractPaymentProvider<StripeOptions> {
}
}

async deleteAccountHolder({
context,
}: DeleteAccountHolderInput): Promise<DeleteAccountHolderOutput> {
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<DeleteAccountHolderOutput> {
// We cannot delete an account from Stripe as it is a permanent operation.
return {}
}

async listPaymentMethods({
Expand Down