{"id":17366715,"url":"https://github.com/baidou5/cmi-payment-gateway","last_synced_at":"2025-04-15T02:41:43.720Z","repository":{"id":257790969,"uuid":"861402954","full_name":"baidou5/CMI-Payment-Gateway","owner":"baidou5","description":"CMI Payment Package for Laravel","archived":false,"fork":false,"pushed_at":"2024-10-03T15:57:42.000Z","size":1290,"stargazers_count":16,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-08T03:18:06.608Z","etag":null,"topics":["cmi","express","getway","morocco","payment-gateway"],"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/baidou5.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-22T19:46:41.000Z","updated_at":"2024-11-17T15:54:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"25e5d9ee-d408-4804-ac03-207e6cbef543","html_url":"https://github.com/baidou5/CMI-Payment-Gateway","commit_stats":null,"previous_names":["baidou5/cmi-payment-gateway"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baidou5%2FCMI-Payment-Gateway","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baidou5%2FCMI-Payment-Gateway/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baidou5%2FCMI-Payment-Gateway/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baidou5%2FCMI-Payment-Gateway/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/baidou5","download_url":"https://codeload.github.com/baidou5/CMI-Payment-Gateway/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248996855,"owners_count":21195785,"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":["cmi","express","getway","morocco","payment-gateway"],"created_at":"2024-10-15T22:04:30.985Z","updated_at":"2025-04-15T02:41:43.713Z","avatar_url":"https://github.com/baidou5.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n![CMI-Payment-Gateway](https://raw.githubusercontent.com/baidou5/CMI-Payment-Gateway/main/cmi.jpg)\n\n# CMI Payment Gateway for Laravel\n[![Latest Version](https://img.shields.io/github/v/release/baidou5/CMI-Payment-Gateway)](https://github.com/baidou5/CMI-Payment-Gateway/releases)\n[![License](https://img.shields.io/github/license/baidou5/CMI-Payment-Gateway)](https://github.com/baidou5/CMI-Payment-Gateway/blob/main/LICENSE)\n[![PHP Version](https://img.shields.io/badge/PHP-%3E%3D7.4-blue.svg)](https://www.php.net/)\n[![Laravel Version](https://img.shields.io/badge/Laravel-%3E%3D7.0-orange.svg)](https://laravel.com/)\n[![Total Downloads](https://img.shields.io/packagist/dt/baidouabdellah/cmi-payment-gateway)](https://packagist.org/packages/baidouabdellah/cmi-payment-gateway)\n[![Contributors](https://img.shields.io/github/contributors/baidou5/CMI-Payment-Gateway.svg)](https://github.com/baidou5/CMI-Payment-Gateway/graphs/contributors)\n[![Issues](https://img.shields.io/github/issues/baidou5/CMI-Payment-Gateway.svg)](https://github.com/baidou5/CMI-Payment-Gateway/issues)\n[![Pull Requests](https://img.shields.io/github/issues-pr/baidou5/CMI-Payment-Gateway.svg)](https://github.com/baidou5/CMI-Payment-Gateway/pulls)\n[![GitHub stars](https://img.shields.io/github/stars/baidou5/CMI-Payment-Gateway.svg?style=social)](https://github.com/baidou5/CMI-Payment-Gateway/stargazers)\n\n\n**CMI-Payment-Gateway** is a simple and secure package for integrating CMI (Centre Monétique Interbancaire) Payment Gateway with Laravel applications. It allows you to process payments in a seamless way by interacting with the CMI API.\n\n## Features\n\n- Seamless integration with Laravel\n- Easy to configure and use\n- Secure payment processing via CMI\n- Supports multiple SHOPs (SAAS) transactions\n- Customizable payment callback URL\n\n## Requirements\n\n- PHP 7.4 or higher\n- Laravel 7.x or higher\n- CMI Merchant account\n\n## Installation\n\nTo install the package, use Composer:\n\n```bash\ncomposer require baidouabdellah/cmi-payment-gateway\n```\n\n### Publish Configuration\n\nOnce installed, publish the configuration file using the following command:\n\n```bash\nphp artisan vendor:publish --tag=\"cmi-config\"\n```\n\nThis will create a `cmi.php` file in your `config` directory where you can configure your CMI credentials.\n\n### Configuration\n\nIn the `config/cmi.php` file, add your CMI Merchant credentials:\n\n```php\nreturn [\n    'merchant_id' =\u003e env('CMI_MERCHANT_ID'),\n    'client_id' =\u003e env('CMI_CLIENT_ID'),\n    'store_key' =\u003e env('CMI_STORE_KEY'),\n    'api_key' =\u003e env('CMI_API_KEY'),\n    'secret_key' =\u003e env('CMI_SECRET_KEY'),\n    'sandbox' =\u003e env('CMI_SANDBOX', true),\n    'base_uri' =\u003e env('CMI_BASE_URI', 'https://testpayment.cmi.co.ma/fim/est3Dgate'),\n    'ok_url' =\u003e env('CMI_OK_URL', 'your_ok_url'),\n    'fail_url' =\u003e env('CMI_FAIL_URL', 'your_fail_url'),\n    'shop_url' =\u003e env('CMI_SHOP_URL', 'your_shop_url'),\n    'callback_url' =\u003e env('CMI_CALLBACK_URL', 'your_callback_url'),\n];\n```\n\nYou can also add these environment variables to your `.env` file:\n\n```env\nCMI_MERCHANT_ID=your_merchant_id\nCMI_CLIENT_ID=your_client_id\nCMI_STORE_KEY=your_store_key\nCMI_API_KEY=your_api_key\nCMI_SECRET_KEY=your_secret_key\nCMI_SANDBOX=true\nCMI_BASE_URI=https://testpayment.cmi.co.ma/fim/est3Dgate\nCMI_OK_URL=https://yourwebsite.com/payment/success\nCMI_FAIL_URL=https://yourwebsite.com/payment/fail\nCMI_SHOP_URL=https://yourwebsite.com/payment/cancel\nCMI_CALLBACK_URL=https://yourwebsite.com/payment/callback\n```\n\n## Usage\n\nTo process a payment, you can use the provided `CMIPayment` facade:\n\n1. First, inject the `CMIPayment` service into your controller or use the facade.\n\n2. Example usage in a controller:\n\n```php\nuse BaidouAbdellah\\CMIPaymentGateway\\CMIPayment;\n\nclass PaymentController extends Controller\n{\n    public function makePayment(Request $request)\n    {\n        $payment = new CMIPayment();\n        $response = $payment-\u003eprocess([\n            'amount' =\u003e 100.00,  // The amount to charge\n            'order_id' =\u003e 'ORDER12345',  // Your unique order ID\n            'customer_name' =\u003e 'Abdellah baidou', // Customer details\n            'customer_email' =\u003e 'baidou.abd@gmail.com', // Customer Email\n        ]);\n\n        return redirect($response-\u003egetPaymentUrl()); // Redirect user to CMI payment page\n    }\n}\n```\n\n### Handling Payment Callbacks\n\nIn your `web.php` routes file, you should add a route to handle the CMI callback:\n\n```php\nRoute::post('/cmi/callback', [PaymentController::class, 'handleCallback'])-\u003ename('cmi.callback');\n```\n\nIn your `PaymentController`, handle the callback:\n\n```php\nuse Illuminate\\Http\\Request;\n\nclass PaymentController extends Controller\n{\n    public function handleCallback(Request $request)\n    {\n        // Handle the response from CMI here\n        $paymentStatus = $request-\u003einput('STATUS');\n\n        if ($paymentStatus === 'APPROVED') {\n            // Payment was successful\n            return view('payment.success');\n        } else {\n            // Payment failed\n            return view('payment.failed');\n        }\n    }\n}\n```\n\n## Testing\n\nYou can test the integration using CMI's sandbox credentials. Ensure you configure the sandbox environment in the `cmi.php` configuration file or use different `.env` variables for testing.\n\n### Basic Test Card Numbers\n\nCredit card information cannot be used in test mode. Instead, use any of the following test card numbers, along with a valid future expiration date and any random CVC number, to simulate a successful payment transaction.\n\n| Card Type            | Card Number         | CVC (Random) | Expiration Date (Future)          |\n|----------------------|---------------------|--------------|-----------------------------------|\n| Visa                 | 4242 4242 4242 4242 | 3 digits     | Any future date                  |\n| Visa (Debit)         | 4000 0566 5566 5556 | 3 digits     | Any future date                  |\n| Mastercard           | 5555 5555 5555 4444 | 3 digits     | Any future date                  |\n| Mastercard (Series 2)| 2223 0031 2200 3222 | 3 digits     | Any future date                  |\n| Mastercard (Debit)   | 5200 8282 8282 8210 | 3 digits     | Any future date                  |\n| Mastercard (Prepaid) | 5105 1051 0510 5100 | 3 digits     | Any future date                  |\n| American Express     | 3782 822463 10005   | 4 digits     | Any future date                  |\n| American Express     | 3714 4963 5398 431  | 4 digits     | Any future date                  |\n| Discover             | 6011 1111 1111 1117 | 3 digits     | Any future date                  |\n| Discover             | 6011 0009 9013 9424 | 3 digits     | Any future date                  |\n| Diners Club          | 3056 9300 0902 0004 | 3 digits     | Any future date                  |\n| JCB                  | 3566 0020 2036 0505 | 3 digits     | Any future date                  |\n\nUse these details in your testing environment to verify the successful integration of the CMI payment gateway.\n\n## Security\n\nIf you discover any security issues, please send an email to `baidou.abd@gmail.com` instead of using the issue tracker.\n\n## Support\n- **Abdellah Baidou**\n- +212 661-176711\n- baidou.abd@gmail.com\n\n## License\n\nThis package is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaidou5%2Fcmi-payment-gateway","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbaidou5%2Fcmi-payment-gateway","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaidou5%2Fcmi-payment-gateway/lists"}