#b33f_paymentmethod-retrieve

1 messages ¡ Page 1 of 1 (latest)

tiny lilyBOT
#

👋 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.

acoustic waspBOT
#

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.

flint path
#

@spiral token hello! I don't really get what you mean "get the payment method data"

#

You can ignore the description, it's confusingly worded but it works

spiral token
flint path
#

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

spiral token
#

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

flint path
#

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

spiral token
#

it seems like the default_payment_method property is unexpandable 🤔

#

Can I somewhere see what kind of options I am allowed to pass in?

flint path
#

you have to pass the full path of the property so invoice_settings.default_payment_method

spiral token
#

Ah that worked, thanks! ❤️