#jesse677_api

1 messages ยท Page 1 of 1 (latest)

gaunt baneBOT
#

๐Ÿ‘‹ 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/1270011561209233542

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

lofty inlet
#

When I tried getting the customer via customers.retrieve, I wasn't able to access the user subscriptions in the customer object

odd agateBOT
dusky moat
#

Hi ๐Ÿ‘‹ checking to see if this is possible with our object structures, but if so you'll use our expand functionality for that. You can start to read about it here while I look at the object structures real quick:
https://docs.stripe.com/api/expanding_objects

#

Do you know if you're storing the default payment method to be used for the Subscription on the Subscription object? Or are you using the Customer-level default payment method for those?

lofty inlet
#

in the subscription, I'm storing the pm_123, but not the actual card

dusky moat
#

If so, you can retrieve the Subscription object and use expand to expand the default_payment_method field inline in the response.

#

Then you'll be able to step into the default_payment_method field and find the full Payment Method object rather than just the ID. But let me know if that doesn't work for you.

lofty inlet
#

I'll try it now

#

like this?

const subscription = await stripeInstance.subscriptions.retrieve(
    subscriptionID, { expand: ["default_payment_method"] }
);
dusky moat
#

Yup, looks right

lofty inlet
#

oh yeah it works

#

I thought I had tried that before but nvm

#

tysm