#b33f_paymentmethod-retrieve
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/1225714373419335680
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- b33fb0n3_api, 23 hours ago, 11 messages
@spiral token hello! I don't really get what you mean "get the payment method data"
If you have the PaymentMethod id you can use https://docs.stripe.com/api/payment_methods/retrieve which only requires that pm_123
You can ignore the description, it's confusingly worded but it works
if I take a look at my customer object I see the defaultPaymentMethod: (see attachement), but I can't see the data to it like which brand, which type, which last4, ...
Okay but in that case you already have the Customer id so the API method you were looking at that needs the pm_123 and the cus_123 works for you I think
Are you asking about retrieving all the details while retrieving a Customer?
b33f_paymentmethod-retrieve
For me I looking for this:
Input: cus_12345...
Output:
Default Paymentmethod:
brand: "visa",
last4: "4242",
...
And if there is no default paymentmethod, then null or {} or whatever
Ah that last bit is what was missing
What you want in that case is our Expand feature documented here: https://stripe.com/docs/expand
It lets you retrieve a given API resource/object and also get related objects at the same time. So for example you retrieve the Customer itself and instead of seeing that default_payment_method: 'pm_123' you can get the full PaymentMethod object at the same time.
I recommend watching https://www.youtube.com/watch?v=m8Vj_CEWyQc which someone on my team published to explain the concept in details
it seems like the default_payment_method property is unexpandable đ¤
Can I somewhere see what kind of options I am allowed to pass in?
https://docs.stripe.com/api/customers/object#customer_object-invoice_settings-default_payment_method shows that it's expandable
you have to pass the full path of the property so invoice_settings.default_payment_method
Ah that worked, thanks! â¤ď¸