Download the PHP package wasksofts-technology/mpesa_v2 without Composer
On this page you can find all versions of the php package wasksofts-technology/mpesa_v2. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download wasksofts-technology/mpesa_v2
More information about wasksofts-technology/mpesa_v2
Files in wasksofts-technology/mpesa_v2
Package mpesa_v2
Short Description A simple Mpesa API library.
License MIT
Informations about the package mpesa_v2
Introduction
Mpesa PHP library which you can use with various framework like laravel ,codeigniter ,cakephp and many more This package seeks to help php developers implement the various Mpesa APIs without much hustle. It is based on the REST API whose documentation is available on https://developer.safaricom.co.ke.
Installation using composer
Quick start
Configuration
Set configuration values using config($key, $value).
| Key | Description |
|---|---|
| consumer_key | Daraja app consumer key |
| consumer_secret | Daraja app consumer secret |
| transaction_type | paybill or buygoods |
| shortcode | Paybill /Business shortcode |
| store_number | Till number (for Buy Goods) |
| b2c_shortcode | B2C shortcode |
| b2b_shortcode | B2B shortcode |
| initiator_name | API initiator username |
| initiator_password | API initiator password |
| pass_key | Lipa na M-Pesa passkey |
| security_credential | Pre-generated security credential (optional) |
| callback_url | STK Push callback URL base |
| so_callback_url | Standing Order callback URL |
| confirmation_url | C2B confirmation URL |
| validation_url | C2B validation URL |
| result_url | Base URL for result callbacks |
| timeout_url | Base URL for timeout callbacks |
official_contact Bill Manager official contact logo_link Bill Manager logo URL env sandbox or production
Register URL
Registers validation and confirmation URLs for a shortcode. Cancelled/Completed
STK Push (Lipa na M-Pesa Online)
STKPush($Amount, $phoneNumberSendingFund, $AccountReference, $TransactionDesc) Initiates an STK push to a customer's phone.
STKPush Status
Checks the status of an STK Push transaction.
B2C (Business to Customer)
$mpesa->b2c($amount, $commandId, $receiver, $remark, $result_url = 'b2c', $timeout_url = 'b2c', $occassion = null)
Sends money from business to customer.
B2B (Business to Business)
Transfers funds between businesses. $mpesa->b2b($Amount, $PartyB, $commandId, $AccountReference, $Remarks, $result_url = 'b2b', $timeout_url = 'b2b')
Transaction Reversal
Reverses a B2B, B2C, or C2B transaction. $mpesa->reversal($Amount, $TransactionID, $Remarks, $result_url = 'reversal', $timeout_url = 'reversal', $Occasion = NULL)
Account Balance
Queries the account balance of a shortcode. Identifier Types: 1 (MSISDN), 2 (Till Number), 4 (Shortcode) $mpesa->accountbalance(4, 'Balance query');
Transaction Status
Checks the status of any transaction. Identifier Types: 1 (MSISDN), 2 (Till Number), 4 (Shortcode) $mpesa->transaction_status($TransactionID, $Remarks, $indentifier = 4, $result_url = "transaction_status", $timeout_url = "transaction_status", $Occassion = NULL)
QR Code Generation
Generates a dynamic M-Pesa QR code. Formats: 1 (Image), 2 (QR String), 3 (Binary), 4 (PDF) $mpesa->generate_qrcode($amount, $reference, $MerchantName = 'SERVICE', $qrformat = 1, $trxcode = 'PG')
Tax Remittance
Remits tax to Kenya Revenue Authority (KRA). $mpesa->tax_remittance($amount, $account_prn, $Remarks = "OK", $result_url = 'tax', $timeout_url = 'tax', $kra_paybill = "572572")
Standing Orders
Creates a recurring standing order on a customer profile. $mpesa->standing_order($name, $start_date, $end_date, $amount, $from, $AccountReference, $TransactionDesc, $Frequency) Frequency: 1 One-off, 2 Daily, 3 Weekly, 4 Monthly, 5 Bi-Monthly, 6 Quarterly, 7 Half Year, 8 Yearly
Bill Manager
optin_biller($email, $reminders = 1)
Opts a business into Bill Manager.
optin_update($email, $reminders = 1)
Updates Bill Manager onboarding details. php
single_invoice($reference, $billedfullname, $billedphoneNumber, $billedperiod, $invoiceName, $dueDate, $accountRef, $amount)
Creates and sends a single e-invoice.
bulk_invoicing($invoiceArray)
Creates and sends multiple invoices at once. `
$mpesa->reconciliation($payment_date, $paidAmmount, $actReference, $transactionId, $phoneNumber, $fullName, $invoiceName, $reference)
Reconciles a payment against an invoice.
$mpesa->update_invoice_data($payment_date, $paidAmmount, $actReference, $transactionId, $phoneNumber, $fullName, $invoiceName, $reference)
Updates existing invoice data.
$mpesa->cancel_single_invoice($reference)
Cancels a single invoice using its external reference.