diff --git a/src/Core/Billing/Services/Implementations/SubscriberService.cs b/src/Core/Billing/Services/Implementations/SubscriberService.cs index 401d9ce2caa9..b0d290a55613 100644 --- a/src/Core/Billing/Services/Implementations/SubscriberService.cs +++ b/src/Core/Billing/Services/Implementations/SubscriberService.cs @@ -768,8 +768,9 @@ private async Task RemoveBraintreeCustomerIdAsync( { var metadata = customer.Metadata ?? new Dictionary(); - if (metadata.ContainsKey(BraintreeCustomerIdKey)) + if (metadata.TryGetValue(BraintreeCustomerIdKey, out var value)) { + metadata[BraintreeCustomerIdOldKey] = value; metadata[BraintreeCustomerIdKey] = null; await stripeAdapter.CustomerUpdateAsync(customer.Id, new CustomerUpdateOptions