{"id":22821844,"url":"https://github.com/dubems/laravel-amplify","last_synced_at":"2025-04-23T03:09:33.195Z","repository":{"id":56973038,"uuid":"109535679","full_name":"dubems/laravel-amplify","owner":"dubems","description":"Laravel Library for integrating Amplify pay ","archived":false,"fork":false,"pushed_at":"2018-06-24T12:25:08.000Z","size":27,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T21:32:08.812Z","etag":null,"topics":["amplify","amplifypay","laravel","open-source","payment","php-library"],"latest_commit_sha":null,"homepage":"https://amplifypay.com","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/dubems.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}},"created_at":"2017-11-04T22:45:33.000Z","updated_at":"2022-03-28T04:32:57.000Z","dependencies_parsed_at":"2022-08-21T07:10:25.842Z","dependency_job_id":null,"html_url":"https://github.com/dubems/laravel-amplify","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dubems%2Flaravel-amplify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dubems%2Flaravel-amplify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dubems%2Flaravel-amplify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dubems%2Flaravel-amplify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dubems","download_url":"https://codeload.github.com/dubems/laravel-amplify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250360494,"owners_count":21417721,"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":["amplify","amplifypay","laravel","open-source","payment","php-library"],"created_at":"2024-12-12T16:09:10.399Z","updated_at":"2025-04-23T03:09:33.179Z","avatar_url":"https://github.com/dubems.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# laravel-amplify\nLaravel Library for integrating Amplify pay \n\n## Installation\n\n[PHP](https://php.net) 5.4+ and [Composer](https://getcomposer.org) are required.\n\nTo get the latest version of Laravel Amplify, require like below\n```\n\" composer require dubems/laravel-amplify\"\n```\n\nYou'll then need to run `composer install` or `composer update` to download it and have the autoloader updated.\n\nOnce Laravel Amplify is installed, you need to register the service provider. Open up `config/app.php` and add the following to the `providers` key.\n\n* `Dubems\\Amplify\\AmplifyServiceProvider::class,`\n\nAlso, register the Facade like so:\n\n```php\n'aliases' =\u003e [\n    ...\n    'Amplify' =\u003e Dubems\\Amplify\\Facades\\Amplify::class,\n    ...\n]\n```\n\n## Configuration\n\nYou can publish the configuration file using this command:\n\n```bash\nphp artisan vendor:publish --provider=\"Dubems\\Amplify\\AmplifyServiceProvider\"\n```\n\nA configuration-file named `amplify.php` with some defaults will be placed in your `config` directory:\n\n```php\n\u003c?php\n\nreturn [\n   /**\n    * Merchant ID gotten from your Amplify dashboard\n    */\n\n  'merchantId'=\u003e getenv('AMPLIFY_MERCHANT_ID'),\n\n    /**\n     *  API Key from amplify dashboard\n     */\n    'apiKey' =\u003e getenv('AMPLIFY_API_KEY'),\n\n    /**\n     * Amplify payment Url\n     */\n    'paymentUrl' =\u003e getenv('AMPLIFY_PAYMENT_URL'),\n\n    /**\n     * Redirect Url after successful transaction\n     */\n    'redirectUrl' =\u003e getenv('AMPLIFY_REDIRECT_URL')\n\n];\n```\n\n\n##General payment flow\n\nThough there are multiple ways to pay an order, most payment gateways expect you to follow the following flow in your checkout process:\n\n###1. The customer is redirected to the payment provider\nAfter the customer has gone through the checkout process and is ready to pay, the customer must be redirected to site of the payment provider.\n\nThe redirection is accomplished by submitting a form with some hidden fields. The form must post to the site of the payment provider. The hidden fields minimally specify the amount that must be paid and some other fields\n\n###2. The customer pays on the site of the payment provider\nThe customer arrives on the site of the payment provider and gets to choose a payment method. All steps necessary to pay the order are taken care of by the payment provider.\n\n###3. The customer gets redirected back\nAfter having paid the order the customer is redirected back. In the redirection request to the shop-site some values are returned.\n\n## Usage\n\nOpen your .env file and add your public key, secret key, merchant email and payment url like so:\n\n```php\nAMPLIFY_MERCHANT_ID=XXXXXXX\nAMPLIFY_API_KEY=XXXXXX\nAMPLIFY_PAYMENT_URL=https://api.amplifypay.com\nAMPLIFY_REDIRECT_URL=https://xxxxx\n```\n\nSet up routes and controller methods like so:\n\n```php\nRoute::post('/pay', 'PaymentController@redirectToGateway')-\u003ename('pay'); // Laravel 5.1.17 and above\n\nRoute::get('/payment/callback', 'PaymentController@handleGatewayCallback');\n```\n\n```php\n\u003c?php\n\nnamespace App\\Http\\Controllers;\n\nuse Illuminate\\Http\\Request;\n\nuse App\\Http\\Requests;\nuse App\\Http\\Controllers\\Controller;\nuse Amplify;\n\nclass PaymentController extends Controller\n{\n\n    /**\n     * Redirect the User to Amplify Payment Page\n     * @return Url\n     */\n    public function redirectToGateway()\n    {\n           return Amplify::getAuthorizationUrl()-\u003eredirect();\n    }\n\n    /**\n     * Get Amplify payment information\n     * @return void\n     */\n     public function handleGatewayCallback()\n      {\n           $response = Amplify::handlePaymentCallback();\n           dd($response);\n\n        // Now you have the payment details,\n        // you can store the authorization_code in your db to allow for recurrent subscriptions\n        // you can then redirect or do whatever you want\n     }\n}\n```\n\nOther methods and example usage can be found below\n```php\n    /** Create Subscription */\n  public function createSubscription()\n    {\n        $data = ['planName' =\u003e 'Sliver members', 'frequency' =\u003e 'Weekly'];\n        $response = Amplify::createSubscription($data);\n        dd($response);\n    }\n\n    /** Delete a particular subscription */  */\n    public function deleteSubscription()\n    {\n        $id = 'xyz';\n        $response = Amplify::deleteSubscription($id);\n        dd($response);\n    }\n\n    /** Update a particular subscription */\n public function updateSubscription()\n    {\n        $data = ['planName' =\u003e 'Gold members', 'frequency' =\u003e 'Weekly'];\n        $planId = 'xyz';\n        $response = Amplify::updateSubscription($planId, $data);\n        dd($response);\n    }\n\n    /** Get a particular subscription */\npublic function fetchSubscription()\n   {\n       $id = 'id';\n       $response = Amplify::fetchSubscription($id);\n       dd($response);\n   }\n\n    /** Fetch all subscription */\npublic function fetchAllSubscription()\n    {\n        $allSub = Amplify::fetchAllSubscription();\n        dd($allSub);\n    }\n\n\n\n\n```\n\nA sample form will look like so:\n\n```html\n\u003cform method=\"POST\" action=\"{{ route('pay') }}\" accept-charset=\"UTF-8\" class=\"form-horizontal\" role=\"form\"\u003e\n        \u003cdiv class=\"row\" style=\"margin-bottom:40px;\"\u003e\n          \u003cdiv class=\"col-md-8 col-md-offset-2\"\u003e\n            \u003cp\u003e\n                \u003cdiv\u003e\n                   A cup of coffee\n                    ₦ 800\n                \u003c/div\u003e\n            \u003c/p\u003e\n            \u003cinput type=\"hidden\" name=\"email\" value=\"nriagudubem@gmail.com\"\u003e {{-- required --}}\n            \u003cinput type=\"hidden\" name=\"description\" value=\"XYZ\"\u003e\n            \u003cinput type=\"hidden\" name=\"amount\" value=\"800\"\u003e {{-- required in naira --}}\n            \u003cinput type=\"hidden\" name=\"name\" value=\"Nriagu Dubem\"\u003e\n            \u003cinput type=\"hidden\" name=\"planId\" value=\"Your plan ID\"\u003e\n            {{ csrf_field() }} {{-- works only when using laravel 5.1, 5.2 --}}\n\n             \u003cinput type=\"hidden\" name=\"_token\" value=\"{{ csrf_token() }}\"\u003e {{-- employ this in place of csrf_field only in laravel 5.0 --}}\n\n\n            \u003cp\u003e\n              \u003cbutton class=\"btn btn-success btn-lg btn-block\" type=\"submit\" value=\"Pay Now!\"\u003e\n              \u003ci class=\"fa fa-plus-circle fa-lg\"\u003e\u003c/i\u003e Pay Now!\n              \u003c/button\u003e\n            \u003c/p\u003e\n          \u003c/div\u003e\n        \u003c/div\u003e\n\u003c/form\u003e\n```\n\n```bash\nPAN = 5060 9905 8000 0217 499\nEXPYEAR = 20\nEXPMONTH = 04\nCVV = 111\n\nIf prompted for Amount Validation, Enter 1.10\n```\n\n## Todo\n\n* Add Comprehensive Tests\n\n## Contributing\n\nPlease feel free to fork this package and contribute by submitting a pull request to enhance the functionalities.\n\n## How can I thank you?\n\nStar the github repo, I'd love the attention! You can also share the link for this repository on Twitter or HackerNews? Spread the word!\n\nDon't forget to [follow me on twitter](https://twitter.com/nriagudubem)!\n\nThanks!\nNriagu Chidubem.\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdubems%2Flaravel-amplify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdubems%2Flaravel-amplify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdubems%2Flaravel-amplify/lists"}