#sai-rez_best-practices
1 messages ¡ Page 1 of 1 (latest)
đ 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.
hi! well the way the PaymentMethod API is designed is you can always view old Source objects through it.
https://stripe.com/docs/payments/payment-methods/transitioning#compatibility
You can retrieve all saved compatible payment instruments through the Payment Methods API.
.. the Payment Methods API provides a different view of the same underlying object
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?
well you would refactor that code by removing it and doing https://docs.stripe.com/api/payment_methods/customer_list instead
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)
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?
Awesome I will take a look at everything you mentioned, thanks for your help!