@php /** @var \App\Models\Job $job */ /** @var string|null $clientSecret */ // payment_intent_client_secret (optional) /** @var string|null $setupSecret */ // setup_intent_client_secret (optional) /** @var \App\Models\Payment|null $payment */ // optional, if controller passed it /** @var \App\Models\Deposit|null $deposit */ // optional, if controller passed it use Illuminate\Support\Carbon; /* -------- helpers consistent with pay.blade -------- */ $toCents = function ($v): int { if (is_null($v)) return 0; if (is_int($v)) return $v; if (is_numeric($v) && str_contains((string) $v, '.')) return (int) round(((float) $v) * 100); return (int) $v; }; $formatMoney = function (int $cents, string $cur = 'NZD'): string { $amount = number_format($cents / 100, 2); $symbol = match (strtoupper($cur)) { 'NZD' => 'NZ$', 'AUD' => 'A$', 'USD' => '$', 'GBP' => '£', 'EUR' => '€', default => '' }; return $symbol ? $symbol . $amount : ($amount . ' ' . strtoupper($cur)); }; /* ---------------- dates (same style as pay.blade) ---------------- */ $tz = $job->timezone ?? config('app.timezone', 'UTC'); $startAt = $job->start_at ? Carbon::parse($job->start_at)->timezone($tz) : null; $endAt = $job->end_at ? Carbon::parse($job->end_at)->timezone($tz) : null; $fmt = fn (Carbon $c) => $c->isoFormat('ddd D MMM, HH:mm'); $durationLabel = null; if ($startAt && $endAt && $endAt->greaterThan($startAt)) { $mins = $endAt->diffInMinutes($startAt); $days = intdiv($mins, 1440); $hours = intdiv($mins % 1440, 60); $m = $mins % 60; $parts = []; if ($days) $parts[] = $days.'d'; if ($hours) $parts[] = $hours.'h'; if (!$days && !$hours && $m) $parts[] = $m.'m'; $durationLabel = implode(' ', $parts); } $tzShort = $startAt?->format('T') ?? $endAt?->format('T') ?? strtoupper($tz); /* ---------------- money / totals (mirror pay.blade) --------------- */ $currency = $job->currency ?? optional($job->flow)->currency ?? 'NZD'; $totalCents = $toCents($job->charge_amount ?? 0); $paidCents = $toCents($job->paid_amount_cents ?? 0); if ($paidCents === 0 && method_exists($job, 'payments')) { try { $paidCents = (int) $job->payments() ->whereIn('status', ['succeeded','captured']) ->sum('amount_cents'); } catch (\Throwable $e) {} } $remainingCts = max(0, $totalCents - $paidCents); $holdCents = (int) (optional($job->flow)->hold_amount_cents ?? 0); /* ---------------- urls / keys ---------------- */ $stripeKey = config('services.stripe.key'); $backUrl = route('portal.pay.show.job', ['job' => $job->getKey()]); $recordUrl = route('portal.pay.recordPaid', ['job' => $job->getKey()]); @endphp Payment complete • {{ config('app.name') }}
🔒
Secured by
{{ config('app.name') }} (via Stripe)

Payment complete

Job #{{ $job->id }} • {{ $job->title ?? 'Booking' }}

@if($startAt || $endAt)
Rental: @if($startAt) {{ $fmt($startAt) }} @else TBC @endif @if($endAt) {{ $fmt($endAt) }} @else TBC @endif @if($durationLabel) ({{ $durationLabel }}) @endif • {{ $tzShort }}
@endif
{{-- Prefer server-confirmed details when provided --}} @if(!empty($payment))
Payment successful
Amount
{{ $formatMoney((int)($payment->amount_cents ?? 0), strtoupper($payment->currency ?? ($job->currency ?? 'NZD'))) }}
Intent
{{ $payment->stripe_payment_intent }}
@if(!empty($payment->card_brand) && !empty($payment->last4))
Card
{{ strtoupper($payment->card_brand) }} •••• {{ $payment->last4 }}
@endif
@elseif(!empty($deposit))
Security hold authorised
Amount
{{ $formatMoney((int)($deposit->amount_cents ?? 0), strtoupper($deposit->currency ?? ($job->currency ?? 'NZD'))) }}
Authorization
{{ $deposit->stripe_payment_intent }}
Status
{{ ucfirst($deposit->status ?? 'authorized') }}
@endif {{-- Keep the original warning but only when we truly have nothing client-side --}} @if(!$clientSecret && !$setupSecret && empty($payment) && empty($deposit))
No confirmation details found on this page. If you just paid, your receipt will arrive by email shortly.
@endif

What happens next

  • If your card required extra authentication, the payment may show as processing for a short time.
  • We’ll email a receipt to the address on file (and to the one you entered during checkout, if provided).
  • @if($holdCents > 0)
  • A refundable security hold of {{ $formatMoney($holdCents, $currency) }} may appear as “pending” on your card. It is not a charge and will be released per our policy.
  • @endif
  • Need help? Reply to this email or contact support with Job #{{ $job->id }}.