#ziwen_subscription-discounts

1 messages ยท Page 1 of 1 (latest)

warm copperBOT
#

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

cobalt pelicanBOT
fair mantle
#

Hi, I want to provide more context that I created the coupon on the stripe dashboard, but am querying through the API.

prime latch
#

Hi there!

fair mantle
#

๐Ÿ‘‹

prime latch
#

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

fair mantle
#

Ixdz9dD7

#

6Akuo57B

#

i8lVst3o

#

any of these

prime latch
#

Actually, could you share a Product ID?

fair mantle
#

prod_MNjJ6S43Km8rc3

#

prod_OYISrO1SqidLWH

prime latch
#

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?

fair mantle
#

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
}```
prime latch
#

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

fair mantle
#

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)

prime latch
#

Hm, I don't think this was a recent change

fair mantle
#

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

prime latch
fair mantle
#

ohhhh wow I see

cobalt pelicanBOT
fair mantle
#

thanks for the help!