@extends('layouts.customer') @section('title', 'Billing') @section('page-title', 'Billing & Subscription') @section('content') @php $isCurrentPlanActive = $subscription && !$subscription->isExpired() && in_array($subscription->status, ['active', 'trialing', 'pending'], true); $isSubscriptionActiveOrTrialing = $subscription && !$subscription->isExpired() && in_array($subscription->status, ['active', 'trialing'], true); $renewalDate = null; if ($subscription?->period_end) { $renewalDate = $subscription->period_end; } elseif ($subscription?->trial_ends_at && $subscription->trial_ends_at->isFuture()) { $renewalDate = $subscription->trial_ends_at; } elseif ($subscription?->starts_at) { $renewalDate = $subscription->starts_at->copy()->addMonths($subscription?->billing_cycle === 'yearly' ? 12 : 1); } $emailsUsed = (int) ($usage['emails_sent_this_month'] ?? 0); $subsUsed = (int) ($usage['subscribers_count'] ?? 0); $campaignsUsed = (int) ($usage['campaigns_count'] ?? 0); $emailsLimit = (int) ($currentPlan?->customerGroup?->limit('sending_quota.monthly_quota', 0) ?? 0); $subsLimit = (int) ($currentPlan?->customerGroup?->limit('lists.limits.max_subscribers', 0) ?? 0); $campaignsLimit = (int) ($currentPlan?->customerGroup?->limit('campaigns.limits.max_campaigns', 0) ?? 0); $emailsPercent = $emailsLimit > 0 ? min(100, (int) round(($emailsUsed / $emailsLimit) * 100)) : null; $subsPercent = $subsLimit > 0 ? min(100, (int) round(($subsUsed / $subsLimit) * 100)) : null; $campaignsPercent = $campaignsLimit > 0 ? min(100, (int) round(($campaignsUsed / $campaignsLimit) * 100)) : null; @endphp

Billing

Manage your subscription, view payment history, and update your billing details — all in one place.

Subscription Overview

Current Plan
{{ $currentPlan?->name ?? ($subscription?->plan_name ?? 'No Plan') }}
{{ $subscription?->currency ?? ($currentPlan?->currency ?? 'USD') }} {{ number_format((float) ($subscription?->price ?? ($currentPlan?->price ?? 0)), 2) }}
/ {{ $subscription?->billing_cycle ?? ($currentPlan?->billing_cycle ?? 'monthly') }}
Status: {{ $subscription ? ucfirst($subscription->status) : '—' }} @if($subscription?->trial_ends_at) · Trial ends {{ $subscription->trial_ends_at->format('M d, Y') }} @endif
@if($subscription && $subscription->status === 'pending' && $subscription->provider === 'manual')
{{ __('Complete Manual Payment') }}
@endif
@if($portalUrl) Manage @else Manage @endif
Renews: {{ $renewalDate ? $renewalDate->format('M d, Y') : '—' }}
@if($isCurrentPlanActive) Active @else Not active @endif
Usage Summary (this month)
{{ number_format($emailsUsed) }} @if($emailsLimit > 0) / {{ number_format($emailsLimit) }} @endif
{{ $emailsPercent !== null ? $emailsPercent . '%' : '—' }}
Emails Sent
{{ number_format($subsUsed) }} @if($subsLimit > 0) / {{ number_format($subsLimit) }} @endif
{{ $subsPercent !== null ? $subsPercent . '%' : '—' }}
Subscribers
{{ number_format($campaignsUsed) }} @if($campaignsLimit > 0) / {{ number_format($campaignsLimit) }} @endif
{{ $campaignsPercent !== null ? $campaignsPercent . '%' : '—' }}
Campaigns

Billing History

