#sai-rez_best-practices

1 messages ¡ Page 1 of 1 (latest)

ebon solarBOT
#

👋 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/1215617746809786419

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

thin hamletBOT
open oak
#

hi! well the way the PaymentMethod API is designed is you can always view old Source objects through it.

snow geyser
#

So if we have code that looks like this customer.sources.data[0].card and we wanted to refactor, would we need to make a request to get the payment method object for that user and get their card value?

open oak
#

otherwise, the value of customer.sources.data[0].card will be like card_xxx and you can pass that to https://docs.stripe.com/api/payment_methods/customer yes and what you get is an object that is shaped like a PaymentMethod and works just like one but the underlying data is from the card_xxx (as the docs above described). (but note that e.g. customer.sources doesn't exist on current API versions which is why I'm saying you would use PaymentMethod.list instead)

snow geyser
#

Ok so I completely understand, if a historic user was created with the Sources API and I make PaymentMethod.list request using their customer id, that would also get the same information as what customer.sources.data[0] would get you?

open oak
#

yes

#

easy enough to test

snow geyser
#

Awesome I will take a look at everything you mentioned, thanks for your help!