{"id":41767191,"url":"https://github.com/abbasudo/laravel-zibal","last_synced_at":"2026-01-25T02:36:26.344Z","repository":{"id":45079740,"uuid":"402138408","full_name":"abbasudo/laravel-zibal","owner":"abbasudo","description":"transaction request library for zibal","archived":false,"fork":false,"pushed_at":"2022-03-24T16:09:17.000Z","size":19,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-11T07:18:59.169Z","etag":null,"topics":["laravel","payment","payment-gateway","php","transaction","zibal"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abbasudo.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}},"created_at":"2021-09-01T16:58:25.000Z","updated_at":"2022-01-10T12:29:56.000Z","dependencies_parsed_at":"2022-09-22T16:50:36.859Z","dependency_job_id":null,"html_url":"https://github.com/abbasudo/laravel-zibal","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/abbasudo/laravel-zibal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abbasudo%2Flaravel-zibal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abbasudo%2Flaravel-zibal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abbasudo%2Flaravel-zibal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abbasudo%2Flaravel-zibal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abbasudo","download_url":"https://codeload.github.com/abbasudo/laravel-zibal/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abbasudo%2Flaravel-zibal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28742545,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T01:40:51.112Z","status":"online","status_checked_at":"2026-01-25T02:00:06.841Z","response_time":113,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["laravel","payment","payment-gateway","php","transaction","zibal"],"created_at":"2026-01-25T02:36:26.253Z","updated_at":"2026-01-25T02:36:26.331Z","avatar_url":"https://github.com/abbasudo.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cbr /\u003e\n  \u003ca href=\"https://laravel.com\"\u003e\n    \u003cimg src=\"https://laravel.com/img/logomark.min.svg\" alt=\"Logo\" height=\"80\"\u003e\n  \u003c/a\u003e\n  \u003cimg src=\"https://img.icons8.com/material-outlined/96/000000/plus-math--v1.png\"/ height=\"30\"\u003e\n  \u003ca href=\"https://zibal.ir/\"\u003e\n    \u003cimg src=\"https://zibal.ir/static/media/logo-primary.68b6aace.svg\" alt=\"Logo\" height=\"80\"\u003e\n  \u003c/a\u003e\n\n  \n  \u003cbr /\u003e\n  \u003ch2 align=\"center\"\u003elaravel zibal\u003c/h2\u003e\n\n  \u003cp align=\"center\"\u003e\n    transaction request package for \u003ca href=\"https://zibal.ir/\"\u003ezibal\u003c/a\u003e\n    \u003cbr /\u003e\n  \u003c/p\u003e\n\u003c/p\u003e\n\n\n\n\n\n\n\u003c!-- GETTING STARTED --\u003e\n## Getting Started\n\nTo get a local copy up and running follow these simple steps.\n\n### Installation\n\n1. You can install the package via composer:\n   ```sh\n   composer require llabbasmkhll/laravel-zibal \n   ```\n   \nnote that you only need to do following steps if you want to change merchant id . if you only want to test the webservice , no need to do these steps\n\n2. publish config file to your project\n   ```sh\n   php artisan vendor:publish\n   ```\n3. change merchant value to your merchant id in config/zibal.php ( use `zibal` for testing )\n   ```php\n   return [\n         'merchant' =\u003e 'zibal',\n   ];\n   ```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\n\u003c!-- USAGE EXAMPLES --\u003e\n## Usage\n  \n  first include package facade into your file by :\n```php\nuse Llabbasmkhll\\LaravelZibal\\Facades\\Zibal;\n```\n\n\u003cbr /\u003e\n\naccording to zibals [official documentation](https://docs.zibal.ir/IPG/API)\nthere is 3 steps to issue a transaction in zibal\n\n### 1 . Request :\n  in this step zibal gets basic information about the transaction and returns `trackId` that is needed for next step \n\n\nuse this to init the transaction request :\n\n```php\n\n\nZibal::init(\n    1000000,            //required amount          - in rial\n    'redirect',         //required callback        - can be either route name or a valid url starting with http or https\n    ['key' =\u003e 'value'], //optional callback_params - will be passed to callback as query params , works only when route name passed to callback\n    'description',      //optional description     - additional data , good for various reports\n    123,                //optional orderId         - id of clients order (eg $invoice-\u003eid) , will be passed back to callback\n    '09366217515',      //optional mobile          - clients mobile number\n    ['000000000000']    //optional allowedCards    - array of allowed card numbers\n)-\u003egetResponse();\n\n\n```\nthis will return an array consist of `result` , `message` and `trackId`\n\n`result` represents the request status as below.\n| status | meaning    |\n|---------|---------------|\n| 100    | successful operation |\n| 102    | merchant not found |\n| 103    | merchant not active |\n| 104    | merchant not valid |\n| 201    | processed before |\n| 105    | amount must be grater than 1000 |\n| 106    | callbackUrl is not valid |\n| 113    | amount greater than maximum |\n\nyou can add `validate()` function after init like below :\n```php\n\nZibal::init( $amount, 'redirect')-\u003evalidate(404)-\u003egetResponse();\n\n```\n\nthis will redirect the user to 404 page if the result code was anything except 100. \n\n\u003cbr /\u003e\n  \n### 2 . Start :\n  redirect the user to zibals gateway for payment\n  use  :\n   ```php\n   Zibal::redirect($trackId);\n   ```\n   \n\u003cbr /\u003e\n\nyou may **combine** first and second step into one line of code like this :\n   ```php\n   Zibal::init( $amount, 'redirect')-\u003evalidate()-\u003eredirect();\n   ```\n   \n   that will init the transaction , then redirect the user zibals payment page if init was successful , otherwise it will redirect the user to 422 page\n   \n\u003cbr /\u003e\n  \n### 3 . Verify :\nyou can use this line of code to verify the transaction status:\n   ```php\n   Zibal::verify($trackId)-\u003evalidate()-\u003egetResponse();\n   ```\nthis will return an array consist of below parameters\n| parameter | discription    |\n|---------|---------------|\n| paidAt    | datetime of the payment |\n| cardNumber    | masked card number that used to pay |\n| status    | status of the payment (discribed below) |\n| amount    | amount of the payment |\n| refNumber    | payment reference number (in case of successful operation) |\n| description    | description of the payment  |\n| orderId    | the same id that you passed in init  |\n| result    | result of the request |\n| message    | short description of the request |\n\n\u003cbr /\u003e\n\n`result` represents the request status as below.\n| code | meaning    |\n|---------|---------------|\n| 100    | successful operation |\n| 102    | merchant not found |\n| 103    | merchant not active |\n| 104    | merchant not valid |\n| 201    | processed before |\n| 202    | payment failed (reason in status) |\n| 203    | invalid trackId |\n\n\u003cbr /\u003e\n\n`status` represents the request status as below.\n| status | meaning    |\n|---------|---------------|\n| -2    | internal failure |\n| -1    | wating for payment |\n| 1    | paid - verified |\n| 2    | paid - unverified |\n| 3    | canceled by user |\n| 4    | invalid card number |\n| 5    | not enough balance |\n| 6    | invalid code |\n| 7    | maximum request length reached |\n| 8    | maximum daily online payment number reached |\n| 9    | maximum daily online payment amount reached |\n| 10    | invalid card issuer |\n| 11    | switch error |\n| 12    | card unreachable |\n\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\n\u003c!-- EXAMPLES CONTROLLER --\u003e\n## Example Controller\n\n```php\n\n\u003c?php\n\nnamespace App\\Http\\Controllers\\Web;\n\nuse App\\Http\\Controllers\\Controller;\nuse App\\Models\\Invoice;\nuse Illuminate\\Http\\Request;\nuse Llabbasmkhll\\LaravelZibal\\Facades\\Zibal;\n\nclass GatewayController extends Controller\n{\n\n    /**\n     * redirect user to zibal.\n     *\n     * @param  \\Illuminate\\Http\\Request  $request\n     *\n     * @return \\Illuminate\\Contracts\\Foundation\\Application|\\Illuminate\\Http\\RedirectResponse|\\Illuminate\\Routing\\Redirector\n     */\n    public function show(Request $request)\n    {\n        $invoice = Invoice::find($request-\u003einput('invoice'));\n        $user    = $invoice-\u003euser()-\u003efirst();\n\n\n        return Zibal::init(\n            $invoice-\u003eamount,\n            'redirect',\n            [],\n            $user-\u003eid,\n            $invoice-\u003eid,\n            $user-\u003emobile,\n        )-\u003evalidate()-\u003eredirect();\n    }\n\n\n    /**\n     * validate the transaction.\n     *\n     * @return \\Illuminate\\Contracts\\Foundation\\Application|\\Illuminate\\Http\\RedirectResponse|\\Illuminate\\Routing\\Redirector\n     */\n    public function index(Request $request)\n    {\n        abort_unless($request-\u003ehas('trackId'), 422);\n\n        $response = Zibal::verify($request-\u003einput('trackId'))-\u003egetResponse();\n\n        if ($response['result'] == 100) {\n            $invoice = Invoice::find($response['orderId']);\n            $invoice-\u003eupdate(\n                [\n                    'status'       =\u003e 1,\n                    'bank_code'    =\u003e $response['refNumber'],\n                    'finalized_at' =\u003e now(),\n                ]\n            );\n        }\n\n        return redirect('panel');\n    }\n\n}\n\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\n\u003c!-- CONTRIBUTING --\u003e\n## Contributing\n\nContributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003c!-- LICENSE --\u003e\n## License\n\nDistributed under the MIT License. See `LICENSE` for more information.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003c!-- CONTACT --\u003e\n## Contact\n\nAbbas mkhzomi - [Telegram@llabbasmkhll](https://t.me/llabbasmkhll) - llabbasmkhll@gmail.com\n\nProject Link: [https://github.com/llabbasmkhll/laravel-zibal](https://github.com/llabbasmkhll/laravel-zibal)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabbasudo%2Flaravel-zibal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabbasudo%2Flaravel-zibal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabbasudo%2Flaravel-zibal/lists"}