humayunjavaid / laravel-payzen
A simple package to generate Payzen PSID.
v1.0.0
2023-09-04 07:00 UTC
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.8
- illuminate/contracts: ^10.0
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.8
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^8.8
- 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
This package is auto-updated.
Last update: 2024-11-09 09:53:30 UTC
README
Streamline Payzen payment integration in Laravel. Generate Payment Service Identifiers (PSIDs) for P2G, P2P, B2G, and B2B payments with ease.
Installation
You can install the package via composer:
composer require humayunjavaid/laravel-payzen
Set Up Environment
Check your .env
file, and ensure that your following parameters are set with valid credentials obtained from Payzen.
PAYZEN_CLIENT_ID =
PAYZEN_CLIENT_SECRET_KEY =
PAYZEN_AUTH_URL = (Optional)
PAYZEN_PSID_URL = (Optional)
Optionally you can publish the config file with:
php artisan vendor:publish --tag="laravel-payzen-config"
This is the contents of the published config file:
return [ 'clientId' => env('PAYZEN_CLIENT_ID'), 'clientSecretKey' => env('PAYZEN_CLIENT_SECRET_KEY'), 'authUrl' => env('PAYZEN_AUTH_URL'), 'psidUrl' => env('PAYZEN_PSID_URL'), ];
Usage
Generate PSID method will return Illuminate\Http\Client\Response
instance. That mean's, you have access to following methods.
$response->body() : string; $response->json() : array|mixed; $response->collect() : Illuminate\Support\Collection; $response->status() : int; $response->ok() : bool; $response->successful() : bool; $response->failed() : bool; $response->serverError() : bool; $response->clientError() : bool; $response->header($header) : string; $response->headers() : array;
Generate PSID
Payzen::setConsumerName('Dummy User') ->setCnic('123456789') ->setEmail('dummyuser@email.com') ->setMobileNumber('3324232321') ->setChallanNumber('2323232323') ->setServiceId('12') ->setAccountNumber('32323') ->setAccountTitle('Bibi Pak Damin') ->setDueDate('2023-08-29') ->setExpiryDate('2023-08-29') ->setAmountWithinDueDate(500) ->setAmountAfterDueDate(500) ->generate();
Credits
License
The MIT License (MIT). Please see License File for more information.