add stripe subscription
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
@env('local')
|
||||
<title>Coolify - localhost</title>
|
||||
<link rel="icon" href="{{ asset('favicon-dev.png') }}" type="image/x-icon" />
|
||||
@else
|
||||
@else
|
||||
<title>{{ $title ?? 'Coolify' }}</title>
|
||||
<link rel="icon" href="{{ asset('coolify-transparent.png') }}" type="image/x-icon" />
|
||||
@endenv
|
||||
@@ -26,7 +26,7 @@
|
||||
<body>
|
||||
@livewireScripts
|
||||
<x-toaster-hub />
|
||||
@if (isInstanceAdmin() || is_subscription_in_grace_period())
|
||||
@if (isSubscriptionOnGracePeriod())
|
||||
<div class="fixed top-3 left-4" id="vue">
|
||||
<magic-bar></magic-bar>
|
||||
</div>
|
||||
@@ -68,6 +68,18 @@
|
||||
window.location.reload();
|
||||
}
|
||||
})
|
||||
Livewire.on('info', (message) => {
|
||||
if (message) Toaster.info(message)
|
||||
})
|
||||
Livewire.on('error', (message) => {
|
||||
if (message) Toaster.error(message)
|
||||
})
|
||||
Livewire.on('warning', (message) => {
|
||||
if (message) Toaster.warning(message)
|
||||
})
|
||||
Livewire.on('success', (message) => {
|
||||
if (message) Toaster.success(message)
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
||||
80
resources/views/components/paddle.blade.php
Normal file
80
resources/views/components/paddle.blade.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<x-slot:basic>
|
||||
<x-forms.button x-show="selected === 'monthly'" x-cloak aria-describedby="tier-basic" class="w-full h-10 buyme"
|
||||
x-on:click="subscribe('basic-monthly')"> Subscribe
|
||||
</x-forms.button>
|
||||
|
||||
<x-forms.button x-show="selected === 'yearly'" x-cloak aria-describedby="tier-basic" class="w-full h-10 buyme"
|
||||
x-on:click="subscribe('basic-yearly')"> Subscribe
|
||||
</x-forms.button>
|
||||
</x-slot:basic>
|
||||
<x-slot:pro>
|
||||
<x-forms.button x-show="selected === 'monthly'" x-cloak aria-describedby="tier-pro" class="w-full h-10 buyme"
|
||||
x-on:click="subscribe('pro-monthly')"> Subscribe
|
||||
</x-forms.button>
|
||||
|
||||
<x-forms.button x-show="selected === 'yearly'" x-cloak aria-describedby="tier-pro" class="w-full h-10 buyme"
|
||||
x-on:click="subscribe('pro-yearly')"> Subscribe
|
||||
</x-forms.button>
|
||||
</x-slot:pro>
|
||||
<x-slot:ultimate>
|
||||
<x-forms.button x-show="selected === 'monthly'" x-cloak aria-describedby="tier-ultimate" class="w-full h-10 buyme"
|
||||
x-on:click="subscribe('ultimate-monthly')"> Subscribe
|
||||
</x-forms.button>
|
||||
|
||||
<x-forms.button x-show="selected === 'yearly'" x-cloak aria-describedby="tier-ultimate" class="w-full h-10 buyme"
|
||||
x-on:click="subscribe('ultimate-yearly')"> Subscribe
|
||||
</x-forms.button>
|
||||
</x-slot:ultimate>
|
||||
<x-slot:other>
|
||||
<script src="https://cdn.paddle.com/paddle/v2/paddle.js"></script>
|
||||
<script type="text/javascript">
|
||||
Paddle.Environment.set("{{ is_dev() ? 'sandbox' : 'production' }}");
|
||||
Paddle.Setup({
|
||||
seller: {{ config('subscription.paddle_vendor_id') }},
|
||||
checkout: {
|
||||
settings: {
|
||||
displayMode: "overlay",
|
||||
theme: "light",
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function subscribe(type) {
|
||||
let priceId = null
|
||||
switch (type) {
|
||||
case 'basic-monthly':
|
||||
priceId = "{{ config('subscription.paddle_price_id_basic_monthly') }}"
|
||||
break;
|
||||
case 'basic-yearly':
|
||||
priceId = "{{ config('subscription.paddle_price_id_basic_yearly') }}"
|
||||
break;
|
||||
case 'pro-monthly':
|
||||
priceId = "{{ config('subscription.paddle_price_id_pro_monthly') }}"
|
||||
break;
|
||||
case 'pro-yearly':
|
||||
priceId = "{{ config('subscription.paddle_price_id_pro_yearly') }}"
|
||||
break;
|
||||
case 'ultimate-monthly':
|
||||
priceId = "{{ config('subscription.paddle_price_id_ultimate_monthly') }}"
|
||||
break;
|
||||
case 'ultimate-yearly':
|
||||
priceId = "{{ config('subscription.paddle_price_id_ultimate_yearly') }}"
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Paddle.Checkout.open({
|
||||
customer: {
|
||||
email: '{{ auth()->user()->email }}',
|
||||
},
|
||||
customData: {
|
||||
"team_id": "{{ currentTeam()->id }}",
|
||||
},
|
||||
items: [{
|
||||
priceId,
|
||||
quantity: 1
|
||||
}],
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</x-slot:other>
|
||||
@@ -105,10 +105,9 @@
|
||||
<span>billed annually</span>
|
||||
</span>
|
||||
@if ($showSubscribeButtons)
|
||||
<a x-show="selected === 'monthly'" x-cloak aria-describedby="tier-basic" class="buyme"
|
||||
href="{{ getSubscriptionLink('monthly_basic') }}">Subscribe</a>
|
||||
<a x-show="selected === 'yearly'" x-cloak aria-describedby="tier-basic" class="buyme"
|
||||
href="{{ getSubscriptionLink('yearly_basic') }}">Subscribe</a>
|
||||
@isset($basic)
|
||||
{{ $basic }}
|
||||
@endisset
|
||||
@endif
|
||||
<p class="mt-10 text-sm leading-6 text-white h-[6.5rem]">Start self-hosting in
|
||||
the cloud
|
||||
@@ -168,10 +167,9 @@
|
||||
<span>billed annually</span>
|
||||
</span>
|
||||
@if ($showSubscribeButtons)
|
||||
<a x-show="selected === 'monthly'" x-cloak aria-describedby="tier-pro" class="buyme"
|
||||
href="{{ getSubscriptionLink('monthly_pro') }}">Subscribe</a>
|
||||
<a x-show="selected === 'yearly'" x-cloak aria-describedby="tier-pro" class="buyme"
|
||||
href="{{ getSubscriptionLink('yearly_pro') }}">Subscribe</a>
|
||||
@isset($pro)
|
||||
{{ $pro }}
|
||||
@endisset
|
||||
@endif
|
||||
<p class="h-20 mt-10 text-sm leading-6 text-white">Scale your business or self-hosting environment.
|
||||
</p>
|
||||
@@ -227,10 +225,9 @@
|
||||
<span>billed annually</span>
|
||||
</span>
|
||||
@if ($showSubscribeButtons)
|
||||
<a x-show="selected === 'monthly'" x-cloak aria-describedby="tier-ultimate" class="buyme"
|
||||
href="{{ getSubscriptionLink('monthly_ultimate') }}">Subscribe</a>
|
||||
<a x-show="selected === 'yearly'" x-cloak aria-describedby="tier-ultimate" class="buyme"
|
||||
href="{{ getSubscriptionLink('yearly_ultimate') }}">Subscribe</a>
|
||||
@isset($ultimate)
|
||||
{{ $ultimate }}
|
||||
@endisset
|
||||
@endif
|
||||
<p class="h-20 mt-10 text-sm leading-6 text-white">Deploy complex infrastuctures and
|
||||
manage them easily in one place.</p>
|
||||
@@ -274,3 +271,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@isset($other)
|
||||
{{ $other }}
|
||||
@endisset
|
||||
|
||||
0
resources/views/components/stripe.blade.php
Normal file
0
resources/views/components/stripe.blade.php
Normal file
@@ -0,0 +1,4 @@
|
||||
Your last invoice has failed to be paid for Coolify Cloud. Please <a href="{{$stripeCustomerPortal}}">update payment details on your Stripe Customer Portal</a>.
|
||||
<br><br>
|
||||
Thanks,<br>
|
||||
Coolify Cloud
|
||||
@@ -1,4 +1,5 @@
|
||||
Congratulations!<br>
|
||||
Congratulations!<br>
|
||||
<br>
|
||||
You have been invited to join the Coolify Cloud. <a href="{{base_url()}}/login">Login here</a>
|
||||
<br>
|
||||
|
||||
@@ -1,31 +1,48 @@
|
||||
<div>
|
||||
<div>Status: {{ currentTeam()->subscription->lemon_status }}</div>
|
||||
<div>Type: {{ currentTeam()->subscription->lemon_variant_name }}</div>
|
||||
@if (currentTeam()->subscription->lemon_status === 'cancelled')
|
||||
<div class="pb-4">Subscriptions ends at: {{ getRenewDate() }}</div>
|
||||
<div class="py-4">If you would like to change the subscription to a lower/higher plan, <a
|
||||
class="text-white underline" href="https://docs.coollabs.io/contact" target="_blank">please
|
||||
contact
|
||||
us.</a></div>
|
||||
@else
|
||||
<div class="pb-4">Renews at: {{ getRenewDate() }}</div>
|
||||
@if (subscriptionProvider() === 'stripe')
|
||||
@if (currentTeam()->subscription->stripe_cancel_at_period_end)
|
||||
<div>Subscription is active but on cancel period.</div>
|
||||
@else
|
||||
<div>Subscription is active. Last invoice is
|
||||
{{ currentTeam()->subscription->stripe_invoice_paid ? 'paid' : 'not paid' }}.</div>
|
||||
@endif
|
||||
|
||||
@if (currentTeam()->subscription->stripe_cancel_at_period_end)
|
||||
<a class="hover:no-underline" href="{{ route('subscription') }}"><x-forms.button>Subscribe
|
||||
again</x-forms.button></a>
|
||||
@endif
|
||||
<x-forms.button wire:click='stripeCustomerPortal'>Manage My Subscription</x-forms.button>
|
||||
@endif
|
||||
<div class="flex flex-col gap-2">
|
||||
<div class="flex gap-2">
|
||||
@if (currentTeam()->subscription->lemon_status === 'cancelled')
|
||||
<x-forms.button class="bg-coollabs-gradient" wire:click='resume'>Resume Subscription
|
||||
@if (subscriptionProvider() === 'lemon')
|
||||
<div>Status: {{ currentTeam()->subscription->lemon_status }}</div>
|
||||
<div>Type: {{ currentTeam()->subscription->lemon_variant_name }}</div>
|
||||
@if (currentTeam()->subscription->lemon_status === 'cancelled')
|
||||
<div class="pb-4">Subscriptions ends at: {{ getRenewDate() }}</div>
|
||||
<div class="py-4">If you would like to change the subscription to a lower/higher plan, <a
|
||||
class="text-white underline" href="https://docs.coollabs.io/contact" target="_blank">please
|
||||
contact
|
||||
us.</a></div>
|
||||
@else
|
||||
<div class="pb-4">Renews at: {{ getRenewDate() }}</div>
|
||||
@endif
|
||||
<div class="flex flex-col gap-2">
|
||||
<div class="flex gap-2">
|
||||
@if (currentTeam()->subscription->lemon_status === 'cancelled')
|
||||
<x-forms.button class="bg-coollabs-gradient" wire:click='resume'>Resume Subscription
|
||||
</x-forms.button>
|
||||
@else
|
||||
<x-forms.button wire:click='cancel'>Cancel Subscription</x-forms.button>
|
||||
@endif
|
||||
</div>
|
||||
<div>
|
||||
<x-forms.button><a class="text-white hover:no-underline" href="{{ getPaymentLink() }}">Update Payment
|
||||
Details</a>
|
||||
</x-forms.button>
|
||||
@else
|
||||
<x-forms.button wire:click='cancel'>Cancel Subscription</x-forms.button>
|
||||
@endif
|
||||
<a class="text-white hover:no-underline"
|
||||
href="https://app.lemonsqueezy.com/my-orders"><x-forms.button>Manage My
|
||||
Subscription</x-forms.button></a>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<x-forms.button><a class="text-white hover:no-underline" href="{{ getPaymentLink() }}">Update Payment
|
||||
Details</a>
|
||||
</x-forms.button>
|
||||
<a class="text-white hover:no-underline"
|
||||
href="https://app.lemonsqueezy.com/my-orders"><x-forms.button>Manage My
|
||||
Subscription</x-forms.button></a>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
<x-pricing-plans>
|
||||
@if (config('subscription.provider') === 'stripe')
|
||||
<x-slot:basic>
|
||||
<x-forms.button x-show="selected === 'monthly'" x-cloak aria-describedby="tier-basic"
|
||||
class="w-full h-10 buyme" wire:click="subscribeStripe('basic-monthly')"> Subscribe
|
||||
</x-forms.button>
|
||||
|
||||
<x-forms.button x-show="selected === 'yearly'" x-cloak aria-describedby="tier-basic"
|
||||
class="w-full h-10 buyme" wire:click="subscribeStripe('basic-yearly')"> Subscribe
|
||||
</x-forms.button>
|
||||
</x-slot:basic>
|
||||
<x-slot:pro>
|
||||
<x-forms.button x-show="selected === 'monthly'" x-cloak aria-describedby="tier-pro"
|
||||
class="w-full h-10 buyme" wire:click="subscribeStripe('pro-monthly')"> Subscribe
|
||||
</x-forms.button>
|
||||
|
||||
<x-forms.button x-show="selected === 'yearly'" x-cloak aria-describedby="tier-pro" class="w-full h-10 buyme"
|
||||
wire:click="subscribeStripe('pro-yearly')"> Subscribe
|
||||
</x-forms.button>
|
||||
</x-slot:pro>
|
||||
<x-slot:ultimate>
|
||||
<x-forms.button x-show="selected === 'monthly'" x-cloak aria-describedby="tier-ultimate"
|
||||
class="w-full h-10 buyme" wire:click="subscribeStripe('ultimate-monthly')"> Subscribe
|
||||
</x-forms.button>
|
||||
|
||||
<x-forms.button x-show="selected === 'yearly'" x-cloak aria-describedby="tier-ultimate"
|
||||
class="w-full h-10 buyme" wire:click="subscribeStripe('ultimate-yearly')"> Subscribe
|
||||
</x-forms.button>
|
||||
</x-slot:ultimate>
|
||||
@endif
|
||||
@if (config('subscription.provider') === 'paddle')
|
||||
<x-paddle />
|
||||
@endif
|
||||
@if (config('subscription.provider') === 'lemon')
|
||||
<x-slot:basic>
|
||||
<x-forms.button x-show="selected === 'monthly'" x-cloak aria-describedby="tier-basic"
|
||||
class="w-full h-10 buyme" wire:click="getSubscriptionLink('basic-monthly')"> Subscribe
|
||||
</x-forms.button>
|
||||
|
||||
<x-forms.button x-show="selected === 'yearly'" x-cloak aria-describedby="tier-basic"
|
||||
class="w-full h-10 buyme" wire:click="getSubscriptionLink('basic-yearly')"> Subscribe
|
||||
</x-forms.button>
|
||||
</x-slot:basic>
|
||||
<x-slot:pro>
|
||||
<x-forms.button x-show="selected === 'monthly'" x-cloak aria-describedby="tier-pro"
|
||||
class="w-full h-10 buyme" wire:click="getSubscriptionLink('pro-monthly')"> Subscribe
|
||||
</x-forms.button>
|
||||
|
||||
<x-forms.button x-show="selected === 'yearly'" x-cloak aria-describedby="tier-pro" class="w-full h-10 buyme"
|
||||
wire:click="getSubscriptionLink('pro-yearly')"> Subscribe
|
||||
</x-forms.button>
|
||||
</x-slot:pro>
|
||||
<x-slot:ultimate>
|
||||
<x-forms.button x-show="selected === 'monthly'" x-cloak aria-describedby="tier-ultimate"
|
||||
class="w-full h-10 buyme" wire:click="getSubscriptionLink('ultimate-monthly')"> Subscribe
|
||||
</x-forms.button>
|
||||
|
||||
<x-forms.button x-show="selected === 'yearly'" x-cloak aria-describedby="tier-ultimate"
|
||||
class="w-full h-10 buyme" wire:click="getSubscriptionLink('ultimate-yearly')"> Subscribe
|
||||
</x-forms.button>
|
||||
</x-slot:ultimate>
|
||||
@endif
|
||||
</x-pricing-plans>
|
||||
3
resources/views/subscription/cancel.blade.php
Normal file
3
resources/views/subscription/cancel.blade.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<x-layout-subscription>
|
||||
Cancel
|
||||
</x-layout-subscription>
|
||||
@@ -1,7 +1,8 @@
|
||||
<x-layout-subscription>
|
||||
@if ($settings->is_resale_license_active)
|
||||
<div class="flex justify-center mx-10">
|
||||
<div>
|
||||
|
||||
<div x-data>
|
||||
<div class="flex gap-2">
|
||||
<h2>Subscription</h2>
|
||||
<livewire:switch-team />
|
||||
@@ -10,7 +11,12 @@
|
||||
<span>Currently active team: <span
|
||||
class="text-warning">{{ session('currentTeam.name') }}</span></span>
|
||||
</div>
|
||||
<x-pricing-plans />
|
||||
@if(request()->query->get('cancelled'))
|
||||
<div class="text-xl text-center text-red-500">Something went wrong. Please try again.</div>
|
||||
@endif
|
||||
@if (config('subscription.provider') !== null)
|
||||
<livewire:subscription.pricing-plans />
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
3
resources/views/subscription/success.blade.php
Normal file
3
resources/views/subscription/success.blade.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<x-layout>
|
||||
Success
|
||||
</x-layout>
|
||||
Reference in New Issue
Block a user