This is a library to generate a pdf receipt for an mpesa transaction which can be sent as a link via sms or email to the customer.It can be integrated with the official safaricom/mpesa api.
MPESA RECEIPT API PHP
This is a library to generate a pdf receipt for an mpesa transaction which can be sent as a link via sms or email to the customer.It can be integrated with the official safaricom/mpesa api.
REQUIREMENTS
* PHP >=5.4.0
INSTALLATION
composer require isaacsichangi/mpesareceiptapi:1.0.0
HOW TO USE
require_once ('vendor/autoload.php');
//create mpesa receipt object
$mpesa = new MpesaReceiptGenerator("Bob Collymore", 3000, "0724XXXXXX", "MPJ54C33P", "Company XYZ", "
companyxyz.com");
try {
//generate receipt and return path of pdf receipt which can be sent as a link via sms or email message
$path = $mpesa->generateReceipt();
//view path
echo $path;
//handle exception
} catch (\Picqer\Barcode\Exceptions\BarcodeException $e) {
}
CREDITS
Isaac Sichangi - isaacsichangi@gmail.com
LIVE DEMO
Send 10ksh to MPESA till number 564305 to see a sample receipt