Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/saeedvaziry/payir
https://github.com/saeedvaziry/payir
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/saeedvaziry/payir
- Owner: saeedvaziry
- Created: 2019-08-15T12:09:48.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-05-29T09:50:38.000Z (over 2 years ago)
- Last Synced: 2024-05-02T05:15:25.576Z (6 months ago)
- Language: PHP
- Homepage: https://github.com/paydotir/php-sdk
- Size: 12.7 KB
- Stars: 7
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
**⚠️ This repository is archived and is not maintained anymore.**
Please consider using [Pay.ir PHP SDK](https://github.com/paydotir/php-sdk) instead
# Pay.ir Laravel
Laravel package to connect to Pay.ir Payment Gateway
## Installation
`composer require saeedvaziry/payir`
## Publish Configurations
`php artisan vendor:publish --provider="SaeedVaziry\Payir\PayirServiceProvider"`
## Config
Set your api key and redirect url in `.env` file:
PAYIR_API_KEY=test
PAYIR_REDIRECT=/payir/callback
## Usage### Payment Controller
amount = 1000; // Required, Amount
$payir->factorNumber = 'Factor-Number'; // Optional
$payir->description = 'Some Description'; // Optional
$payir->mobile = '0912XXXXXXX'; // Optional, If you want to show user's saved card numbers in gateway
$payir->validCardNumber = '6219860000000000'; // Optional, If you want to limit the payable card
try {
$payir->send();
return redirect($payir->paymentUrl);
} catch (SendException $e) {
throw $e;
}
}
public function verify(Request $request)
{
$payir = new PayirPG();
$payir->token = $request->token; // Pay.ir returns this token to your redirect url
try {
$verify = $payir->verify(); // returns verify result from pay.ir like (transId, cardNumber, ...)
dd($verify);
} catch (VerifyException $e) {
throw $e;
}
}
}### Routes
Route::get('/payir/callback', 'PaymentController@verify');
## Usage with facadeConfig `aliases` in `config/app.php` :
'Payir' => SaeedVaziry\Payir\Facades\Payir::class
*Send*Payir::send($amount, $redirect = null, $factorNumber = null, $mobile = null, $description = null);
*Send2*Alternatively, You can use `send2` method in facade to send optional data to Pay.ir
Payir::send2([
'amount' => 10000,
'redirect' => 'Your-Redirect-Url', // optional
'factorNumber' => 'The-Factor-Number', // optional
'mobile' => 'Mobile-Number', // optional
'api' => 'API-Key', // optional, If you don't send this the package will read this from env
'description' => 'Your-Description', // optional
'validCardNumber' => 'Valid-Card-Number' // optional
]);*Verify*
Payir::verify($token);
## Security
If you discover any security related issues, please create an issue or email me ([email protected])
## LicenseThis repo is open-sourced software licensed under the MIT license.