@php /** @var array|null $res ['id' => checkoutId] */ /** @var string|null$brand 'visa' | 'master' | 'mada' | 'applepay' */ /** @var string|null $error */ $locale = app()->getLocale() ?: 'ar'; $isArabic = str_starts_with($locale, 'ar'); // Determine selected payment type $brand = $res['brand'] ?? 'visa'; $type = $res['type']; $amount = $res['amount'] ?? ($amount ?? 0); $model_id = $res['model_id']; // Supported payment brands $allowed = [ 'visa' => 'VISA', 'master' => 'MASTER', 'mada' => 'MADA', 'applepay' => 'APPLEPAY', ]; $selectedBrand = $allowed[$brand] ?? null; $checkoutId = $res['id'] ?? null; $mode = $res['mode'] ?? config('hyperpay.mode', 'test'); // UI Colors $primary = '#735685'; $secondary = '#9A85FF'; $bg = '#F6F7FB'; @endphp {{ $isArabic ? 'الدفع الآمن' : 'Secure Payment' }} @if($selectedBrand && $checkoutId) @if ($mode === 'live') @else @endif @endif
{{-- General error message if any --}} @if(!empty($error))
{{ $error }}
@endif {{-- Unsupported payment type --}} @if(!$selectedBrand)
{{ $isArabic ? 'نوع الدفع المختار غير مدعوم. يرجى اختيار Visa أو MasterCard أو مدى أو Apple Pay.' : 'The selected payment method is not supported. Please use Visa, MasterCard, Mada, or Apple Pay.' }}
{{-- Checkout initialization failed --}} @elseif(!$checkoutId)
{{ $isArabic ? 'تعذّر بدء جلسة الدفع. يُرجى المحاولة مرة أخرى.' : 'Unable to initialize payment session. Please try again.' }}
@else {{-- Loader while widget initializes --}}
{{-- HyperPay Widget Container --}} @endif

{{ $isArabic ? 'جميع عمليات الدفع عبر منصتنا آمنة ومشفّرة بالكامل.' : 'All payments through our platform are fully encrypted and secure.' }}