#CC-hh-canceled-subscription

1 messages · Page 1 of 1 (latest)

tame veldtBOT
rapid wedge
cosmic hemlock
#

It's been fully cancelled. How can we automatically create the new subscription when the payment goes through? Currently we have to do this manually and we'd like to fix this

rapid wedge
#

How are you currently creating new subscriptions?

cosmic hemlock
#

No

#

The old subscription is in the cancelled state, but when the user updates their CC info the invoice for the cancelled subscription gets paid.

#

See on line 4 of the events, the subscription gets cancelled

#

But when the user updates their CC info, the payment goes through

#

Can we make the subscription automatically get recreated on stripe when the payment goes through?

rapid wedge
#

No, though it will likely depend on how Subscriptions are being created. Are you creating them via the dashboard? Stripe Checkout? Custom payment form?

cosmic hemlock
#

We're creating the subscription via a custom payment form on the frontend which sends a post request to our server that talks to Stripe and creates the subscription

#

But the invoice gets updated through Origin https://js.stripe.com/ so it's probably bypassing our process of making the new subscriptions. Is that possibly an email that the user is getting to update their payment directly through stripe?

rapid wedge
#

In that case, you would simply listen for invoice.payment.succeeded and perform a check on that customer's Subscription to see if status=canceled and then create the new subscription the same way you created the others (except with the existing Customer and Payment Method)

rapid wedge
cosmic hemlock
#

simply listen for invoice.payment.succeeded

So, I'd need a webhook to our backend to listen for invoice.payment.succeeded?

rapid wedge
#

Correct

cosmic hemlock
#

Can we do some sort of automatic duplication of the old cancelled subscription on the stripe side and just listen for some sort of subscription creation event?

steep sequoia
#

Hi 👋 @rapid wedge had to go so I'm stepping in. No we don't have a mechanism to duplicate the subscription. Your code would need to do this using the properties of the old, canceled subscription to create the new Subscription.