#robertpartfy
1 messages ยท Page 1 of 1 (latest)
Hi ๐ you can apply the Coupon to the Subscription, but if the Invoice is finalized then it will not inherit the change.
i'll explain a little further so you can get more context ๐
let's suppose the user is redirected to the payment form in order to activate their subscription. the subscription gets created when the user accesses this form, and therefore it's already created (just after the subscription was created, an unpaid but finalised invoice was created). the user leaves the form, but the subscription is not deleted. the user come backs to the form and wants to apply a coupon. how can i do that?
Sounds like you'd create a new Subscription for that.
i see, so i would need to cancel the older subscription and create a new one, wouldn't i?
and apply the coupon when creating the new one, of course
That depends on how you're creating the Subscription. If you're setting payment_behavior to default_incomplete, then Subscriptions in an incomplete state will automatically be canceled after 23 hours without successful payment.
https://stripe.com/docs/api/subscriptions/create#create_subscription-payment_behavior
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ok, i'm already setting payment_behavior to default_incomplete. that would mean i don't need to manually cancel the subscription, right?
Correct, they'll automatically clean up after about a day of not being paid for.
right, i see.
would you recommend creating the subscription as soon as the user clicks the payment form's button rather than creating the subscription when the user accesses the payment form?
so the dashboard doesn't get cluttered with canceled subscriptions
That's largely up to you and how your flow is currently built. If you're using our Payment Element, then you'll need a client secret in order to load the Payment Element, so you'll need to create the Subscription ahead of time.
aha, i see!
thanks for your help @remote carbon , i don't have any more questions ๐ have a nice day
Awesome, glad I could help! Hope you have a great day!