#manuel_api

1 messages ยท Page 1 of 1 (latest)

dusky knotBOT
#

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

๐Ÿ“ 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.

gilded prism
#

this is the customer and the subscriptio IDs: cus_T4WTkf6qud7Xgw - sub_1SAXU3ESRxUGxqvhD3fvG3Mm

white shadow
#

hi there, when using the List Subscriptions API, it'll return a list of subscriptions under the data attribute in the response. so you'll want to expand on data.discounts instead

gilded prism
#

ok, I understand and how can I find out which items the coupon applies to?

#

because I am "reactivating" (just creating another one) my customers' canceled subscriptions, and if they have a coupon for that subscription, I need to reapply it. Is that possible?

white shadow
#

so you can try expanding on data.discounts.coupon.applies_to

gilded prism
#

yeah but im getting the di_abc123... object id and i cant fetch the data with that id

white shadow
#

right, that's expected. The Discount object represents the application of a coupon to a subscription, so you can't retrieve them individually. if you wanted to do that with a separate API request, you would use the Retrieve a Coupon API https://docs.stripe.com/api/coupons/retrieve

gilded prism
#

but how can I get the ID of a coupon if it doesn't give me the answer and only gives me a completely different ID that I can't retrieve?

#

do you understand?

#

i need to get the discount, yes but the discount key at the moment to list the subscription just give me an ID that i cant fetch...

white shadow
#

if you expand with data.discounts.coupon on the List Subscriptions API request, that should get you the coupon data you need

gilded prism
#

i just got this:

#

nothing else

white shadow
#

can you share with me the request ID of that attempt you just made?

gilded prism
#

ok, give me a sec

#

i cant find the ID of the request but im doing this in my console:

stripe.Subscription.list(customer=cus_T4WTkf6qud7Xgw, status='all', limit=1)

white shadow
#

that command doesn't have the expand parameter

gilded prism
#

yeah i know

#

im listing all the subscription because i cant get the canceled ones

#

so im using the status parameter with all or canceled

#

but i prefer using all

white shadow
#

if you do this, does it get the result you want?
stripe.Subscription.list(customer=customer.stripe_id, status='all', limit=1, expand=['data.discounts.coupon'])

gilded prism
#

ok nice im getting all the data that i need

#

thank you!!

white shadow
#

you're welcome, glad that worked!

gilded prism
#

that's all thank you again

dusky knotBOT
gilded prism
#

also can i get the price ID of the applies_to key? or just only the product ID?

elder hare
#

applies_to is only on the product IDs

#

Price ID information will not be available

gilded prism
#

ok ok, thank you