#allan-tang_best-practices

1 messages ¡ Page 1 of 1 (latest)

runic spindleBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1412841989505814608

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

vague swan
#

Timeline

Customer id is cus_J2MIKhbitP3RgX

June 6th

  • Default payment method changed from master card to amex card with the purchase of a monthly subscription plan
    payment id old - pm_1RRCdKB8wovMzpKJDrIueDFk
    payment id new - pm_1RWx6fB8wovMzpKJxWhdLK57

    customer.updated event - evt_1RWx71B8wovMzpKJnYcaPkaE
    customer.subscription.updated event - evt_1RWx6oB8wovMzpKJhRZsnKRr

June 30th

  • We attach a new payment option to the customer (which ends up being the same old master card). Default payment changes from amex card to master card.
    payment id old - pm_1RWx6fB8wovMzpKJxWhdLK57
    payment id new - pm_1RfhLDB8wovMzpKJIk0gR9YS

    payment_method.attached - evt_1RfhLGB8wovMzpKJp0os3SV4
    customer.updated - evt_1RfhLHB8wovMzpKJgyHonng4

July 6th

  • Next monthly payment still charged old amex card despite the customer having the default payment method set to the master card

    payment_intent.created - evt_3RhqMHB8wovMzpKJ0T7aCPoj
    customer.subscription.updated - evt_1RhpPrB8wovMzpKJoVKRH0Rf

August 7th

  • Customer complains and we remove all cards except the master card as a temp solution.

payment_method.detached - evt_1RtWh2B8wovMzpKJRFmL2JtA
customer.subscription.updated - evt_1RtWh3B8wovMzpKJ6H33zRgN

viral bone
#

Hi there, I'm working another thread and will get to you once I'm done.

runic spindleBOT
dapper sequoia
#

Hi, taking over as my teammate needs to step away. Let me catch up.

vague swan
#

No worries, thanks for taking a look.

dapper sequoia
#

There is a lot going on here. From looking at your logs, it appears that you're making explicit calls to update the default payment method on the customer:

You made this request, https://dashboard.stripe.com/logs/req_TWnVrENbvPx6fz to update the customer's defauly payment method at
2025-05-19 19:18:47 UTC to pm_1RQZCyB8wovMzpKJAAWfq0gz

The same request, https://dashboard.stripe.com/logs/req_bF5EnjI6WyzLmA to update the customer at
2025-06-06 10:02:58 UTC to pm_1RWx6fB8wovMzpKJxWhdLK57

On 2025-06-30 13:01:50 UTC, you made the same request https://dashboard.stripe.com/logs/req_K82xxe3yBrKqeQ and changed the pm to pm_1RfhLDB8wovMzpKJIk0gR9YS

I can also see that the customer has multiple subscriptions.

#

The event is from this subscription, cs_live_b1IPZdc6NfkskSBa3prjBQMMe2rN4Mw1B1PmORRUqWBnM4nS3vEhUvGbxS which was created in 2025-06-06 so that happened before the update to pm_1RfhLDB8wovMzpKJIk0gR9YS

#

Since the default payment method is set on the subscription already, if you want to charge the newest payment method, you'd need to update the subscription with the new pm_

vague swan
#

Okay so since when the subscription was created with the default payment method set, it overrides the setting on the customer default payment?

#

When I create a Stripe checkout session then, is there a way to not set that? We use the stripe-ruby gem.

#

Or do you recommend everytime we change the newest payment method, we should query the customer's existing subscription and update the default payment method? We only allow one active subscription at a time (I think it's a Stripe setting we enabled).

dapper sequoia
#

But it is on the end customer to decide

#

You can't force a payment method.

#

When they update the payment method, you can update the subscription right after as you mentioned

vague swan
#

Okay thank you, confirming the problem helps a lot.

I have another maybe similar question. For failed payments, if there's multiple payment methods associated to a customer, it still charges the same card over again until the maximum attempts correct? It doesn't try to charge another card that is associated to the customer.

dapper sequoia
#

That is correct

#

You need to explicitely update the payment method attached to the subscription in this case

vague swan
#

Thank you, appreciate the quick response

#

Think that is all the questions I can provide for now