#Soba-coupon
1 messages · Page 1 of 1 (latest)
subscription.create is to create a new subscription instead of updating the existing one. To add a coupon to an existing subscription, update subscription API should be used: https://stripe.com/docs/api/subscriptions/update?lang=node
Hi River! Thank you for your quick reply. The thing is I am trying to create a new subscription with the coupon applied to it. Are you saying that I should create the subscription first and then apply the coupon using subscription.update?
@oak flame
I misunderstand your question by updating the coupon to existing subscription
Can you share the error that you saw when trying to apply coupon to new subscription?
Thats the thing, there isn't an error message - the coupon is simply not applied
this is the coupon object that i am using
Can you share the request ID that you tried to apply the coupon to new subscription? Here’s how you can find it: https://support.stripe.com/questions/finding-the-id-for-an-api-request
The discount was applied to its invoice: in_1L3AdPLxAnOEk7ORAnip8rYq
What is the behaviour that you're expecting?
ohhh i see, thats my bad then - I thought that there would be an indication of the application of the discount on the response object of "stripe.subscription.create"
so in order to validate that the coupon was applied, I have to use the latest_invoice field on the response, retrieve the invoice through the Invoice API, and then check the data there?
Yup, you're right. discounts is the field that you can look for: https://stripe.com/docs/api/invoices/object#invoice_object-discounts
adding on, you don't have to make separate API calls, you can expand latest_invoice when creating the subscription : https://stripe.com/docs/api/expanding_objects