Closed merchalex closed 1 year ago
Hi there. I think you misunderstand the status of "canceled" here. "canceled" in lemon squeezy and in this package does not mean the subscription is inactive. It means the customer is on its grace period. When that grace period ends it'll transition the subscription to "expired" which means it's inactive. The ->subscribed()
check will still return true
when the subscription is canceled
.
Yes, I apologize, I was misunderstanding. I reviewed the code but obviously I missed some important things that would have told me this, so sorry. I did not know the status would change to expired. Thank you very much for clarifying. And thank you for this repo, it is very, very helpful for me to not have to use Paddle :). And thank you for the fast reply as well.
Cheers
Pardon my asking here, but I did not want to create an issue for this as I am not sure that this is not my mistake. I have use the routes properly thus far to create a new subscription and the webhooks/api communicate properly for this. But I am trying to add a link to update payment url, and I have tried to this via link and the button to trigger the modal popup, and both messages receive an error for this function. Can you tell me if there is something I am doing wrong for this?
Route::get('/update-payment', function (Request $request) {
$subscription = $request->user()->subscription();
return view('theme::pricing', [
'paymentMethodUrl' => $subscription->updatePaymentMethodUrl(),
]);
});
<a href="/update-payment">update</a>
I also get a similar error whenever I add the script for modal edit window. I just cannot figure out if I am making a mistake elsewhere, but I have spent 6 hours trying to solve this 1 button problem, so I thought maybe I should ask you, if it's okay.
I am using @lemonJS
in my head area, as well as the following code:
<script src="https://app.lemonsqueezy.com/js/lemon.js" defer></script>
<script defer>
function updatePM() {
LemonSqueezy.Url.Open('{!! $paymentMethodUrl !!}');
}
</script>
thank you for your time
You're calling the relation instead of the model: $subscription = $request->user()->subscription();
Try $subscription = $request->user()->subscription;
I noticed that the cancel subscription webhook immediately marks the user as canceled in the db, but in the Lemon Squeezy subscription settings for each user, when cancel a subscription, there is a note that says the user will actually be set to inactive at the end of the billing cycle (as is default behavior ok 98% of subscription services). Even though Lemon Squeezy does not mark a user inactive until the end of the billing cycle, it still sends the canceled webhook immediately, which now creates a situation where the user is now inactive in the database but active on the Lemon Squeezy website. You will see below that I canceled the user today (14 July 2023) but it will not expire for 1 month.
I think by default the canceled webhook should mark the user as canceled at the end of the billing cycle, so that the user's status matches everywhere.
Just my opinion (and hopefully i'm not missing something that makes incorrect about the current configuration).
Thanks!