#Vatsal

1 messages ยท Page 1 of 1 (latest)

wheat vesselBOT
broken gate
#

Hi there, all Stripe timestamps are in UTC.

long moss
#

okay

#

can you please tell how can I check if user's subscription is expired or not with that date ?

#

I wrote like this but not working correctly

broken gate
#

There's no expired state for a subscription.

#

Do you mean incomplete_expired ?

long moss
#

current period end date and today's date

#

how to compare them

#

I took UTC time now

#

is this valid ?

#

I am storing CurrentPeriodEnd date of a user's subscription into subExpiryDate

broken gate
#

First I need to know what do you mean by an expired subscription???

long moss
#

user subscribes to a pricing-table's 3 month plan

#

so after 3 month user will be unsubscribed

#

I have stored that into subExpiryDate var

#

so when user does login I check if their subscription is expired or not

wheat vesselBOT
long moss
#

for that I want to compare that date

marble palm
#

๐Ÿ‘‹ Taking over this thread

long moss
#

please guide

marble palm
#

Did you set the cancel_at on the subscription? If you don't, the subscription will not be cancelled and no expiry date can be found

long moss
#

user can manually cancel their subscription

#

how can i check if auto-renewal is enable or disabled for a particular user ?

marble palm
#

Subscription always auto-renewed unless you specify the cancel_at or cancel_at_period_end fields. If the subscription is cancelled, you can check the status='canceled' [0] field of the subscription and the canceled timestamp in canceled_at [1] field

[0] https://stripe.com/docs/api/subscriptions/object#subscription_object-status
[1] https://stripe.com/docs/api/subscriptions/object#subscription_object-canceled_at

long moss
#

cancel_at_period_end = false means user has enabled auto-renewal ?

#

please confirm this

#

okay got it.
cancel_at_period_end = false ==> auto renewal on

#

cancel_at_period_end = true ==> auto renewal off

marble palm
#

if cancel_at_period_end is set, the subscription will be cancelled at the end of the current cycle

long moss
#

okay understood. thank you for the help