Download the PHP package alkhatibdev/laravel-zain without Composer
On this page you can find all versions of the php package alkhatibdev/laravel-zain. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download alkhatibdev/laravel-zain
More information about alkhatibdev/laravel-zain
Files in alkhatibdev/laravel-zain
Package laravel-zain
Short Description Zain DSP API integration
License MIT
Homepage https://github.com/alkhatibdev/laravel-zain
Informations about the package laravel-zain
Zain DSP API integration with Laravel
Introduction
Laravel Zain is Zain DSP API integration with Laravel, made to simplify the process and API calls and let developers focus on other integration parts and logic. See also Laravel Sudani.
Installation
Requirements
- PHP >=
7.4.x
- Laravel >=
7.x
install via composer
Publish Configs
A laravel-zain.php
config file will be published on your configs
directory, with the following content:
Don't forget to set all these variable on your .env
file
Usage
Initial Payment/Subscription
When initiate
payment request successfully sent, a SMS with OTP
code will be send to the $phone
number, and $response
will contain a subscribe_request_id
and you should save it to the next step verify
.
Verify Payment/Subscription
Check Subscription
Unsubscribe
Login and Cache DSP token
Out of the box the package will login automatically and get the token
and use it for each action initiate
, verify
..etc per request.
If you want to cache the token and use it for furthor requests, you can request token
like this:
And you can cache it and use it for each request for the next 24 hours.
If you set ZAIN_REMEMBER_TOKEN=true
token will be expired after 30 days.
Example of using cached token:
Logging
You can enable logging from package config file
Other Packages
-
Laravel Sudani SPay API Integration
License
Laravel Zain is open-sourced software licensed under the MIT license.