From 7b4d8a8f05f7cd534a28a228f7185e8ddcb7e446 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 12 Apr 2024 15:48:56 +0200 Subject: [PATCH] wip: new pricing --- app/Http/Controllers/Webhook/Stripe.php | 8 +- app/Livewire/Subscription/PricingPlans.php | 13 ++ config/sentry.php | 2 +- config/subscription.php | 3 + config/version.php | 2 +- docker-compose.prod.yml | 2 + .../subscription/pricing-plans-old.blade.php | 67 +++++++ .../subscription/pricing-plans.blade.php | 183 +++++++++++------- versions.json | 2 +- 9 files changed, 212 insertions(+), 70 deletions(-) create mode 100644 resources/views/livewire/subscription/pricing-plans-old.blade.php diff --git a/app/Http/Controllers/Webhook/Stripe.php b/app/Http/Controllers/Webhook/Stripe.php index 8cf39e58a..7d6721252 100644 --- a/app/Http/Controllers/Webhook/Stripe.php +++ b/app/Http/Controllers/Webhook/Stripe.php @@ -159,8 +159,12 @@ public function events(Request $request) $feedback = data_get($data, 'cancellation_details.feedback'); $comment = data_get($data, 'cancellation_details.comment'); $lookup_key = data_get($data, 'items.data.0.price.lookup_key'); - if (str($lookup_key)->contains('ultimate')) { - $quantity = data_get($data, 'items.data.0.quantity', 10); + if (str($lookup_key)->contains('ultimate') || str($lookup_key)->contains('dynamic')) { + if (str($lookup_key)->contains('dynamic')) { + $quantity = data_get($data, 'items.data.0.quantity', 2); + } else { + $quantity = data_get($data, 'items.data.0.quantity', 10); + } $team = data_get($subscription, 'team'); $team->update([ 'custom_server_limit' => $quantity, diff --git a/app/Livewire/Subscription/PricingPlans.php b/app/Livewire/Subscription/PricingPlans.php index 3996d70d5..4e4dbadee 100644 --- a/app/Livewire/Subscription/PricingPlans.php +++ b/app/Livewire/Subscription/PricingPlans.php @@ -39,6 +39,12 @@ public function subscribeStripe($type) case 'ultimate-yearly': $priceId = config('subscription.stripe_price_id_ultimate_yearly'); break; + case 'dynamic-monthly': + $priceId = config('subscription.stripe_price_id_dynamic_monthly'); + break; + case 'dynamic-yearly': + $priceId = config('subscription.stripe_price_id_dynamic_yearly'); + break; default: $priceId = config('subscription.stripe_price_id_basic_monthly'); break; @@ -72,6 +78,13 @@ public function subscribeStripe($type) ]; $payload['line_items'][0]['quantity'] = 10; } + if (str($type)->contains('dynamic')) { + $payload['line_items'][0]['adjustable_quantity'] = [ + 'enabled' => true, + 'minimum' => 2, + ]; + $payload['line_items'][0]['quantity'] = 2; + } if (!data_get($team, 'subscription.stripe_trial_already_ended')) { if (config('constants.limits.trial_period') > 0) { diff --git a/config/sentry.php b/config/sentry.php index ac9f8c626..e0a923f0b 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -7,7 +7,7 @@ // The release version of your application // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) - 'release' => '4.0.0-beta.256', + 'release' => '4.0.0-beta.257', // When left empty or `null` the Laravel environment will be used 'environment' => config('app.env'), diff --git a/config/subscription.php b/config/subscription.php index 96a9a8e1c..f8bf77ce0 100644 --- a/config/subscription.php +++ b/config/subscription.php @@ -20,6 +20,9 @@ 'stripe_price_id_ultimate_monthly_old' => env('STRIPE_PRICE_ID_ULTIMATE_MONTHLY_OLD', null), 'stripe_price_id_ultimate_yearly_old' => env('STRIPE_PRICE_ID_ULTIMATE_YEARLY_OLD', null), + 'stripe_price_id_dynamic_monthly' => env('STRIPE_PRICE_ID_DYNAMIC_MONTHLY', null), + 'stripe_price_id_dynamic_yearly' => env('STRIPE_PRICE_ID_DYNAMIC_YEARLY', null), + // Paddle 'paddle_vendor_id' => env('PADDLE_VENDOR_ID', null), 'paddle_vendor_auth_code' => env('PADDLE_VENDOR_AUTH_CODE', null), diff --git a/config/version.php b/config/version.php index f9a441c01..f395ea35c 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ + @if (config('subscription.provider') === 'stripe') + + + {{ $isTrial ? 'Start Trial' : 'Subscribe' }} + + + + {{ $isTrial ? 'Start Trial' : 'Subscribe' }} + + + + + {{ $isTrial ? 'Start Trial' : 'Subscribe' }} + + + {{ $isTrial ? 'Start Trial' : 'Subscribe' }} + + + + + {{ $isTrial ? 'Start Trial' : 'Subscribe' }} + + + {{ $isTrial ? 'Start Trial' : 'Subscribe' }} + + + @endif + @if (config('subscription.provider') === 'paddle') + + @endif + @if (config('subscription.provider') === 'lemon') + + Subscribe + + + Subscribe + + + + Subscribe + + + Subscribe + + + + Subscribe + + + Subscribe + + + @endif + diff --git a/resources/views/livewire/subscription/pricing-plans.blade.php b/resources/views/livewire/subscription/pricing-plans.blade.php index e4a3cc762..e1a9dbfbf 100644 --- a/resources/views/livewire/subscription/pricing-plans.blade.php +++ b/resources/views/livewire/subscription/pricing-plans.blade.php @@ -1,67 +1,120 @@ - - @if (config('subscription.provider') === 'stripe') - - - {{ $isTrial ? 'Start Trial' : 'Subscribe' }} - +
+
+
+
+ Payment frequency + + +
+
+
+
Save 10% annually with the yearly plans. +
+
+
+
+
+
+
+
For the detailed list of features, please visit our landing page: coolify.io
+
+
+

Dynamic

+

+ + $5 + for the first 2 servers + - - {{ $isTrial ? 'Start Trial' : 'Subscribe' }} - - - - - {{ $isTrial ? 'Start Trial' : 'Subscribe' }} - + + $4 + /month + VAT + +

+

+ + $3 + for any additional + - {{ $isTrial ? 'Start Trial' : 'Subscribe' }} - - - - - {{ $isTrial ? 'Start Trial' : 'Subscribe' }} - - - {{ $isTrial ? 'Start Trial' : 'Subscribe' }} - - - @endif - @if (config('subscription.provider') === 'paddle') - - @endif - @if (config('subscription.provider') === 'lemon') - - Subscribe - - - Subscribe - - - - Subscribe - - - Subscribe - - - - Subscribe - - - Subscribe - - - @endif - + + $4 + /month + VAT + +

+ + billed monthly (+VAT) + + + billed annually + + + {{ $isTrial ? 'Start Trial' : 'Subscribe' }} + + + {{ $isTrial ? 'Start Trial' : 'Subscribe' }} + +

Begin hosting your own services in the + cloud. +

+
    +
  • + + Connect 2 servers +
  • +
  • + + Included Email System +
  • +
  • + + Email Support +
  • +
  • + + + + + + + + All upcoming features +
  • +
+
+
+
+
+
diff --git a/versions.json b/versions.json index 9bd13a9bf..ccb225d96 100644 --- a/versions.json +++ b/versions.json @@ -1,7 +1,7 @@ { "coolify": { "v4": { - "version": "4.0.0-beta.256" + "version": "4.0.0-beta.257" } } }