@extends('layouts.app') @php($isAdmin = auth()->user()->isAdmin()) @section('title', 'M-Pesa') @section('subtitle', 'STK push requests and transaction log') @section('content') Invoices @if ($isAdmin) Settings @endif @if (! $enabled)
M-Pesa is disabled in system settings. Enable it under Integrations in System Settings.
@elseif (! $configured)
Simulation mode. Daraja credentials are not configured, so STK requests are simulated in the app. Add the consumer key, secret, shortcode and passkey in System Settings to send real requests. Callback URL: {{ route('mpesa.callback') }}
@else
Connected to Daraja {{ ucfirst($environment) }}. Callback URL: {{ setting('mpesa_callback_url') ?: route('mpesa.callback') }}
@endif
@forelse ($transactions as $transaction) @empty @endforelse
Requested Phone Student Invoice Amount Receipt Status
{{ $transaction->created_at->format('j M Y, g:i A') }} @if ($transaction->is_simulated)
Simulated
@endif
{{ \App\Support\PhoneNumber::display($transaction->phone) }} {{ $transaction->student?->user?->name ?? $transaction->payment?->student?->user?->name ?? '—' }}
{{ $transaction->student?->student_number ?? $transaction->payment?->student?->student_number }}
@if ($transaction->payment) {{ $transaction->payment->invoice_number }} @else {{ $transaction->account_reference ?? '—' }} @endif {{ money($transaction->amount) }} {{ $transaction->mpesa_receipt ?? '—' }} @if ($transaction->result_description)
{{ \Illuminate\Support\Str::limit($transaction->result_description, 40) }}
@endif
{{ $statuses[$transaction->status] ?? ucfirst($transaction->status) }}
@if ($transaction->status === 'pending' && $transaction->is_simulated)
@csrf
@endif @if ($transaction->payment) @endif
@if ($transactions->hasPages())
{{ $transactions->links() }}
@endif
@endsection