dotlines-io / ghoori
This is the core package for Ghoori Payment integration. Both for OnDemand and Subscription Payment Integration
1.0.9
2021-05-20 00:33 UTC
Requires
- php: ^7.4|^8.0
- ext-json: *
- dotlines-io/core: ~1.0.3
- guzzlehttp/guzzle: ^7.3
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpunit/phpunit: ^9.5
- roave/security-advisories: dev-latest
- vimeo/psalm: ^4.3
- vlucas/phpdotenv: ^5.3
README
This composer package can be used for Payment API Authentication & Authorization with Ghoori Platform. For the credentials, please contact with support@ghoori.com.bd or call 8809612332215
Installation
You can install the package via composer:
composer require dotlines-io/ghoori
Usage
/** * ****************************************************** * ******************* Token Fetching ******************* * *********** Contact Ghoori For Credentials *********** * ****************************************************** */ $tokenUrl = 'https://<SERVER_URL>/oauth/token'; $username = ''; $password = ''; $clientID = ''; $clientSecret = ''; $accessTokenRequest = \Dotlines\Ghoori\AccessTokenRequest::getInstance($tokenUrl, $username, $password, $clientID, $clientSecret); $tokenResponse = $accessTokenRequest->send(); echo json_encode($tokenResponse) . '<br/>'; /** * Access Token Request Response looks like below: * { * "token_type": "Bearer", * "expires_in": 3600, * "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdW.....", * "refresh_token": "def50200284b2371cad76b4d2a4e24746c44fd6a322....." * } */ /** * Access Token can be cached and reused for 1 hour * Before the end of accessToken lifetime every hour * you can use the refresh token to fetch new accessToken & refreshToken */ $accessToken = $tokenResponse['access_token']; $refreshToken = $tokenResponse['refresh_token']; /** * ****************************************************** * ******************* Refresh Token ******************* * ****************************************************** */ $refreshTokenRequest = \Dotlines\Ghoori\RefreshTokenRequest::getInstance($tokenUrl, $accessToken, $clientID, $clientSecret, $refreshToken); $tokenResponse = $refreshTokenRequest->send(); echo json_encode($tokenResponse) . '<br/>'; /** * Refresh Token Request Response looks like below: * { * "token_type": "Bearer", * "expires_in": 3600, * "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdW.....", * "refresh_token": "def50200284b2371cad76b4d2a4e24746c44fd6a322....." * } */
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.