#Mr.Medi
1 messages ยท Page 1 of 1 (latest)
Hi there!
That's completely up to you. It's your code that controls what users have access to.
But I guess if the status is cancel you should probably not give users access to your content.
But I dont finish to understand it. I mean...
If a user paid the content, then cancel the suscription, the user may have access to it until the period paid ends
Thats how I undertand it, am I wrong? Im a bit confused with that
It depends. Did user cancel the subscription immediately (so the status is canceled), or did the user cancel the subscription at the end of the billing period (so the status is active for now and will become canceled when it renews).
Yes, I implemented in the frontend a button so users can cancel their suscription and do it inmediatelly. But what canceled exactly means?
From my view, it means that the next payment is canceled
But what canceled exactly means?
Again, that depends. How do you cancel the subscription exactly? Which API endpoint do you use?
I do this in laravel $subscription->cancel(); let me check the endpoint
If you use https://stripe.com/docs/api/subscriptions/cancel, then it cancel the subscriptions immediately, and the time that the customer didn't use will be credited back to the user in the customer credit balance https://stripe.com/docs/billing/customer/balance
If you use https://stripe.com/docs/api/subscriptions/update with cancel_at_period_end, then the subscription stays active and will cancel at the end of the billing period.
Then as explained above it cancels the subscription immediately. If you want to cancel the subscription at the end of the billing period, use the other option I mentionned above.
how it should be canceled using the second method? $subscription->cancel(['cancel_at_period_end' => true]);
that does not work as expected
No, please check the link I shared
You update the subscription and pass cancel_at_period_end: true
yes, i see. but can it be done using the suscripction object, not all the suscriptions
like this: $subscription->update('cancel_at_period_end' => true);
I got it
But the status is still active in my db
But the status is still active in my db
Exactly! The status stays active, until the current billing period ends and it will becomecancel. That's the whole point of this.
So again this is completely up to you:
- Do you want to cancel the subscription imeddiately? Then use https://stripe.com/docs/api/subscriptions/cancel
- Do you want ot cancel the subscription at the end of the period? Then use
cancel_at_period_end: true
Happy to help ๐
is there any way to know if the suscription is in cancel_at_period_end?
I will like to show in the frontend that is already canceled the next payment
Sure, check the cancel_at_period_end property of the subscription: https://stripe.com/docs/api/subscriptions/object?lang=php#subscription_object-cancel_at_period_end
Perfect! I got it. Thank you for the help
Perfect ๐