{"id":34650333,"url":"https://github.com/roaatech/payfort-php","last_synced_at":"2026-05-26T17:32:03.615Z","repository":{"id":56994580,"uuid":"88408182","full_name":"roaatech/payfort-php","owner":"roaatech","description":"Payfort payment gateway integration library for PHP","archived":false,"fork":false,"pushed_at":"2017-04-20T08:24:58.000Z","size":41,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-08-14T14:13:14.323Z","etag":null,"topics":["payfort","payment","php"],"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/roaatech.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-04-16T11:11:10.000Z","updated_at":"2020-03-10T20:28:32.000Z","dependencies_parsed_at":"2022-08-21T13:50:34.650Z","dependency_job_id":null,"html_url":"https://github.com/roaatech/payfort-php","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/roaatech/payfort-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roaatech%2Fpayfort-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roaatech%2Fpayfort-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roaatech%2Fpayfort-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roaatech%2Fpayfort-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roaatech","download_url":"https://codeload.github.com/roaatech/payfort-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roaatech%2Fpayfort-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33532024,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"ssl_error","status_checked_at":"2026-05-26T15:22:15.568Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["payfort","payment","php"],"created_at":"2025-12-24T17:55:31.628Z","updated_at":"2026-05-26T17:32:03.608Z","avatar_url":"https://github.com/roaatech.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Payfort payment gateway integration library for PHP\n\n# 1 Setup\n## 1.1 Automatically using composer\nJust require it `composer require itvisionsy/payfort-php`.\n\n## 1.2 Manually using Composer\nYou will need to add the `ItvisionSy\\Payment\\PayFort\\` as a PSR-4 namespace pointing to the path of the library root, and the `autoload.php` file at the files section.\nLet us say you have the following structure:\n```\n-/              \u003c= Project root\n  - Libraries/\n    - PayFort/  \u003c= This is the payment library\n  composer.json \u003c= The composer.json config file\n```\nIn the `composer.json` file, you need to have the following definition:\n```json\n  \"autoload\": {\n    \"psr-4\": {\n      \"ItvisionSy\\\\Payment\\\\PayFort\\\\\": \"Libraries/PayFort/src/\"\n    },\n    \"files\": [\n      \"Libraries/PayFort/autoload.php\"\n    ]\n  }\n```\n## 1.3 Manually using Autoload.php\nYou will need to require the `autoload.php` file before using the library.\n# 2 Configuration\nYou can configure the payment in one of following ways:\n 1. Create a file called `payfort_config.php` in the server root.\n    This file should return an array of configuration.\n    Following is a sample of the file content.\n    ```php\n    \u003c?php return [\n        'sandbox' =\u003e true,\n        'merchant_identifier' =\u003e 'payfort_merchant_identifier_string',\n        'access_code' =\u003e 'payfort_merchant_access_code_here',\n        'language' =\u003e \\ItvisionSy\\Payment\\PayFort\\Config::LANG_EN,\n        'sha_type' =\u003e \\ItvisionSy\\Payment\\PayFort\\Config::SHA_TYPE_SHA256,\n        'sha_request_phrase' =\u003e 'request_phrase_here',\n        'sha_response_phrase' =\u003e 'response_phrase_here',\n        'response_url_tokenization' =\u003e 'http://your_redirect_back_url_to_receive_tokenization_result',\n        'response_url_purchase' =\u003e 'http://your_redirect_back_url_to_receive_purchase_result',\n        'response_url_authorization' =\u003e 'http://your_redirect_back_url_to_receive_authorize_result',\n        'send_as_normal_http_post' =\u003e true,\n        'model_loader' =\u003e $your_model_loader_callable\n    ];\n    ```\n 1. Before using any function or method of the payment, use the public static method `ItvisionSy\\Payment\\PayFort\\Config::setDefaultConfig()` and pass an array of the config values.\n    Following is a sample of the usage of this method:\n    ```php\n    \u003c?php\n    \\ItvisionSy\\Payment\\PayFort\\Config::setDefaultConfig([\n        'sandbox' =\u003e true,\n        'merchant_identifier' =\u003e 'payfort_merchant_identifier_string',\n        'access_code' =\u003e 'payfort_merchant_access_code_here',\n        'language' =\u003e \\ItvisionSy\\Payment\\PayFort\\Config::LANG_EN,\n        'sha_type' =\u003e \\ItvisionSy\\Payment\\PayFort\\Config::SHA_TYPE_SHA256,\n        'sha_request_phrase' =\u003e 'request_phrase_here',\n        'sha_response_phrase' =\u003e 'response_phrase_here',\n        'response_url_tokenization' =\u003e 'http://your_redirect_back_url_to_receive_tokenization_result',\n        'response_url_purchase' =\u003e 'http://your_redirect_back_url_to_receive_purchase_result',\n        'response_url_authorization' =\u003e 'http://your_redirect_back_url_to_receive_authorize_result',\n        'send_as_normal_http_post' =\u003e true,\n        'model_loader' =\u003e $your_model_loader_callable\n    ]);\n    ```\n 1. You can manually initiate a config object and store it in the `$GLOBALS` array as `payfort_config`.\n    Following is a sample of this method:\n    ```php\n    \u003c?php\n    $GLOBALS['payfort_config'] = \\ItvisionSy\\Payment\\PayFort\\Config::make()\n        -\u003esetSandbox(true)\n        -\u003esetMerchantIdentifier('payfort_merchant_identifier_string')\n        -\u003esetAccessCode('payfort_merchant_access_code_string')\n        -\u003esetLanguage(\\ItvisionSy\\Payment\\PayFort\\Config::LANG_AR)\n        -\u003esetShaType(\\ItvisionSy\\Payment\\PayFort\\Config::SHA_TYPE_SHA256)\n        -\u003esetShaRequestPhrase('request_phrase_here')\n        -\u003esetShaResponsePhrase('response_phrase_here')\n        -\u003esetResponseUrlTokenization('http://your_redirect_back_url_to_receive_tokenization_result')\n        -\u003esetResponseUrlPurchase('http://your_redirect_back_url_to_receive_purchase_result')\n        -\u003esetResponseUrlAuthorization('http://your_redirect_back_url_to_receive_authorize_result')\n        -\u003esetSendAsNormalHttpPost(true)\n        -\u003esetModelLoader($your_model_loader_callable);\n    ```\n 1. You can define a public helper function called `payfort_config` which will always return an object of `\\ItvisionSy\\Payment\\PayFort\\Config`.\n    This is an example:\n    ```php\n    \u003c?php\n    function payfort_config(){\n        return \\ItvisionSy\\Payment\\PayFort\\Config::make()\n            -\u003esetSandbox(true)\n            -\u003esetMerchantIdentifier('payfort_merchant_identifier_string')\n            -\u003esetAccessCode('payfort_merchant_access_code_string')\n            -\u003esetLanguage(\\ItvisionSy\\Payment\\PayFort\\Config::LANG_AR)\n            -\u003esetShaType(\\ItvisionSy\\Payment\\PayFort\\Config::SHA_TYPE_SHA256)\n            -\u003esetShaRequestPhrase('request_phrase_here')\n            -\u003esetShaResponsePhrase('response_phrase_here')\n            -\u003esetResponseUrlTokenization('http://your_redirect_back_url_to_receive_tokenization_result')\n            -\u003esetResponseUrlPurchase('http://your_redirect_back_url_to_receive_purchase_result')\n            -\u003esetResponseUrlAuthorization('http://your_redirect_back_url_to_receive_authorize_result')\n            -\u003esetSendAsNormalHttpPost(true)\n            -\u003esetModelLoader($your_model_loader_callable);\n    }\n    ```\n# 3 Usage\n\n## 3.1 Understand the logic flow\nPayFort has two main types of operations: token-based and id-based.\n * Token-based operations are `AUTHORIZE` and `PURCHASE`, which are the ones used to charge credit cards. On success, they return a fort_id string, which is used in id-based operations.\n * id-based operations are mainly any operation to alter, finish, enquire, or cancel an token-based operation. They are `CAPTURE` a full or part amount of `AUTHORIZE` operation, or `VOID` it. `REFUND` any captured amount. And other maintenance operations.\n\nToken based operations need a token to be generated for specific credit card info. To do this, a\nfull HTTP POST request to be send to PayFort contains the credit card information\nalong side the merchant identification. If succeeded, it will return a token string\nfor this credit card. This token can be used again in later operations for the\nsame user. After that, all the remaining operations are normal HTTP API-call operations,\nunless there is 3rd party security check, which will require a redirect cycle.\nBoth `PURCHASE` and `AUTHORIZE` operations require a token to be used.\nIf you already have a token generated for a user's credit card, you can bypass the\ntokenization cycle and jump directly to purchase process.\n\n\n## 3.2 How to use\n\nThere are two approaches:\n 1. Extend the required operation's abstract class and implement the succeeded/failed functions.\n 1. Call the required operation's implementation and pass the succeeded/failed callables.\n\n# LICENSE\nAll issued under (MIT license)[LICENSE]\n\n# Thanks\nJetBrains for the all-product license for open source projects.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froaatech%2Fpayfort-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froaatech%2Fpayfort-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froaatech%2Fpayfort-php/lists"}