{"id":36238316,"url":"https://github.com/php-monsters/laravel-online-payment","last_synced_at":"2026-01-13T21:44:14.681Z","repository":{"id":45854017,"uuid":"117153826","full_name":"php-monsters/laravel-online-payment","owner":"php-monsters","description":"Online payment component for Laravel 5+ which supports all Iranian payment gateways","archived":false,"fork":false,"pushed_at":"2025-08-11T10:41:03.000Z","size":312,"stargazers_count":80,"open_issues_count":4,"forks_count":32,"subscribers_count":5,"default_branch":"master","last_synced_at":"2026-01-11T11:44:04.480Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://banktest.ir","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/php-monsters.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-01-11T21:09:15.000Z","updated_at":"2025-08-11T10:40:16.000Z","dependencies_parsed_at":"2025-07-09T20:01:36.816Z","dependency_job_id":"41b23341-b243-41ae-b478-de7d01f848b5","html_url":"https://github.com/php-monsters/laravel-online-payment","commit_stats":null,"previous_names":[],"tags_count":65,"template":false,"template_full_name":null,"purl":"pkg:github/php-monsters/laravel-online-payment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-monsters%2Flaravel-online-payment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-monsters%2Flaravel-online-payment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-monsters%2Flaravel-online-payment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-monsters%2Flaravel-online-payment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php-monsters","download_url":"https://codeload.github.com/php-monsters/laravel-online-payment/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-monsters%2Flaravel-online-payment/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28401049,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-11T06:05:50.171Z","updated_at":"2026-01-13T21:44:14.676Z","avatar_url":"https://github.com/php-monsters.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Iranian Online Payment Component\nOnline Payment Module handler for Laravel 5+ known as LaraPay component completely compatible with [BankTest](http://banktest.ir) sandbox.\nLarapay integrated all Iranian payment gateways into one component. \n\nHere are a few short examples of what you can do:\n* create new transaction form your order model and generate bank form\n```php\n $transaction = $order-\u003ecreateTransaction(Bank::MELLAT);\n $form = $transaction-\u003egenerateForm();\n```\n* handle gateway callback (verify/settle/...)\n```php\n $transaction = Larapay::verifyTransaction($request);\n //if the gateway supports reverse method\n $transaction-\u003ereverseTransaction();\n $order = $transaction-\u003emodel;\n```\n* get order transaction information\n```php\n $allTransactions = $order-\u003etransations;\n $accomplishedTransactions = $order-\u003eaccomplishedTransactions;\n $isPaid = $order-\u003eisPaid();\n $paidAmount = $order-\u003epaidAmount();\n```\n\n## Currenctly supports:\n\n- Mellat Bank Gateway - درگاه بانک ملت لاراول\n- Saman Bank Gateway - درگاه بانک سامان لاراول\n- Saderat/Sepehr Pay Bank Gateway - درگاه بانک صادرات / سپهر\n- Pasargad Bank Gateway - درگاه بانک پاسارگاد لاراول\n- Parsian Bank Gateway - درگاه بانک پارسیان لاراول\n- Melli/Sadad Bank Gateway (Sadad) - درگاه بانک ملی / سداد لاراول\n- Pay.ir Gateway / درگاه پرداخت پی\n- Zarinpal Gateway / درگاه پرداخت زرین پال\n- IDPay Gateway / درگاه آیدی پی\n- Zibal Gateway / درگاه زیبال\n- nextpay Gateway / درگاه نکست پی\n\n- ...\n- Other gateways, coming soon... لطفا شما هم در تکمیل پکیج مشارکت کنید\n\n#### But what is B‌anktest sandbox?\n- [BankTest](http://banktest.ir) is a sandbox service for all Iranian online payment gateways\n- [بانک تست](http://banktest.ir) یک سرویس شبیه ساز درگاه های پرداخت آنلاین ایرانی برای اهداف توسعه و تست نرم افزار می باشد\n\n\n## Requirements\nLarapay Version 6+ required PHP 7+\n\n## Installation\n1. Installing via composer\n\n```bash\ncomposer require php-monsters/laravel-online-payment\n```\n2. Add package service provider to your app service providers (only for Laravel \u003c 5.5):\n\n```php\nPhpMonsters\\Larapay\\LarapayServiceProvider::class,\nPhpMonsters\\Log\\XLogServiceProvider::class,\n```\n3. Add package alias to your app aliases (only for Laravel \u003c 5.5):\n\n```php\n'Larapay' =\u003e PhpMonsters\\Larapay\\Facades\\Larapay::class,\n'XLog'    =\u003e PhpMonsters\\Log\\Facades\\XLog::class,\n```\n4. Publish package assets and configs\n\n```bash\nphp artisan vendor:publish --provider=\"PhpMonsters\\Larapay\\LarapayServiceProvider\"\n```\n\n5. Run migration\n```bash\nphp artisan migrate\n```\n\n## Configuration\nIf you complete installation step correctly, you can find Larapay config file as larapay.php in you project config file.\n\nFor sandbox (banktest) you should set `LARAPAY_MODE=development` in your .env file otherwise set `LARAPAY_MODE=production`\n\nIf you choose development mode, Larapay use banktest.ir as its payment gateway.\n\nSet your gateway(s) configs in your .env file. Here are some example:\n```ini\nLARAPAY_MODE=development\n\nSAMAN_MERCHANT_ID=bmcf****\nSAMAN_MERCHANT_PASS=98221***\n\nMELLAT_USERNAME=user***\nMELLAT_PASSWORD=80714***\nMELLAT_TERMINAL_ID=747\n```\n\n### Setup callback route\nyou should create a route for handling callback from bank and set your route name in .env\n\nFor example create a POST route in routes folder, web.php like this:\n```php\nRoute::post('payment/callback', 'YourController@handleCallback')-\u003ename('payment.callback');\n```\n\n`NOTE: SOME GATEWAYS MAY USE GET METHOD FOR CALLBACK (like Zarinpal)`\n\nthen set the route name in .env file:\n\n```ini\nLARAPAY_PAYMENT_CALLBACK=payment.callback\n```\n\nremember to add callback route to except array of validateCsrfToken\n\nadd this in `withMiddleware` section in `bootstrap/app.php` :\n```php\n$middleware-\u003evalidateCsrfTokens(except: [\n    'payment/*',\n]);\n```\n\n\n## Usage\n\n### Prepare payable model\n\nUse `Payable` trait in your order model or any other model like user which will get payment feature and implement it.\n\nYou can impalement getAmount() method to return `Iranian Rail` amount of your model.\n```php\nuse PhpMonsters\\Larapay\\Payable;\n\nclass Order extends Model \n{\n    use Payable;\n\n    public function getAmount(){\n        return intval($this-\u003eamount) * 10;\n    }   \n\n}\n```\n\nNow you just have 3 steps to complete your payment:\n\n### 1- create transaction\n\nIn your bank controller create a transaction for your order and generate bank for to transfer user to payment gateway.\n```php\nuse PhpMonsters\\Larapay\\Models\\Enum\\Bank;\n\nclass BankController extends Controller\n{\n    public function index()\n    {\n        //your logic and prepare your order\n        // ...\n\n        //if you implement getAmount() method you can set amount to null\n        $amount = 1200000;  //Rial at least 1000 \n        //order or user description\n        $description = 'I pay my order with Larapay \u003c3';\n        //some additional data that you need store on transaction\n        $additionalData = [];\n        //create transaction \n        $transaction = $order-\u003ecreateTransaction(Bank::MELLAT, $amount, $description, $additionalData);\n        \n        //auto submit bank form and transfer user to gateway\n        $autoSubmit = true;\n        //callback route name. if you set it on your .env file you can set this to null\n        $callbackRouteName = 'payment.callback';\n        //adapter config\n        $adapterConfig = [];\n        //generate bank form\n        $form = $transaction-\u003egenerateForm($autoSubmit, $callbackRouteName, $adapterConfig);\n        \n        return view('go-to-bank',[\n            'form' =\u003e $form,\n        ]);\n    }\n}\n```\n\n### 2- show bank transfer form\n\nNow you can show you `$form` in your `go-to-bank` view file:\n```php\n\u003cdiv\u003e\n    {!! $form !!}\n\u003c/div\u003e\n```\n\nYou can modify bank forms in:\n```\nresources/views/vendor/larapy\n```\n\n### 3- handle callback\n\nAfter payment, bank call you callback route\n\n```php\nuse Illuminate\\Http\\Request;\nuse PhpMonsters\\Larapay\\Facades\\Larapay;\n\nclass YourController extends Controller\n{\n    public function handleCallback(Request $request)\n    {\n         try{\n            $adapterConfig = [];\n            $transaction = Larapay::verifyTransaction($request, $adapterConfig);\n            $order = $transaction-\u003emodel;\n            //transaction done. payment is successful         \n         } catch (\\Exception $e){\n            // transaction not complete!!!\n            // show error to your user\n         }\n    }\n}\n```\n\nIf you want to revers transaction and your bank support it, you can do this way:\n```php\n$transaction-\u003ereverseTransaction();\n```\n\n## Methods\n\n### Methods available in `Paybel` trait and your order model:\n \n* `$order-\u003etransactions` : get all transactions of this model\n* `$order-\u003eaccomplishedTransactions`: get all accomplished transactions\n* `$order-\u003eisPaid()`: return true if this model has at least one accomplished transaction\n* `$order-\u003epaidAmount()`: return sum of accomplished transactions amount in Rial\n* `$order-\u003ecreateTransaction(\n                   $paymentGateway,\n                   $amount = null,\n                   $description = null,\n                   array $additionalData = []\n               )`:  create a transaction.\n\n\n### Methods available in `LarapayTransaction`  model:\n\n* `$transaction-\u003emodel`: return the model that create this transaction. for example `$order`\n* `$transaction-\u003ereverseTransaction()`: reverse transaction and get back money to user. (if bank support reverse transaction)\n* `$transaction-\u003egenerateForm($autoSubmit = false, $callback = null)`: generate bank transfer form\n* `$transaction-\u003egatewayHandler()`: get gatewayHandler for advance use.\n\n### Fields available in `LarapayTransaction`  model:\n* `id`\n* `created_at`\n* `updated_at`\n\nStatus in boolean:\n* `accomplished`\n* `verified`\n* `after_verified`\n* `reversed`\n* `submitted`\n* `approved`\n* `rejected`\n\n Gate information:\n * `payment_method`\n * `bank_order_id`\n * `gate_name`\n * `gate_refid`\n * `gate_status`\n * `extra_params`\n * `additional_data`\n \n Order information:\n * `amount`\n * `description`\n * `paid_at`\n\n\n## LarapayTransaction\n\nYou can use `LarapayTransaction` model to find your transaction:\n\n```php\nuse PhpMonsters\\Larapay\\Models\\LarapayTransaction;\n\npublic function getTransaction($transactionId){\n\n    //find single transaction by transaction id\n    $transaction = LarapayTransaction::find($transactionId);\n    \n    //get all accomplished transaction\n    $accomplishedTransactions = LarapayTransaction::where('accomplished',true)-\u003eget();\n    \n    //get all reversed transaction\n    $reversedTransactions = LarapayTransaction::where('reversed',true)-\u003eget();\n}\n```\n\nThis class use SoftDeletes. you can call delete() on your transaction model to softDelete it or forceDelete() to truly remove it from your database.\n\n## Security\n\nIf you discover any security related issues, please email a6oozar@gmail.com or milad.kian@gmail.com instead of using the issue tracker.\n\n## Team\n\nThis component is developed by the following person(s) and a bunch of [awesome contributors](https://github.com/php-monsters/laravel-online-payment/graphs/contributors).\n\n[![Aboozar Ghaffari](https://avatars2.githubusercontent.com/u/502961?v=3\u0026s=130)](https://github.com/samuraee) | [![Milad Kianmehr](https://avatars3.githubusercontent.com/u/4578704?v=3\u0026s=130)](https://github.com/miladkian) | [![Sina Miandashti](https://avatars3.githubusercontent.com/u/195868?v=3\u0026s=130)](https://github.com/sinamiandashti) | [![XShaan](https://avatars3.githubusercontent.com/u/4527899?v=3\u0026s=130)](https://github.com/xshaan)\n| --- | --- | --- | --- |\n[Aboozar Ghaffari](https://github.com/samuraee) | [Milad Kianmehr](https://github.com/miladkian) | [Sina Miandashti](https://github.com/sinamiandashti) | [XShaan](https://github.com/xshaan)\n\n\n## Support This Project\n\nPlease contribute in package completion. This is the best support.\n\n## License\n\nThe Laravel Online Payment Module is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)\n \n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-monsters%2Flaravel-online-payment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp-monsters%2Flaravel-online-payment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-monsters%2Flaravel-online-payment/lists"}