I have found what might be a bug in the Stripe subscription or Stripe billing modification logic. I have created a test subscription that renews daily for testing. Daily billing worked correctly. I then used the billing modification pro-form to change the credit card. I can see in the Stripe admin panel that the customer’s default payment method was changed to the new credit card, but daily billing continued to charge the original credit card. That’s not the behavior I expected. I expected the daily billing to begin to use the new credit card.
I noticed in the Stripe admin panel in the description detail for the subscription that Billing method = “Charge specific payment method” and Payment method = the last 4 digits of the original credit card, not the new credit card.
I believe the solution is either 1) modify the billing modification logic to include updating the subscription’s payment method, or 2) modify the logic that originally creates the subscription to set the billing method to the default invoice payment method (see below). I am happy to test any fix to this problem.
Below is the subscription request post that originally created the subscription I am testing. Notice the default payment method is set to a specific payment method on file (the original credit card).
Subscriptions API
Request POST body
{
“customer”: “cus_NbaRNcLyEramnt”,
“metadata”: {
“tax_info”: “{“tax”:“0.00”,“tax_per”:“0%”}”
},
“default_payment_method”: “pm_1MqRVbCylVvE4X8BjRvajv6Q”,
“trial_from_plan”: “true”,
“items”: {
“0”: {
“plan”: “s2_plan_109a1d79eec04d7968414c299bdab416”
}
},
“expand”: {
“0”: “latest_invoice.payment_intent”,
“1”: “pending_setup_intent”
}
}
Below are citations from the Stripe subscriptions API documentation. It suggests that if you want the subscription to use the default payment method you should not include default payment method in the subscriptions request post.
default_payment_method - optional
ID of the default payment method for the subscription. It must belong to the customer associated with the subscription. This takes precedence over default_source. If neither are set, invoices will use the customer’s invoice_settings.default_payment_method or default_source.
invoice_settings.default_payment_method
ID of a payment method that’s attached to the customer, to be used as the customer’s default payment method for subscriptions and invoices.
Note: I see in the S2member billing modification request posts and responses that the invoice_settings.default_payment_method is set to the new credit card by the billing modification pro-form logic.
default_source
ID of the default payment source for the customer.
If you are using payment methods created via the PaymentMethods API, see the invoice_settings.default_payment_method field instead.