chdsbd / kodiak

🔮 A bot to automatically update and merge GitHub PRs
https://kodiakhq.com
GNU Affero General Public License v3.0
1.04k stars 63 forks source link

fix(web_api): billing payment method updates #709

Closed chdsbd closed 3 years ago

chdsbd commented 3 years ago

Previously if a user updated their payment method, their old payment method would still be attached to the subscription. This basically caused renewals to error until there was manual intervention.

Now, when a new payment method is attached, we remove the old ones so there is only ever one payment method attached to a customer.

We also use the first payment method available on an account for sending invoices when a user adds seats. Previously we would use the payment method attached to a subscription, but when we delete a user's initial payment method, that subscription.default_payment_method becomes null.

sbdchd commented 3 years ago

Got some lint & test errors fyi