Filter
@php $hasCurrentInvoiceRow = false; foreach ($invoiceEvents as $event) { if (data_get($event->payload, 'billing_reason') === 'subscription_create') { $hasCurrentInvoiceRow = true; break; } } @endphp @if($isCurrentPlanActive && !$hasCurrentInvoiceRow) @endif @if($invoiceEvents->count() > 0) @foreach($invoiceEvents as $event) @php $invoice = $event->payload; $created = data_get($invoice, 'created'); $date = $created ? \Carbon\Carbon::createFromTimestamp($created)->format('M d, Y') : ($event->processed_at?->format('M d, Y') ?? $event->created_at->format('M d, Y')); $amountCents = (int) (data_get($invoice, 'amount_paid') ?? data_get($invoice, 'amount_due') ?? data_get($invoice, 'total') ?? 0); $currency = strtoupper((string) (data_get($invoice, 'currency') ?? ($subscription?->currency ?? 'USD'))); $amount = number_format($amountCents / 100, 2); $status = (string) (data_get($invoice, 'status') ?? data_get($invoice, 'paid') ? 'paid' : ''); $hostedInvoiceUrl = data_get($invoice, 'hosted_invoice_url'); $invoicePdf = data_get($invoice, 'invoice_pdf'); $downloadUrl = $hostedInvoiceUrl ?: $invoicePdf; $description = data_get($invoice, 'lines.data.0.description') ?? data_get($invoice, 'description') ?? ($subscription?->plan_name ? ($subscription->plan_name . ' - ' . ucfirst($subscription->billing_cycle)) : 'Invoice'); $statusLabel = strtolower($status); $statusIsPaid = in_array($statusLabel, ['paid', 'succeeded'], true); $statusIsFailed = in_array($statusLabel, ['failed', 'uncollectible'], true); @endphp @endforeach @elseif(isset($stripeInvoices) && $stripeInvoices->count() > 0) @foreach($stripeInvoices as $invoice) @php $created = data_get($invoice, 'created'); $date = $created ? \Carbon\Carbon::createFromTimestamp($created)->format('M d, Y') : '—'; $amountCents = (int) (data_get($invoice, 'amount_paid') ?? data_get($invoice, 'amount_due') ?? data_get($invoice, 'total') ?? 0); $currency = strtoupper((string) (data_get($invoice, 'currency') ?? ($subscription?->currency ?? 'USD'))); $amount = number_format($amountCents / 100, 2); $status = (string) (data_get($invoice, 'status') ?? (data_get($invoice, 'paid') ? 'paid' : '')); $hostedInvoiceUrl = data_get($invoice, 'hosted_invoice_url'); $invoicePdf = data_get($invoice, 'invoice_pdf'); $downloadUrl = $hostedInvoiceUrl ?: $invoicePdf; $description = data_get($invoice, 'lines.data.0.description') ?? data_get($invoice, 'description') ?? 'Invoice'; $statusLabel = strtolower($status); $statusIsPaid = in_array($statusLabel, ['paid', 'succeeded'], true); $statusIsFailed = in_array($statusLabel, ['failed', 'uncollectible'], true); @endphp @endforeach @elseif(!$isCurrentPlanActive) @endif
Date Description Amount Status Action
{{ $subscription?->starts_at ? $subscription->starts_at->format('M d, Y') : now()->format('M d, Y') }} {{ $subscription?->plan_name ?? 'Current Subscription' }} @if($subscription?->billing_cycle) - {{ ucfirst($subscription->billing_cycle) }} @endif {{ $subscription?->currency ?? ($currentPlan?->currency ?? 'USD') }} {{ number_format((float) ($subscription?->price ?? ($currentPlan?->price ?? 0)), 2) }} Current
@if(!empty($latestInvoiceUrl)) Invoice @else Invoice @endif Delete
{{ $date }} {{ $description }} {{ $currency }} {{ $amount }} @if($statusIsPaid) Paid @elseif($statusIsFailed) Failed @else {{ $statusLabel !== '' ? ucfirst($statusLabel) : '—' }} @endif
@if($downloadUrl) Invoice @else Invoice @endif
@csrf @method('DELETE') Delete
{{ $date }} {{ $description }} {{ $currency }} {{ $amount }} @if($statusIsPaid) Paid @elseif($statusIsFailed) Failed @else {{ $statusLabel !== '' ? ucfirst($statusLabel) : '—' }} @endif
@if($downloadUrl) {{ __('Invoice') }} @else {{ __('Invoice') }} @endif {{ __('Delete') }}
{{ __('No billing history yet.') }}

{{ __('Payment Method') }}

{{ strtoupper($paymentMethodCard['brand'] ?? __('CARD')) }}
•••• •••• •••• {{ $paymentMethodCard['last4'] ?? '••••' }}
{{ __('Name') }}
{{ $customerName ?: '—' }}
{{ __('Valid Thru') }}
@if(!empty($paymentMethodCard['exp_month']) && !empty($paymentMethodCard['exp_year'])) {{ str_pad((string) $paymentMethodCard['exp_month'], 2, '0', STR_PAD_LEFT) }}/{{ substr((string) $paymentMethodCard['exp_year'], -2) }} @else — @endif
+
{{ __('Add New Card') }}
{{ __('Manage your payment method in the billing portal.') }}
@if($portalUrl) {{ __('Open Billing Portal') }} @else {{ __('Open Billing Portal') }} @endif

{{ __('Upgrade Plans') }}

@foreach($plans as $plan) @php $isCurrentPlan = $subscription && $subscription->plan_db_id === $plan->id && !$subscription->isExpired() && in_array($subscription->status, ['active', 'trialing', 'pending'], true); @endphp
{{ $plan->name }}
{{ $plan->currency }} {{ number_format($plan->price, 2) }} / {{ $plan->billing_cycle }}
{{ __('Customer Group:') }} {{ $plan->customerGroup?->name ?? __('N/A') }}
@if($plan->customerGroup) @php $planFeatures = $plan->customerGroup->displayAccessAndLimits(); @endphp
@foreach($planFeatures as $row)
@if(($row['status'] ?? true) === false) @else @endif
{{ $row['label'] ?? '' }}: {{ $row['value'] ?? '' }}
@endforeach
@endif @if($isCurrentPlan)
{{ __('Current Plan') }}
@else
{{ __('Choose Plan') }}
@endif
@endforeach
@endsection