laravel / cashier-paddle

Cashier Paddle provides an expressive, fluent interface to Paddle's subscription billing services.

Home Page:https://laravel.com/docs/cashier-paddle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

ricardov03 opened this issue · comments

  • Cashier Paddle Version: 1.8.1
  • Laravel Version: 9.50.2
  • PHP Version: 8.1.14
  • Database Driver & Version: MySQL 8.0.32

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

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

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.

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.

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?

Correct