No discount returned when creating a subscription with a one time coupon

75 views
Skip to first unread message

Lionel Debauge

unread,
Jun 17, 2021, 12:46:22 PM6/17/21
to Stripe API Discussion, Alexandra de la Guéronnière, Yohan Piron
Hi Remi,

We have found the following behavior: when you create a subscription with a one time coupon applied it returns a subscription without a discount.

Example: 

We believe that it is due to the fact that the coupon is applied immediately to an invoice and then destroyed by your systems. However I would expect a discount to be still returned as it is created at subscription creation. 

My question is therefore: is it a behavior by design that I can rely on or should a discount be returned at subscription creation as I expected ?

Thanks in advance for all the help you can give us.

Best regards,

Lionel

Remi J.

unread,
Jun 17, 2021, 12:56:10 PM6/17/21
to Stripe API Discussion, Alexandra de la Guéronnière, Yohan Piron
Hello Lionel,

Your intuition here about why `discount` is null in the response is correct. The response we send you back is not just "what was created" per se and more the state of the subscription at the end of the request, representing what you'd record in your database. Since the coupon is one-time use, it is applied to the subscription's first invoice and immediately "consumed" and removed so it's not returned back. Similarly, the customer can have a coupon that is one-time use applied as a discount that would apply to the first invoice and the subscription would have `discount: null` too.

What you should consider here is to use the Expand feature [1] when creating the Subscription. This will let you get details about the latest invoice by retrieving whole Invoice object back and seeing the discount(s) applied to that Invoice. The one-time discount would be reflected back on the Invoice in that case.

I hope this helps!
Best,
Remi


--
To unsubscribe from this group and stop receiving emails from it, send an email to api-discuss...@lists.stripe.com.

Lionel Debauge

unread,
Jun 18, 2021, 11:35:32 AM6/18/21
to api-d...@lists.stripe.com, Alexandra de la Guéronnière, Yohan Piron
Hello Remi,

Using the expand feature during subscription creation is a great idea ! We ended up listening to the webhook event "invoice.created" to retrieve the discount information which is less straightforward. 

I'll discuss your suggestion with the team and decide if we adapt the code.

Thanks a lot for your help. It is highly appreciated !

Best regards,

Lionel

To unsubscribe from this topic, visit https://groups.google.com/a/lists.stripe.com/d/topic/api-discuss/c3GW4OVymgg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to api-discuss...@lists.stripe.com.


--

Lionel Debauge

Web developer

livecolonies.com | LinkedIn | Jobs

Reply all
Reply to author
Forward
0 new messages