laravel / cashier-paddle

Cashier Paddle provides an expressive, fluent interface to Paddle's subscription billing services.
https://laravel.com/docs/cashier-paddle
MIT License
238 stars 57 forks source link

The swap method don't support rename the subscription on the subscriptions table. #181

Closed ricardov03 closed 1 year ago

ricardov03 commented 1 year ago

Description:

I'm using Cashier Paddle with the default Billable different from the User model. I'm using the swap method from the Subscription model from the Cashier Paddle package. After changing the subscription, the subscription name maintains the same name on the subscriptions table on the database. I was trying to figure out if there is any method to set the name on the process, but I didn't find any. Can anybody help me with this? I appreciate any help you can give me.

Steps To Reproduce:

...
$subscription = auth()?->user()?->tenant?->subscriptions->sortByDesc('id')?->first();
$subscription->swap($request->newPlan);
driesvints commented 1 year ago

The subscription name is never meant to change. It’s your identifier for the type of subscription, not a human readable name.

ricardov03 commented 1 year ago

First, Dries, thanks for taking the time to answer my question. Your answer sent me to another question because it looks like I don't get the real purpose of the subscription name as you defined on the package. For example, if I have two subscriptions, let's say base and premium, If a user subscribes to the base one for the first time, I will use base as the name of the subscription. But, If the user swap from the base to the premium, it's not premium the name of the new subscription?

Please help me to understand If I'm seeing the use of the name property right or not. Thank you so much for your attention and help.

driesvints commented 1 year ago

Sure no problem. Base and premium are plan names in your case and not a subscription type. You just swap the subscription to a different plan if you want to change them. A subscription type is for a particular service. Think of it like a gym subscription and a tennis subscription. Both are different types but can have base and premium plans.

ricardov03 commented 1 year ago

Thank you so much for taking the time to explain how it works. So, in this case, the only relation we have with the Plan is the paddle_id?

driesvints commented 1 year ago

Correct