jesuferanmi / php-monicredit
Monicredit Rest API php library
Requires
- guzzlehttp/guzzle: ^7.8
- vlucas/phpdotenv: ^5.6
Requires (Dev)
- phpunit/phpunit: ^10.5
This package is auto-updated.
Last update: 2025-04-29 01:24:33 UTC
README
About | Requirements | Usage | Contribution | License | Author
🎯 About
PHP Library for Monicredit API
✅ Requirements
Before starting 🏁, you need to have Git and PHP 7+ installed.
🏁 Usage
# Installation
$ composer require jesuferanmi/php-monicredit
ENV Configuration
Open your .env file and add your demo public key, live public key, demo private key, live private key, monicredit live and demo base url(You will find this in the api documentation. An example of the base url is: https://baseURL/api/) and monicredit environment('DEMO' or 'LIVE') like this:
MONICREDIT_DEMO_PUBLIC_KEY="" MONICREDIT_DEMO_PRIVATE_KEY="" MONICREDIT_LIVE_PUBLIC_KEY="" MONICREDIT_LIVE_PRIVATE_KEY="" MONICREDIT_ENVIRONMENT="DEMO" MONICREDIT_DEMO_BASEURL="" MONICREDIT_LIVE_BASEURL=""
If you are using a hosting service like heroku, ensure to add the above details to your configuration variables.
#Usage
- Initiate Transaction
$monicredit = new Monicredit(); $customer = [ 'first_name' => 'Olasunkanmi', 'last_name' => 'Feranmi', 'email' => 'feranmiolasunkanmi91@gmail.com', 'phone' => '0000000002' ]; $splitDetails = [ 'sub_account_code' => 'SB0000000', 'fee_percentage' => 100, 'fee_flat' => 0 ]; $itemDetails = [ "item" => 'Test Transaction', "revenue_head_code" => 'REV0000000', "unit_cost" => '300', "split_details" => array($splitDetails), ]; $payload = [ 'order_id' => rand(1000, 9000), 'customer' => $customer, 'items' => [$itemDetails], 'feeBearer' => 'merchant' ]; $initiate = $monicredit->intiateTransaction($payload);
- Verify Transaction
$monicredit = new Monicredit(); $payload = ["transaction_id" => "ACX000000"]; $verify = $monicredit->verifyTransaction($payload);
- Get Transaction Info
$monicredit = new Monicredit(); $payload = "ACX000000"; $response = $monicredit->getInitiatedTransactionInfo();
🔨 Countribution
# fork and Clone the fork project # Access the folder $ cd monicredit-php # Install dependencies $ composer Install # Create .env and update $ cp .env.example .env # Run test $ vendor/bin/phpunit tests
📝 License
This project is under license from MIT. For more details, see the LICENSE file.
Made with ❤️ by Emmanuel Jesuferanmi
Todo:
- Update Readme with Usage