#Mr.Medi

1 messages ยท Page 1 of 1 (latest)

sullen sierraBOT
upper carbon
#

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.

shy barn
#

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

upper carbon
#

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).

shy barn
#

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

upper carbon
#

But what canceled exactly means?
Again, that depends. How do you cancel the subscription exactly? Which API endpoint do you use?

shy barn
#

I do this in laravel $subscription->cancel(); let me check the endpoint

upper carbon
shy barn
#

DELETE /v1/subscriptions/{id}

#

i use that endpoint

upper carbon
#

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.

shy barn
#

how it should be canceled using the second method? $subscription->cancel(['cancel_at_period_end' => true]);

#

that does not work as expected

upper carbon
#

No, please check the link I shared

#

You update the subscription and pass cancel_at_period_end: true

shy barn
#

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

upper carbon
#

But the status is still active in my db
Exactly! The status stays active, until the current billing period ends and it will become cancel. That's the whole point of this.

#

So again this is completely up to you:

shy barn
#

Oh i see, i though the status will change too

#

I think now it will work. Thank you!

upper carbon
#

Happy to help ๐Ÿ™‚

shy barn
#

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

upper carbon
shy barn
#

Perfect! I got it. Thank you for the help

upper carbon
#

Perfect ๐Ÿ™‚