Allow user to finish the month after canceling?
I've searched but I cannot find a way to do this. If someone pays for a month and then cancels, they should be able to finish the month that they have paid for, instead of seeing
Note: Your account will be immediately downgraded.
I feel like I remember hearing this mentioned in a video but I cannot find it. If there is a way to do this, please let me know. Thank you.
Hi there,
Indeed this is not yet supported by Wave, but should be achievable with a few changes:
- Add a new column to the
paddle_subscriptions
table calledcancellation_effective_date
- Update the SubscriptionController and mainly the
cancelSubscription
method and add an update statement to get thecancellation_effective_date
value from the payload from the Paddle webhook. The payload will look like this:
Array
(
[alert_id] => 1282370466
[alert_name] => subscription_cancelled
[cancellation_effective_date] => 2023-04-10
[checkout_id] => 9-d11a2ef3289d6c8-ccdeb4a3ad
[currency] => EUR
[custom_data] => custom_data
[email] => [email protected]
[event_time] => 2023-04-05 20:13:54
[linked_subscriptions] => 7, 2, 7
[marketing_consent] => 1
[passthrough] => Example String
[quantity] => 18
[status] => deleted
[subscription_id] => 6
[subscription_plan_id] => 8
[unit_price] => unit_price
[user_id] => 1
]
-
Also update the
cancelSubscription
method to not change the user role. -
Then create a corn job that will get all users where the
cancellation_effective_date
date is due and are still pro users and run this every night: https://laravel.com/docs/10.x/scheduling
Let me know if you have any questions!
Best,
Bobby
Thank you so much Bobby, I appreciate you being so helpful. I added the column and I believe I properly added the right thing to call for that data in the array, but I'm not sure if there is anything else I need to add to get this data from the webhook.
If I prevent the cancel button from changing the users role, this role will automatically change upon subscription expiring? Or do I need to do anything to trigger this?
Sorry, I am still very new to PHP so some things are not obvious for the stuff I need to add. Please let me know if I'm missing anything for the SubscriptionController file or this one like that I showed in the screenshot is all I need to add to get that data from the webhook. I just wasn't sure if I need anything else added to tell Wave to actually input this new cancellation date data into the db, or if there is already code that will accomplish this without me adding anything.
Thank you again, sorry for the all the long winded questions!
Hi there,
No problem at all! Let me know how it is going so far!
If I prevent the cancel button from changing the users role, this role will automatically change upon subscription expiring? Or do I need to do anything to trigger this?
Here you will need to actually handle this on your end, you can create a scheduled task that runs every day for example and changes the roles of the users that have the expiry date in the past.
The subscription controller
In the subscription controller, you would also need to disable the role change for the subscription cancellation method here. That way the user will not be downgraded to a free account.
I just wasn't sure if I need anything else added to tell Wave to actually input this new cancellation date data into the db, or if there is already code that will accomplish this without me adding anything.
This is not indeed supports by Wave out of the box at the moment, it will need to be configured additionally.
Let me know if anything else pops up!
I might try and write a more detailed tutorial on how to do this in the next couple of weeks!
Best,
Bobby
Thank you so much.
I cannot figure out what I am doing wrong, I have very little experience with having data sent to the db so I just don't know
I have tried
$subscription->cancellation_effective_date = $request->cancellation_effective_date;
and
$subscription->cancellation_effective_date = $cancellation_effective_date;
but neither of these are working, and I cannot figure out what else to try. I'm just getting Undefined variable $request and Undefined variable $cancellation_effective_date
Any suggestions?