patricmutwiri/pesapal

Pesapal Laravel 包;简化在 Laravel 中使用 pesapal 进行支付的过程。

v1.1.0 2024-08-09 18:08 UTC

This package is auto-updated.

Last update: 2024-09-10 12:49:43 UTC


README

Latest Version on Packagist Total Downloads GitHub Actions

本包旨在帮助您轻松与 Pesapal 集成。最终,您可以在应用程序中通过 Pesapal API v3.0 接收支付。

安装

您可以通过 composer 安装此包

composer require patricmutwiri/pesapal

用法

// Load your invoice from DB, like
$invoice = Invoice::find(1);
// Then use it below
$paymentReq = new Request([
    'amount' => $invoice->balance,
    'email' => $invoice->user->email,
    'phone' => $invoice->user->phone,
    'first_name' => explode(' ', $invoice->user->name)[0],
    'last_name' => explode(' ', $invoice->user->name)[1],
    'id' => sprintf("%s-%s", $invoice->invoice_number, date('YmdHis')),
]);

// you can pass ipn_id above from your DB, or let the service add the latest one for you.

return Pesapal::payNow($paymentReq);

测试

composer test

变更日志

有关最近更改的更多信息,请参阅变更日志

贡献

有关详细信息,请参阅贡献指南

安全

如果您发现任何安全相关的问题,请通过电子邮件dev@patric.xyz联系,并在问题跟踪器下记录。所有安全漏洞都将得到及时处理。请在修复宣布之前,不要公开严重的安全问题。

鸣谢

许可

MIT 许可证 (MIT)。有关更多信息,请参阅许可文件