https://github.com/hans-thomas/zarinpal
zarinpal package for laravel
https://github.com/hans-thomas/zarinpal
laravel laravel-package php zarinpal
Last synced: 6 months ago
JSON representation
zarinpal package for laravel
- Host: GitHub
- URL: https://github.com/hans-thomas/zarinpal
- Owner: hans-thomas
- License: gpl-2.0
- Created: 2020-12-15T11:15:06.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-05-02T15:01:02.000Z (about 5 years ago)
- Last Synced: 2025-09-07T16:53:08.265Z (10 months ago)
- Topics: laravel, laravel-package, php, zarinpal
- Language: PHP
- Homepage:
- Size: 20.5 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Zarinpal Package for laravel 8.x
transaction request library for zarinpal
## usage
### installation
``composer require hans-thomas/zarinpal``
## laravel ready
define these env variables in .env file
```php
merchantID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
sandbox=true
zarinGate=false
```
then add this to `config/services.php`
```php
'zarinpal' => [
'merchantID' => env( 'merchantID', 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX' ),
'zarinGate' => env( 'zarinGate', false ),
'sandbox' => env( 'sandbox', false ),
],
```
now you can access the zarinpal lib like this:
```php
use Zarinpal\Laravel\Facade\Zarinpal;
$results = Zarinpal::request(
"example.com/call_back", //call back url is required
1000, //amount is required
'testing', //description is required also
'metadata' => [
'me@example.com', // email is optional
'09000000000', //phone number is optional
]
);
// save $results['authority'] for verifying step
Zarinpal::redirect(); // redirect to zarinpal
// after that verify transaction by that $results['authority']
Zarinpal::verify(1000,$results['authority']);
```