shoket/php-shoket

Shoket 是 Shoket 支付 API 的 PHP 客户端。

v0.0.5 2022-05-25 09:14 UTC

README

Latest Version on Packagist Tests Total Downloads

为您的企业提供真正简单的支付方式。Shoket 使坦桑尼亚的所有类型的企业在线支付变得更简单。从初创公司、小型企业到中大型企业。

文档

您可以在 Docs 上找到此包的文档

安装

需要 PHP 8.0 或更高版本

对于 Laravel 用户,有一个专门的集成包 laravel-shoket

您可以通过 composer 安装此包

composer require shoket/php-shoket

用法

// Create a new instance of the client
$shoket = new Shoket(['apiSecret' => 'your-api-key']);

// Make a payment request
$response = $shoket->makePaymentRequest([
    "amount" => "5000",
    "customer_name" => "John Doe",
    "email" => "john@user.com",
    "number_used" => "255612345678",
    "channel" => "Tigo",
]);

// Print the response
print_r($response);

API 可用

  • makePaymentRequest
  • verifyPayment

制作支付请求 API

示例

// Create a new instance of the client
$shoket = new Shoket(['apiSecret' => 'your-api-key']);

// Make a payment request
$response = $shoket->makePaymentRequest([
    "amount" => "5000",
    "customer_name" => "John Doe",
    "email" => "john@user.com",
    "number_used" => "255612345678",
    "channel" => "Tigo",
]);

// Print the response
var_dump($response);

verifyPayment API

示例

$shoketClient = new Shoket(['apiSecret' => 'your-api-key']);

// Get the payment reference from the a successful payment request
// Sample: adz49dS428b7kbDTdG4MN
$reference = 'your-reference-number'; 

$response  = $shoketClient->verifyPaymentRequest($reference,[
    "provider_name"=> "Vodacom",
    "provider_code"=> "MPESA"
]);

var_dump($response);

测试

使用 Pest 测试框架

composer test

变更日志

请查看 CHANGELOG 了解最近更改的详细信息。

贡献

请查看 CONTRIBUTING 了解详细信息。

安全漏洞

请查看 我们的安全策略 了解如何报告安全漏洞。

致谢

许可协议

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