#Vatsal
1 messages ยท Page 1 of 1 (latest)
Hi there, all Stripe timestamps are in UTC.
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
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
First I need to know what do you mean by an expired subscription???
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
for that I want to compare that date
๐ Taking over this thread
please guide
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
user can manually cancel their subscription
how can i check if auto-renewal is enable or disabled for a particular user ?
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
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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
if cancel_at_period_end is set, the subscription will be cancelled at the end of the current cycle
okay understood. thank you for the help