{"id":15286604,"url":"https://github.com/wshurafa/laravel-payfort","last_synced_at":"2025-04-13T02:32:02.491Z","repository":{"id":20922917,"uuid":"91271022","full_name":"wshurafa/laravel-payfort","owner":"wshurafa","description":"Laravel Payfort provides a simple and rich way to perform and handle operations for Payfort online payment gateway","archived":false,"fork":false,"pushed_at":"2024-02-07T13:13:06.000Z","size":18,"stargazers_count":16,"open_issues_count":8,"forks_count":29,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T20:49:33.203Z","etag":null,"topics":["composer","laravel","laravel-5-package","online-payments","payfort","payment-integration","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wshurafa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2017-05-14T20:57:21.000Z","updated_at":"2023-10-29T13:41:23.000Z","dependencies_parsed_at":"2024-10-14T16:41:11.602Z","dependency_job_id":"999c7e5a-ebd5-4976-857d-50998e44047d","html_url":"https://github.com/wshurafa/laravel-payfort","commit_stats":{"total_commits":10,"total_committers":6,"mean_commits":"1.6666666666666667","dds":0.7,"last_synced_commit":"269bd5186497efe9959598706c7db0087c46cde1"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wshurafa%2Flaravel-payfort","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wshurafa%2Flaravel-payfort/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wshurafa%2Flaravel-payfort/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wshurafa%2Flaravel-payfort/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wshurafa","download_url":"https://codeload.github.com/wshurafa/laravel-payfort/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248657793,"owners_count":21140842,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["composer","laravel","laravel-5-package","online-payments","payfort","payment-integration","php"],"created_at":"2024-09-30T15:17:40.700Z","updated_at":"2025-04-13T02:32:02.120Z","avatar_url":"https://github.com/wshurafa.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Laravel Payfort Package\n=======================\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n\n\n`Laravel Payfort` provides a simple and rich way to perform and handle operations for \n`Payfort` (MEA based online payment gateway) check here to read more \u003ca href=\"http://www.payfort.com/\"\u003ePayfort\u003c/a\u003e.  \nThis package supports a set of `Payfort` operations as listed below, other operations are open for future work and \ncontribution. \n\n* AUTHORIZATION/PURCHASE\n* TOKENIZATION\n* SDK_TOKEN\n* CHECK_STATUS\n\nYou have to read the `Payfort` documentation very well before proceeding in using any package, the package author \nwill not write about `Payfort` operations, what and how to use.\n\n## Installation\n\nYou can install the package via composer:\n```bash\ncomposer require wshurafa/laravel-payfort\n```\n\nYou can publish the config file with:\n```bash\nphp artisan vendor:publish --provider \"LaravelPayfort\\Providers\\PayfortServiceProvider\"\n```\nThis is the contents of the file that will be published at `config/payfort.php` :\n\n```php\nreturn [\n    /**\n     * Defines wether to activate the Payfort sandbox enviroment or not.\n     */\n    'sandbox' =\u003e env('PAYFORT_USE_SANDBOX', false),\n\n    /**\n     * The Payfort merchant account identifier.\n     */\n    'merchant_identifier' =\u003e env('PAYFORT_MERCHANT_IDENTIFIER'),\n\n    /**\n     * The Payfort account access code.\n     */\n    'access_code' =\u003e env('PAYFORT_ACCESS_CODE'),\n\n    /**\n     * The Payfort account sha type (sha256/sha512).\n     */\n    'sha_type' =\u003e env('PAYFORT_SHA_TYPE', 'sha256'),\n\n    /**\n     * The Payfort account sha request phrase.\n     */\n    'sha_request_phrase' =\u003e env('PAYFORT_SHA_REQUEST_PHRASE'),\n\n    /**\n     * The Payfort account sha response phrase.\n     */\n    'sha_response_phrase' =\u003e env('PAYFORT_SHA_RESPONSE_PHRASE'),\n\n    /**\n     * The default currency for you app. Currency ISO code 3.\n     */\n    'currency' =\u003e env('PAYFORT_CURRENCY', 'USD'),\n\n    /**\n     * The URL to return after submitting Payfort forms.\n     */\n    'return_url' =\u003e env('PAYFORT_RETURN_URL', '/')\n];\n ```\n\n### Then you have to add the following constants in the `.env` file:\n\n```bash\nPAYFORT_USE_SANDBOX=true                      # Defines wether to activate the payfort sandbox enviroment or not.\nPAYFORT_MERCHANT_IDENTIFIER=s2b3rj1vrjrhc1x   # The payfort merchant account identifier\nPAYFORT_ACCESS_CODE=s31bpM1ebfNnwqo           # The payfort account access code\nPAYFORT_SHA_TYPE=sha256                       # The payfort account sha type. sha256/sha512\nPAYFORT_SHA_REQUEST_PHRASE=keljhgiergh        # The payfort account sha request phrase\nPAYFORT_SHA_RESPONSE_PHRASE=lkejgoegj         # The payfort account sha response phrase\nPAYFORT_CURRENCY=USD                          # The default currency for you app. Currency ISO code 3.\nPAYFORT_RETURN_URL=/payfort/handle            # The url to return after submitting payfort forms.\n```\n\nYou can find most of these values in your `Payfort` account\n\n\n## Usage\n\nOnce all configuration steps are done, you are ready to use payfort operations in your app. Here is some examples on \nhow to use this package:\n \n \n### Authorization/Purchase request (Redirection)\n\nTo display payfort authorization or purchase page, in your controller's method add the following code snippet:\n```php\nreturn Payfort::redirection()-\u003edisplayRedirectionPage([\n    'command' =\u003e 'AUTHORIZATION',              # AUTHORIZATION/PURCHASE according to your operation.\n    'merchant_reference' =\u003e 'ORDR.34562134',   # You reference id for this operation (Order id for example).\n    'amount' =\u003e 100,                           # The operation amount.\n    'currency' =\u003e 'QAR',                       # Optional if you need to use another currenct than set in config.\n    'customer_email' =\u003e 'example@example.com'  # Customer email.\n]); \n```\nOther optional parameters that can be passed to `displayRedirectionPage` method as follows:\n* `token_name`\n* `payment_option`\n* `sadad_olp`\n* `eci`\n* `order_description`\n* `customer_ip`\n* `customer_name`\n* `merchant_extra`\n* `merchant_extra1`\n* `merchant_extra2`\n* `merchant_extra3`\n\n`Payfort` page will be displayed and once user submits the payment form, the return url defined in the environment configurations will be called.\n\nSee [`Payfort` documentation](https://docs.payfort.com/docs/redirection/build/index.html#authorization-purchase-request) for more info.\n\n### Tokenization request\n\nTo display payfort tokenization page, in your controller's method add the following code snippet:\n```php\nreturn Payfort::redirection()-\u003edisplayTokenizationPage([\n    'merchant_reference' =\u003e 'ORDR.34562134',   # You reference id for this operation (Order id for example).\n]); \n```\n\n`Payfort` page will be displayed and once user submits the payment form, the return url defined in the config file \nwill be called.\n\nSee [`Payfort` documentation](https://docs.payfort.com/docs/other-payfort-services/build/index.html#fort-tokenization-service) for more info.\n\n### Handling Payfort Authorization/Purchase response\n\n#### Handling callback (return)\n\nIn your handling controller that handle the return url, you can simply use the `PayfortResponse` trait as follows:\n```\nuse LaravelPayfort\\Traits\\PayfortResponse as PayfortResponse;\n\nclass PayfortOrdersController extends Controller{\n    use PayfortResponse;\n    \n    public function processReturn(Request $request){\n        $payfort_return = $this-\u003ehandlePayfortCallback($request);\n        # Here you can process the response and make your decision.\n        # The response structure is as described in payfort documentation\n    }\n}\n```\n\nSee [`Payfort` documentation](https://docs.payfort.com/docs/redirection/build/index.html#authorization-purchase-response) for more info.\n\n\n#### Handling Direct Transaction Feedback\n\nSame as handling payfort response except that you have to call `handlePayfortFeedback` instead of `handlePayfortCallback` \n\n\n### Localization\n\nThe redirect page can be translated by simply using the json file of the language wihtin the `lang` directory of your app.\n\nFor example, `ar.json` file:\n```\n{\n    ...\n    \"Payment redirect page\": \"صفحة إعادة توجيه الدفع\",\n    \"Click here to proceed to payment if you are not automatically redirected\": \"انقر هنا لمتابعة الدفع إذا لم تتم إعادة توجيهك تلقائيًا\",\n    ...\n}\n```\n\n## Contribution\n Want to improve this package or found a bug ?. Open an issue or do this contribution by yourself and get this honor.\n\nSimply, fork =\u003e do you work =\u003e make pull request.\n\nWrite clear comments and description ;-).\n\n\n## License\n \n`Laravel Payfort` is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwshurafa%2Flaravel-payfort","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwshurafa%2Flaravel-payfort","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwshurafa%2Flaravel-payfort/lists"}