Salami Gateway

API Documentation
Back to Dashboard

M-Pesa SDK

deadangroup/mpesa — Safaricom DARAJA API

Namespace: DGL\Mpesa Base URLs: sandbox.safaricom.co.ke (sandbox) / api.safaricom.co.ke (production)

Configuration

// config/mpesa.php
return [
    'is_sandbox' => true,
    'apps' => [
        'default' => [
            'consumer_key' => '...',
            'consumer_secret' => '...',
        ],
    ],
    'lnmo' => [
        'short_code' => 174379,
        'passkey' => '...',
        'callback' => '...',
    ],
];

Operations

STK Push (Lipa Na M-Pesa)

$client->STKPush([
    'Amount' => 1000,
    'PhoneNumber' => '254712345678',
    'AccountReference' => 'INV001',
    'TransactionDesc' => 'Payment for invoice',
]);

STK Status

$client->STKStatus([
    'CheckoutRequestID' => 'ws_CO_...',
]);

B2C (Business to Customer)

$client->B2C([
    'Amount' => 500,
    'PartyB' => '254712345678',
    'Remarks' => 'Salary payment',
    'ResultURL' => 'https://...',
    'QueueTimeOutURL' => 'https://...',
]);

B2B (Business to Business)

$client->B2B([
    'Amount' => 10000,
    'PartyB' => '600000',
    'AccountReference' => 'INV001',
    'ResultURL' => 'https://...',
    'QueueTimeOutURL' => 'https://...',
]);

C2B Register URLs

$client->C2BRegister([
    'ShortCode' => '600000',
    'ResponseType' => 'Completed',
    'ConfirmationURL' => 'https://...',
    'ValidationURL' => 'https://...',
]);

Account Balance

$client->accountBalance([
    'ResultURL' => 'https://...',
    'QueueTimeOutURL' => 'https://...',
]);

Transaction Status

$client->transactionStatus([
    'TransactionID' => 'OEI2AK4Q16',
    'ResultURL' => 'https://...',
    'QueueTimeOutURL' => 'https://...',
]);

Reversal

$client->reversal([
    'TransactionID' => 'OEI2AK4Q16',
    'ResultURL' => 'https://...',
    'QueueTimeOutURL' => 'https://...',
    'Remarks' => 'Wrong transaction',
]);

Need help? Contact us at support@dgl.co.ke
© 2026 Deadan Group Limited. All rights reserved.
⚡ API Explorer
LIVE
// Response will appear here...