1. Go to this page and download the library: Download malipopay/laravel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
malipopay / laravel example snippets
use Malipopay\Laravel\Facades\Malipopay;
$payment = Malipopay::collect([
'description' => 'Order #1234',
'amount' => 10000,
'phoneNumber' => '255712345678',
]);
// $payment is an Eloquent MalipopayPayment model — already saved in your DB
echo $payment->reference;
echo $payment->status;
echo $payment->link;
// app/Providers/EventServiceProvider.php
use Malipopay\Laravel\Events\PaymentCompleted;
use Malipopay\Laravel\Events\PaymentFailed;
use App\Listeners\FulfillOrder;
protected $listen = [
PaymentCompleted::class => [FulfillOrder::class],
PaymentFailed::class => [NotifyCustomerPaymentFailed::class],
];
use Malipopay\Laravel\Events\PaymentCompleted;
class FulfillOrder
{
public function handle(PaymentCompleted $event): void
{
$payment = $event->payment; // MalipopayPayment model
// update your order, send confirmation email, etc.
}
}
use Malipopay\Laravel\Models\MalipopayPayment;
$pending = MalipopayPayment::pending()->count();
$completed = MalipopayPayment::completed()->whereDate('created_at', today())->sum('amount');
$payment = MalipopayPayment::where('reference', 'PAY-123')->first();
if ($payment->isCompleted()) {
// ...
}
bash
php artisan malipopay:install
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.