{"id":36982087,"url":"https://github.com/miladrahimi/php-mellat-bank","last_synced_at":"2026-01-13T22:52:00.520Z","repository":{"id":62528798,"uuid":"99606833","full_name":"miladrahimi/php-mellat-bank","owner":"miladrahimi","description":"Iranian Mellat Bank Gateway for PHP Projects","archived":false,"fork":false,"pushed_at":"2020-04-15T09:07:48.000Z","size":81,"stargazers_count":11,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T02:54:15.777Z","etag":null,"topics":["bank","gateway","gateway-api","iranian","mellat-bank","php"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":false,"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/miladrahimi.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":"2017-08-07T18:19:28.000Z","updated_at":"2025-02-11T21:33:30.000Z","dependencies_parsed_at":"2022-11-02T10:45:48.281Z","dependency_job_id":null,"html_url":"https://github.com/miladrahimi/php-mellat-bank","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/miladrahimi/php-mellat-bank","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miladrahimi%2Fphp-mellat-bank","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miladrahimi%2Fphp-mellat-bank/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miladrahimi%2Fphp-mellat-bank/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miladrahimi%2Fphp-mellat-bank/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miladrahimi","download_url":"https://codeload.github.com/miladrahimi/php-mellat-bank/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miladrahimi%2Fphp-mellat-bank/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28402168,"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":["bank","gateway","gateway-api","iranian","mellat-bank","php"],"created_at":"2026-01-13T22:51:59.927Z","updated_at":"2026-01-13T22:52:00.512Z","avatar_url":"https://github.com/miladrahimi.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Php-Mellat-Bank\nIranian Mellat Bank Gateway for PHP Projects\n\n## Installation\n\n```\ncomposer require miladrahimi/php-mellat-bank\n```\n\n### Lifecycle\n\nThe process of an online payment with Mellat bank gateway consists of following steps:\n\n* Request for a new payment\n\n* Redirect user to the bank gateway page\n\n* Verify payment on callback page\n\n## Getting Started\n\nTo use the package for your payments you must instantiate the `Gateway` class \nand provide its configuration.\n\n```\nuse MiladRahimi\\PhpMellatBank\\Gateway;\n\n$config = [\n    'terminalId' =\u003e '...',\n    'userName' =\u003e '...',\n    'userPassword' =\u003e '...',\n    'callBackUrl' =\u003e 'https://example.com/payment/callback',\n];\n\n$gateway = new Gateway($config);\n```\n\n## Request Payment\n\nAs mentioned above, a the first step you must request for a new payment.\nIt can be done this way:\n\n```\n$refId = $gateway-\u003erequestPayment($amountInRial, 'Some optional description...');\n```\n\nThis method would throws `GatewayException` if it could not call the bank server api,\n`MellatException`if the bank response is something other than 0 (success).\n\n`MellatException` holds the bank response in its message.\n\nIf there was no error it would returns the `RefId`.\n\n## Redirect to Gateway\n\nNow that you have gotten the `RefId` you can lead user to the bank gateway.\n\nTo do this you should display an html form like this:\n\n```\n\u003cform action=\"$bankGatewayUrl\" method=\"post\"\u003e\n    \u003cinput type=\"hidden\" name=\"RefId\" value=\"$refId\"\u003e\n    \u003cinput type=\"submit\" value=\"Pay\"\u003e\n\u003c/form\u003e\n```\n\nThe `$bankGatewayUrl` is an url that bank provides for you\nbut you can get it from a `Gateway` instance this way:\n\n```\n$gateway-\u003eurl()\n```\n\n## Verify Payment\n\nUser completes the payment in bank gateway\nthen bank redirects him to the callback you have provided in the configuration,\nit also sends some parameters to the callback with `POST` method.\n\nYour callback url must verify the payment.\n\n```\nuse MiladRahimi\\PhpMellatBank\\Gateway;\n\n$gateway = new Gateway($config);\n\n$refId = $gateway-\u003echeckPayment();\n\nif($refId != false) {\n    $bankResult = $gateway-\u003everifyPayment();\n}\n```\n\n`checkPayment()` method would return `$refId` or `false` if there were any error.\n\n`verifyPayment()` method would return the bank response as an instance of `BankResult` class,\nit throws `InvalidResponseException` if the request is not valid (might not from the bank),\n`GatewayException` if it cannot call the bank server api, \n`MellatException` if the bank response is something other than 0 (success).\n\n## Exceptions\n\n* `GatewayException`: It'd be thrown when there were a problem on calling bank server APIs.\n* `MellatException`: It'd be thrown when bank `ResCode` is not `0` (success).\nIt holds the real response in its message.\n* `InvalidResponseException`: It'd be thrown in verification level (callback url) when the parameters are not valid.\nThis problem usually occurs when someone/something other than bank calls your callback url.\n\n## License\nPhpMellatBank is created by [Milad Rahimi](http://miladrahimi.com)\nand released under the [MIT License](http://opensource.org/licenses/mit-license.php).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiladrahimi%2Fphp-mellat-bank","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiladrahimi%2Fphp-mellat-bank","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiladrahimi%2Fphp-mellat-bank/lists"}