I need help to understand some logic- not a bug
Closed this issue · 2 comments
Lemon Squeezy for Laravel Version
1.6
Laravel Version
11.9
PHP Version
8.3
Description
I will try to explain it in most accurate way. We building subscription. I need help to understand how can I do it, not really just technical wise. I can't understand LemonSqeeuze API and not able to find a proper way to start with.
This is not just typical subscription, where I select one or another plan, and then subscribe to it, downgrade or upgrade, cancel, etc....
Please, advise, what I should be using to accommodate requests by client? Obviously I cant just use regular subscription with custom checkout as bellow.
We have different packages. Therefore, price of package vary. Basic packages are FREE, SAVVY, PRIME, ELITE
So, here, each of those plans, have some similar benefits to user. Everything is about posting agricultural ads.
So, for example, user on FREE plan, can upload 1 ad for free, in one country. user on SAVVY plan, may have some more benefits, like team posting on Facebook ads, some google adding, and 5 ads per month. etc.. You know it.
Now, where I am facing a problem is:
- client want user to be able to upgrade plan, but not in the way I would expect, for example - from SAVVY to ELITE (well that too can be upgraded)
- plan can be upgraded by adding ADDITIONAL COUNTRIES to post ad to. So, user selected FREE plan, and he got ONE country to post his Ad. He now, should be able to upgrade FREE plan by adding more countries to it, which we will then subscribe him to. Now, he is still on free plan, but he pays for number of additional countries he wants to be able to post to.
- above, I achieved by creating custom checkout, and it works.
It looks something like this:
return auth()->user()->subscribe(
$request->get('code'),
'default',
['custom_price' => $customPrice]
)
->withName($request->get('name'))
->withEmail($request->get('email'))
->withBillingAddress($request->get('country_code'), $request->get('zip')) // Country & Zip Code
->withTaxNumber('123456679')
->withDescription('You have subscribed to ' . $package['name'] . ' with ' . $request->get('number_of_countries') . ' additional countries')
->redirectTo(url('/billing'));
Main problem here is, what if user wants to cancel only those Additional countries? How to handle it? I know about pricing_object, where I am supposed to send a variant_id with new price, but this kind of not work? I cant find API how to use that, and not in our library here for laravel.
What I think is that I dont have enough knowledge on how I can achieve that, not knowledge in coding, but lack of experience with custom subscriptions. I would be happy to pay your time to help me understand some general things.
In LemonSqueeze, opened a Store and added a product. When user go to checkout a few things there blowing my brain:
Steps To Reproduce
There s noting to reproduce :)
Hi @nezaboravi. I'm very sorry but I'm afraid this is a bit too much to wrap my head around at this time. I'm limited on time these days and digging into the specifics of your use case is something I can't bring up right now. It's best that you either contact Lemon Squeezy about your questions so they can help navigate you to the proper api calls or ways to setup LS for your use case or try a forum or other support channel. I'm only able to offer help specifically with this library or help fix bugs. All the best.
Thanks bud. I ll try something. Lemon Squeeze- they never reply. I tried that first :)