#.abishek

1 messages · Page 1 of 1 (latest)

shadow mirageBOT
#

Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

merry oracle
#

For your second question, not sure what you mean by "expiry date". Can you provide more specific details?

hazy glen
#

expiry date - when the subscription actually terminates. I am sending an email to the customer that the subscription is cancelled and will terminate on x date. so just trying to figure out where I can get that date. Stripe allows the option to terminate the subscription immediately or at the end of the term.

merry oracle
#

If you set the Subscription to cancel at the end of the period it would be the same property as above, current_period_end.

#

If you cancel it immediately then you know exactly when it was canceled.

hazy glen
#

ok, the reason I ask is, we let our customers use the Customer Portal, so it would help if I know what is the expiry date for my second question

merry oracle
#

Sorry, not sure I fully understand. Can you describe an example scenario?

hazy glen
#

so, our app allows the customer to use the Customer Portal to cancel their subscriptions

#

I think the Customer Portal has the option to cancel immediately or at the end of the term. Correct

hazy glen
#

yes, so if someone clicks "Cancel Immediately", I want to know when the subscription will actually expires. Will canceled_at be the one to look at?

#

we receive a webhook trigger for customer.subscription.canceled, so I need to figure if the subscription is being canceled at the end of the term or immediately.

merry oracle
#

The customer.subscription.canceled won't fire until the Subscription is actually canceled.

#

You'll get customer.subscription.updated if the Subscription is updated to cancel at the end of the current period.

#

If the Subscription is canceled immediately you'll get customer.subscription.canceled immediately though.

#

Likewise, canceled_at won't be populated until the Subscirption is canceled.

hazy glen
#

ah, ok, i was not aware of that

#

so, what should I look for when on the customer.subscription.updated to know that the user has cancelled the plan and will completely cancel by the end of the term

#

since you mentioned cancel_at will only be applied when the subscription is cancelled. So that will not be set on the customer.subscription.updated webhook event

merry oracle
#

So if that's set to true the Subscription will cancel at current_period_end.

hazy glen
#

ok, that makes sense. glad you clarified it. thank you very much

merry oracle
#

So you might want to check that too.

hazy glen
#

ok, thank you very much for that. appreciate it

merry oracle
#

Happy to help!

hazy glen
#
// customer.subscription.updated webhook check
if(subscription.cancel_at_period_end === true && subscription.cancel_at >= now()) {
   // send email for future date subscription cancel
}

is that correct?

#

just clarifying if I am on the same page

merry oracle
#

I can't provide code reviews here, but I will say that it's more likely cancel_at will be null instead of a timestamp.

#

I recommend you test in test mode to make sure it works the way you expect.

hazy glen
#

ok, sounds good. thank you

merry oracle
hazy glen
#

👍

#

can a cancelled plan be resubscribed? or do I have to create a new subscription for this?

merry oracle
#

You would need to create a new Subscription.

hazy glen
#

what about stopping the cancellation if end of term is selected

merry oracle
#

You can set cancel_at_period_end to false.

hazy glen
#

ok

#

does the same happen on the customer portal as well

merry oracle
#

Sorry, I can't explain how every aspect of Stripe works. Best way to find out is to try this all out in test mode.

#

If you run into issues in test mode we can help unblock you.

hazy glen
#

ok