@extends('layouts.app') @section('title', 'M-PESA Payments & Reconciliation') @section('content')

M-PESA

Payments & reconciliation

@foreach ([['Transactions',$stats['total'],'blue'],['Confirmed',$stats['success'],'emerald'],['Pending',$stats['pending'],'amber'],['Failed',$stats['failed'],'rose'],["Today's M-PESA",'KSh '.number_format($stats['today'],2),'emerald'],['Unlinked STK',$stats['unlinked'],'orange'],['Unlinked Till',$stats['c2b_unlinked'],'orange']] as $card)

{{ $card[0] }}

{{ $card[1] }}

@endforeach

Daraja connection

Environment: {{ strtoupper($settings['environment']) }} · Shortcode/Till: {{ $settings['shortcode'] ?: 'Not configured' }} · Type: {{ $settings['transaction_type'] ?: 'Not configured' }}

{{ $settings['credentials'] ? 'Credentials present' : 'Credentials missing' }}{{ $settings['stk'] ? 'STK configured' : 'STK incomplete' }}

Credentials are kept in the server .env file. Never display consumer secrets or passkeys in the browser.

Reset
@forelse($transactions as $tx)@empty@endforelse
DateTypeM-PESA receiptPhoneCustomer / SaleAmountStatusLinked payment
{{ $tx->created_at?->timezone('Africa/Nairobi')->format('Y-m-d H:i:s') }}STK Push{{ $tx->mpesa_receipt ?: '—' }}{{ $tx->phone }}{{ class_basename($tx->payable_type) }} #{{ $tx->payable_id }}
{{ $tx->account_reference }}
KSh {{ number_format($tx->amount_received ?? $tx->amount,2) }}{{ strtoupper($tx->status) }}{{ $tx->payment_id ? '#'.$tx->payment_id : ($tx->status==='success'?'REVIEW REQUIRED':'—') }}
No M-PESA transactions match these filters.
{{ $transactions->links() }}

Incoming Till / PayBill payments

Safaricom confirmations appear here automatically. Exact bill-reference matches are linked automatically when the reference equals a billed order number and the amount fits the outstanding balance. Other payments remain unlinked for cashier review.

@forelse($c2bTransactions as $c2b) @empty@endforelse
DateReceiptCustomer namePhoneBill referenceAmountStatus / SaleMatch to sale
{{ $c2b->trans_time?->timezone('Africa/Nairobi')->format('Y-m-d H:i:s') ?: $c2b->created_at?->timezone('Africa/Nairobi')->format('Y-m-d H:i:s') }} {{ $c2b->trans_id }} {{ trim(($c2b->first_name ?? '').' '.($c2b->middle_name ?? '').' '.($c2b->last_name ?? '')) ?: 'Name not supplied' }} {{ $c2b->phone ?: '—' }}{{ $c2b->bill_ref_number ?: '—' }}KSh {{ number_format((float)$c2b->amount,2) }} {{ strtoupper($c2b->status) }}@if($c2b->linked_type && $c2b->linked_id)
{{ class_basename($c2b->linked_type) }} #{{ $c2b->linked_id }}
@endif
@if($c2b->status==='unlinked')
@csrf
@else Already processed @endif
No C2B confirmations received yet. Confirm that Safaricom has registered the C2B confirmation URL.
@endsection