Closed FrozenGod closed 6 months ago
Hi there. The current behaviour is the wanted one imo. I don't think that changing the default payment method on the customer should update the payment method on all of the existing subscriptions. We could add a new method on the subscription model maybe to update that payment method as well but I don't think that the current updateDefaultPaymentMethod
method should automatically change the PM for a subscription as those are two separate concerns.
Hi @driesvints
I don't really know what is the default payment method used for. Stripe sets the default payment method on the subscription by default, which always overrides the default payment method of the customer.
Maybe I'm not aware of the various use cases but for subscriptions I really can't come up with a way to have any use in the Customer's default payment method.
I think it's not the best approach by Stripe in the first place. I understand Cashier is just a wrapper on an existing API and I agree that Cashier should at least have an additional method for changing Subscription's payment method.
It was easy to create an event handler with:
$subscription = $billable->subscription();
$subscription->updateStripeSubscription([
'default_payment_method' => $newPaymentMethodId,
]);
But the time it took me to debug and research why my default payment method is not charged by default is definitely a huge waste of time, especially for people who use Cashier and/or Stripe API for the first time.
The
updateDefaultPaymentMethod()
method only updates theinvoice_settings.default_payment_method
on the Customer object in Stripe.But when a plan is swapped with another plan (
$subscription->swapAndInvoice($plan)
) – Stripe charges the card attached at the time of subscription creation because as described in the Stripe documentation:What's the point of updating Customer’s
invoice_settings.default_payment_method
if Subscription’sdefault_payment_method
overrides it every time?Is it possible to change the
default_payment_method
on the Subscription in the current version of Cashier?Currently updating the default payment method results in the following:
Payment method is set as default for the Customer (*4444):
Payment method is NOT set as default on the Subscription (*4242):
New charge on a new invoice for swapping plans charges the Subscription default payment method (4242), and not the Customer default (4444):
This means that we cannot initiate a default payment method change (the pm to be actually charged for next invoices) using Cashier's build-in methods alone. This makes the whole
defaultPaymentMethod()
method redundant because it does nothing functionality-wise. It just changes the position of the "Default" badge in the Stripe customer object with no real world utility.The subscription was created using: