{"id":22812969,"url":"https://github.com/abdulbasit-dev/laravel-fastpay-integration","last_synced_at":"2025-04-22T16:21:47.323Z","repository":{"id":185559616,"uuid":"671427184","full_name":"abdulbasit-dev/laravel-fastpay-integration","owner":"abdulbasit-dev","description":"Fastpay Payment Integration for Laravel Framework","archived":false,"fork":false,"pushed_at":"2024-04-09T04:44:08.000Z","size":29,"stargazers_count":10,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T16:41:30.543Z","etag":null,"topics":["fastpay","laravel"],"latest_commit_sha":null,"homepage":"https://developer.fast-pay.iq/website-integration","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/abdulbasit-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-27T09:40:49.000Z","updated_at":"2024-08-20T20:11:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"2717d572-82db-4a44-97b8-2abdcdc626f6","html_url":"https://github.com/abdulbasit-dev/laravel-fastpay-integration","commit_stats":null,"previous_names":["abdulbasit-dev/laravel-fastpay-integration"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdulbasit-dev%2Flaravel-fastpay-integration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdulbasit-dev%2Flaravel-fastpay-integration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdulbasit-dev%2Flaravel-fastpay-integration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdulbasit-dev%2Flaravel-fastpay-integration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abdulbasit-dev","download_url":"https://codeload.github.com/abdulbasit-dev/laravel-fastpay-integration/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250275573,"owners_count":21403684,"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":["fastpay","laravel"],"created_at":"2024-12-12T12:14:29.871Z","updated_at":"2025-04-22T16:21:47.305Z","avatar_url":"https://github.com/abdulbasit-dev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Fastpay Integration Package\n\nThis package provides integration with Fastpay, allowing you to initiate payments, validate payments, process refunds, and validate refunds\nin your Laravel application.\n\n## Translations\n\nWe have provided translations of this README in different languages:\n\n- [Kurdish (Ku)](README.ku.md)\n- [Arabic (Ar)](README.ar.md)\n\nPlease note that these translations were done using Google Translate and may not be 100% accurate. If you find any inaccuracies or have suggestions for improvement, feel free to let us know. Your feedback is valuable to us!\n\n## Installation \n\nYou can install the package via composer:\n\n```bash\ncomposer require basit/laravel-fastpay-integration\n```\n\nPublish the config file with:\n\n```bash\nphp artisan vendor:publish --tag=\"fastpay\"\n```\n\nAfter installing the package, make sure to add the following environment variables to your `.env` file:\n\n```env\nFASTPAY_ENVIRONMENT=\"\"\nFASTPAY_STORE_ID=\"\"\nFASTPAY_STORE_PASSWORD=\"\"\n```\n\n**Note:** Ensure to set the `FASTPAY_ENVIRONMENT` variable in your `.env` file to either \"staging\" or \"production\" based on your requirements.\n\n## Usage\n\n### 1. Initiate Payment\n\n```php\nuse Basit\\FastpayPayment\\Fastpay;\n\n$cart = [\n    [\n        \"name\" =\u003e \"Scarf\",\n        \"qty\" =\u003e 1,\n        \"unit_price\" =\u003e 5000,\n    ],\n    [\n        \"name\" =\u003e \"T-Shirt\",\n        \"qty\" =\u003e 2,\n        \"unit_price\" =\u003e 10000,\n    ]\n];\n\n// Replace YOUR_ORDER_ID with the unique identifier for your customer's order\n$orderId = \"YOUR_ORDER_ID\";\n\n$response = Fastpay::initiate($orderId, $cart);\n```\n\n#### Success Response\n\n```json\n{\n  \"code\": 200,\n  \"messages\": [\"Payment Initiation request processed successfully.\"],\n  \"data\": {\n    \"redirect_uri\": \"https://staging-pgw.fast-pay.iq/pay?token=fc334490-348d-4040-87d9-dc33ae5xxxxx\"\n  }\n}\n```\n\n## Payment Notification Validation (IPN URL)\n\nFastpay sends a POST request to your IPN URL with payment information before redirecting the user back to your website. \nThis IPN notification is essential for validating the transaction and preventing fraudulent payments.\nYour IPN URL should be set up to handle these payment notifications and perform validation based on the received data.\n\nWhen Fastpay sends an IPN notification to your IPN URL, the POST request will include the following data:\n\n- `gw_transaction_id`: Alphanumeric identifier of the transaction.\n- `merchant_order_id`: Alphanumeric identifier of your order (replace YOUR_ORDER_ID with this value).\n- `received_amount`: Decimal value representing the received payment amount.\n- `currency`: String representing the currency (e.g., IQD).\n- `status`: String representing the status of the payment (e.g., \"Success\").\n- `customer_name`: String containing the name of the customer.\n- `customer_mobile_number`: String containing the customer's phone number.\n- `at`: Date and time of the transaction in the format \"Y-m-d H:i:s\" (e.g., \"2020-11-26 13:54:01\").\n\nYou should use this information to validate the payment and ensure the transaction is genuine and accurate.\n\n### 2. Validate Payment\n\n```php\nuse Basit\\FastpayPayment\\Fastpay;\n\n// Replace YOUR_ORDER_ID with the merchant_order_id received from the IPN callback\n$merchantOrderId = \"YOUR_ORDER_ID\";\n\n$response = Fastpay::validate($merchantOrderId);\n```\n\n#### Success Response\n\n```json\n{\n  \"code\": 200,\n  \"messages\": [],\n  \"data\": {\n    \"gw_transaction_id\": \"CUL1NUB713\",\n    \"merchant_order_id\": \"LAREVEORD1005\",\n    \"received_amount\": \"5000.00\",\n    \"currency\": \"IQD\",\n    \"customer_name\": \"John Doe\",\n    \"customer_mobile_number\": \"+964xxxxxxxxxx\",\n    \"at\": \"2023-06-14 18:06:30\",\n    \"transaction_id\": \"AXGOSG5527\",\n    \"order_id\": \"516867551564444475\",\n    \"customer_account_no\": \"+964xxxxxxxxxx\",\n    \"status\": \"Success\",\n    \"received_at\": \"2023-06-14 18:06:30\"\n  }\n}\n```\n\n### 3. Process Refund\n\n```php\nuse Basit\\FastpayPayment\\Fastpay;\n\n// Replace YOUR_ORDER_ID with the merchant_order_id for the order to be refunded\n$merchantOrderId = \"YOUR_ORDER_ID\";\n\n// Replace CUSTOMER_PHONE_NUMBER with the customer's phone number\n$msisdn = \"CUSTOMER_PHONE_NUMBER\";\n\n// Replace AMOUNT_TO_REFUND with the amount to be refunded (float)\n$amount = AMOUNT_TO_REFUND;\n\n$response = Fastpay::refund($merchantOrderId, $msisdn, $amount);\n```\n\n#### Success Response\n\n```json\n{\n  \"code\": 200,\n  \"messages\": [],\n  \"data\": {\n    \"summary\": {\n      \"recipient\": {\n        \"name\": \"John Doe\",\n        \"mobile_number\": \"+9640101010101\",\n        \"avatar\": \"https://revamp.fast-pay.iq/image/revamp.jpg\",\n      }\n      \"refund_invoice_id\": \"AUJHMA1634\"\n    }\n  }\n}\n```\n\n### 4. Validate Refund\n\n```php\nuse Basit\\FastpayPayment\\Fastpay;\n\n// Replace YOUR_ORDER_ID with the merchant_order_id received from the IPN callback\n$merchantOrderId = \"YOUR_ORDER_ID\";\n\n$response = Fastpay::refundValidate($merchantOrderId);\n```\n\n#### Success Response\n\n```json\n{\n  \"code\": 200,\n  \"messages\": [],\n  \"data\": {\n    \"order_id\": \"LAREVEORD5006\",\n    \"refund_status\": true,\n    \"status_checked_at\": \"2021-03-01 00:00:05\"\n  }\n}\n```\n\n# Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nFeel free to contribute to this project\n\n## Found an Issue or Bug?\n\nIf you encounter any issues, bugs, or have questions about this package, we encourage you to report them on our [GitHub Issues](https://github.com/abdulbasit-dev/laravel-fastpay-integration/issues) page. Please check if the issue has already been reported before creating a new one. When reporting an issue, provide as much detail as possible, including the steps to reproduce it, the expected behavior, and the actual behavior.\n\nWe value your feedback, and we'll do our best to address and resolve the issues in a timely manner. Your contributions are essential to improving this package for everyone.\n\n## Credits\n\n- [Abdulbasit Salah](https://github.com/abdulbasit-dev)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabdulbasit-dev%2Flaravel-fastpay-integration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabdulbasit-dev%2Flaravel-fastpay-integration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabdulbasit-dev%2Flaravel-fastpay-integration/lists"}