Download the PHP package donsoft/smartpay without Composer
On this page you can find all versions of the php package donsoft/smartpay. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download donsoft/smartpay
More information about donsoft/smartpay
Files in donsoft/smartpay
Package smartpay
Short Description A Laravel package to intelligently route payment transactions.
License MIT
Informations about the package smartpay
Donsoft SmartPay
Donsoft SmartPay is a Laravel package that intelligently routes payment transactions to the most suitable payment processor based on configurable factors such as transaction cost, reliability, and currency support.
Features
- Multiple Payment Processor Support: Supports different payment processors with configurable parameters.
- Intelligent Routing: Routes transactions to the best processor based on defined priorities (cost, reliability, currency support).
- Customizable: Easily add new processors or modify existing ones.
- Extensible: Allows developers to extend processors and define custom behavior.
Installation
1. Install the package via Composer:
2. Publish the configuration file:
This will create a config/smartpay.php
file where you can configure your payment processors, priorities, and default settings.
3. Add Service Provider (for Laravel versions below 5.5):
If you’re using a Laravel version below 5.5, add the following service provider to your config/app.php
:
Configuration
The configuration file smartpay.php
allows you to define supported payment processors, the priority of routing factors, and more. Example configuration:
Usage
This is how to use Donsoft SmartPay in your Laravel project:
1. Inject the Payment Router into a Controller
You can inject the PaymentRouter service into your controller and use it to route transactions to the appropriate processor.
2. Example Request to Process Payment:
This will route the payment to the best processor based on the configuration and transaction details.
Extending the Processor
You can add custom payment processors by extending the base processor class (BaseProcessor.php
) and adding it to the configuration.
Step 1: Create Your Custom Processor
Step 2: Add Your Processor to the Configuration
Now, CustomProcessor will be included in the intelligent routing when a payment is processed.
Customizing the Configuration
You can adjust the priorities and processors directly in the smartpay.php
config file:
-
Priorities: Adjust the weight of each factor in the routing decision (currency support, reliability, transaction cost).
- Processors: Define new or existing payment processors and their configurations (cost per transaction, supported currencies, minimum transaction amounts).
Running Tests
The package includes tests to verify its functionality. To run the tests:
Make sure your test classes are under the tests/
directory.
License
This package is open-source software licensed under the MIT license.
Conclusion
This Donsoft SmartPay package provides a flexible, customizable solution for routing payment transactions in Laravel applications. By allowing easy configuration and extensibility, developers can adapt it to suit their specific business logic and requirements.
If you have any questions or need support, feel free to reach out to the author