@extends('layouts.app') @section('content') @php $value = fn ($key, $default = '') => old($key, $settings[$key] ?? $default); @endphp
M-Pesa Settings
Set up Safaricom Daraja credentials and callbacks for STK Push, C2B and B2C.
Back
@if(session('success'))
{{ session('success') }}
@endif @if($errors->any())
@foreach($errors->all() as $error)
{{ $error }}
@endforeach
@endif
@csrf
Environment
Sandbox is for testing. Production is used once you are ready to accept real payments.
API Credentials
Get these from Safaricom Daraja portal, My Apps, then your app. Sensitive credentials are encrypted and not shown again after saving.
Callback URLs
Register these in Daraja portal under your app. They must be HTTPS and publicly reachable; localhost will need a tunnel like ngrok.
@foreach([ 'mpesa_stk_callback_url' => 'STK Push Callback URL', 'mpesa_c2b_validation_url' => 'C2B Validation URL', 'mpesa_c2b_confirmation_url' => 'C2B Confirmation URL', 'mpesa_b2c_result_url' => 'B2C Result URL', 'mpesa_b2c_timeout_url' => 'B2C Queue Timeout URL', ] as $key => $label)
@endforeach
Use production callback URLs only after deploying the system or exposing your local server through a secure tunnel.
Features
Enable the M-Pesa flows this client will use.
@foreach([ 'mpesa_stk_enabled' => ['STK Push', "Prompts the customer's phone to pay with PIN"], 'mpesa_c2b_enabled' => ['C2B (Paybill / Till)', 'Customers pay directly into your Paybill or Till'], 'mpesa_b2c_enabled' => ['B2C (Disbursements)', 'Send refunds or payouts to customers'], 'mpesa_modem_enabled' => ['Modem SMS', 'Receive Till or Paybill confirmations through SMS Enabler'], ] as $key => [$title, $desc])
{{ $title }}
{{ $desc }}
@endforeach
Modem / SMS Enabler
This works alongside the online Daraja integration. Configure SMS Enabler to forward incoming messages to the local URL below.
@endsection