chadrackkanza / flexpay
Package FlexPay API
1.3
2024-03-04 21:58 UTC
Requires
- php: ^8.0
- illuminate/contracts: ^9.0
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.9
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^8.0
- pestphp/pest: ^2.0
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- spatie/laravel-ray: ^1.26
README
For Laravel 9 and 10
Installation
You can install the package via composer:
composer require chadrackkanza/flexpay
You can publish the config file with:
php artisan vendor:publish --tag="flexpay-config"
This is the contents of the published config file:
return [ 'token' => env('FLEXPAY_TOKEN'), 'merchant' => env('FLEXPAY_MERCHANT'), 'url_api' => env('FLEXPAY_URL_API','https://backend.flexpay.cd'), 'url_api_card' => env('FLEXPAY_URL_API_CARD','https://cardpayment.flexpay.cd'), 'url_c2b' => env('FLEXPAY_URL_C2B','/api/rest/v1/paymentService'), 'url_b2c' => env('FLEXPAY_URL_B2C','/api/rest/v1/merchantPayOutService'), 'url_card' => env('FLEXPAY_URL_CARD','/api/rest/v1/vpos/ask'), 'url_check_transaction' => env('FLEXPAY_URL_CHECK','/api/rest/v1/check'), 'url_get_order_number' => env('FLEXPAY_URL_GET_ORDER_NUMBER','/api/rest/v1/vpos/orderNumber'), ];
Usage
Add these lines in your .env file
FLEXPAY_TOKEN="YOUR_FLEXPAY_TOKEN" FLEXPAY_MERCHANT="YOUR_FLEXPAY_MERCHANT" FLEXPAY_URL_API="FLEXPAY_URL_API" FLEXPAY_URL_API_CARD="FLEXPAY_URL_API_CARD"
Payment consumer to business
use chadrackkanza\Flexpay\Facades\Flexpay; $response = Flexpay::c2b( "TEST0014521", // reference '243XXXXXXXXX', //phoneNumber '1500', //amount 'cdf', //currency 'https://mon-site.com', //callbackUrl 1 //commission ); dd($response);
Payment business to consumer
use chadrackkanza\Flexpay\Facades\Flexpay; $response = Flexpay::b2c( "TEST0014521", // reference '243XXXXXXXXX', //phoneNumber '1500', //amount 'cdf', //currency 'https://mon-site.com', //callbackUrl 1 //commission ); dd($response);
Check the status of a payment request sent to FlexPay
use chadrackkanza\Flexpay\Facades\Flexpay; $response = Flexpay::checkTransaction('YOUR_ORDER_NUMBER'); dd($response);
Payment ( e-money, qr-code and card)
use chadrackkanza\Flexpay\Facades\Flexpay; $response = Flexpay::payment( "TEST0014521", // reference "Tests de paiement", // description 10, // amount "USD", // currency "https://mon-site.com/callback.com", // callback_url "https://mon-site.com/approve.com", //approve_url "https://mon-site.com/cancel.com", // cancel_url "https://mon-site.com/decline.com", // decline_url "https://mon-site.com" // home_url ); dd($response);
Check the status of a payment ( e-money, qr-code and card) request sent to FlexPay
use chadrackkanza\Flexpay\Facades\Flexpay; $response = Flexpay::getOrderNumber('YOUR_ORDER_NUMBER'); dd($response);