#ziwen_subscription-discounts
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/1228383227752878180
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi, I want to provide more context that I created the coupon on the stripe dashboard, but am querying through the API.
Hi there!
๐
Do you have the coupon ID to share? applies_to should not be empty if you created a coupon that applies to a specific set of products
Actually, could you share a Product ID?
Thanks! So just to be clear, when you retrieve the Coupon using the API, applies_to isn't returned at all, right? It's not that it's empty, it's just not there?
Correct, it looks like this
id: 'Ixdz9dD7',
object: 'coupon',
amount_off: 5000,
created: 1712099721,
currency: 'usd',
duration: 'forever',
duration_in_months: null,
livemode: false,
max_redemptions: null,
metadata: {},
name: 'Nucleus Premium Test',
percent_off: null,
redeem_by: null,
times_redeemed: 3,
valid: true
}```
Sorry for the delay! Looks like we don't automatically include applies_to when you retrieve a Coupon. When you retrieve it, you'll need to expand applies_to in order to see that array in the response
Ah I see, that works. Thanks!
I have another question: Did stripe recently add a feature to add promo codes directly to invoices? I do not recall seeing this a few months ago.
create invoice has a field discounts that now seems to also take in promotion_code as a parameter (I don't recall seeing this before)
Hm, I don't think this was a recent change
Alright, maybe I just have an outdated version
I have stripe (nodejs) 9.6.7 which is from 2 years ago, which doesn't have the discounts field for subscriptions.create
Ah, I think this was a recent addition to the Node SDK: https://github.com/stripe/stripe-node/releases/tag/v14.24.0
ohhhh wow I see
thanks for the help!