Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/prinx/payswitch-momo-php
Payswitch Mobile Money PHP SDK
https://github.com/prinx/payswitch-momo-php
Last synced: 15 days ago
JSON representation
Payswitch Mobile Money PHP SDK
- Host: GitHub
- URL: https://github.com/prinx/payswitch-momo-php
- Owner: prinx
- License: mit
- Created: 2021-04-18T13:37:08.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-05-18T11:27:42.000Z (over 3 years ago)
- Last Synced: 2024-12-02T02:49:31.535Z (about 1 month ago)
- Language: PHP
- Size: 105 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PAYSWITCH MOBILE MONEY PHP SDK
## Work In Progress
## Installation
```shell
composer require prinx/payswitch-momo
```## Usage
### Configuration in `.env` file (in the project root folder)
```ini
# .env filePAYSWITCH_MOMO_API_ENV=test|prod
PAYSWITCH_MOMO_API_USER=
PAYSWITCH_MOMO_API_KEY=
PAYSWITCH_MOMO_API_MERCHANT_ID=
PAYSWITCH_MOMO_API_PROCESSING_CODE="000200"
PAYSWITCH_MOMO_API_DESCRIPTION="At least 10 characters"PAYSWITCH_MOMO_LOG_ENABLED=true|false
PAYSWITCH_MOMO_LOCAL_LOG_ENABLED=true|false
```> Make sure the value for `PAYSWITCH_MOMO_API_PROCESSING_CODE` and `PAYSWITCH_MOMO_API_KEY` are enclosed with double quotes.
### Making a payment request
```php
use Prinx\Payswitch\MobileMoney;
$momo = new MobileMoney;
$amount = 1; // 1 cedi
$phone = '233...';
$network = ''; // Must be one of MTN|VODAFONE|AIRTEL$response = $momo->pay($amount, $phone, $network);
if ($response->isSuccessful()) {
// User successfully payed
} else {
$error = $response->getError();
}
```### Voucher code for Vodafone users
_Vodafone_ users always generate a voucher code to be able to process their mobile money transactions. After getting the voucher code from the user, you can easily pass it argument of the `pay` method:
```php
// ...$response = $momo->pay($amount, $phone, $network, $voucherCode);
```## License
[MIT](LICENSE)