https://github.com/alphaolomi/php-shoket
Shoket Client for PHP
https://github.com/alphaolomi/php-shoket
mobile-money payment-api payments php php-shoket
Last synced: 8 months ago
JSON representation
Shoket Client for PHP
- Host: GitHub
- URL: https://github.com/alphaolomi/php-shoket
- Owner: alphaolomi
- License: mit
- Created: 2022-02-12T08:01:50.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-10-23T19:43:46.000Z (over 2 years ago)
- Last Synced: 2025-05-02T08:46:13.749Z (about 1 year ago)
- Topics: mobile-money, payment-api, payments, php, php-shoket
- Language: PHP
- Homepage: https://alphaolomi.github.io/php-shoket/
- Size: 43 KB
- Stars: 4
- Watchers: 0
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
# Shoket Client for PHP
[](https://packagist.org/packages/shoket/php-shoket)
[](https://github.com/alphaolomi/php-shoket/actions/workflows/run-tests.yml)
[](https://packagist.org/packages/shoket/php-shoket)
A Truly simple payments for your business. Shoket makes online payments more easier for all kind of business in Tanzania. From startups, small businesses to medium and large businesses.
## Documentation
You can find the documentation for this package on [Docs](https://alphaolomi.github.io/php-shoket/)
## Installation
> Requires PHP 8.0 or higher
> For Laravel users there is a dedicated intergration package [laravel-shoket](https://github.com/alphaolomi/laravel-shoket)
You can install the package via composer:
```bash
composer require shoket/php-shoket
```
## Usage
```php
// 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 Available
- makePaymentRequest
- verifyPayment
## Make payment request API
Example
```php
// 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
Example
```php
$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);
```
## Testing
Uses [Pest Testing Framework](https://pestphp.com/)
```bash
composer test
```
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.
## Security Vulnerabilities
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
## Credits
- [Alpha Olomi](https://github.com/alphaolomi)
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.