{"id":21565857,"url":"https://github.com/prevailexcel/laravel-nowpayments","last_synced_at":"2025-04-10T13:14:38.865Z","repository":{"id":63671031,"uuid":"569741043","full_name":"PrevailExcel/laravel-nowpayments","owner":"PrevailExcel","description":"A Laravel Package for NOWPayments","archived":false,"fork":false,"pushed_at":"2024-11-06T07:49:15.000Z","size":46,"stargazers_count":10,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T11:56:58.618Z","etag":null,"topics":["cryptocurrency","laravel","laravel-nowpayments","library","nowpayments","payment-integration"],"latest_commit_sha":null,"homepage":"https://nowpayments.io","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/PrevailExcel.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-23T14:06:50.000Z","updated_at":"2024-11-06T07:49:19.000Z","dependencies_parsed_at":"2024-01-08T14:29:59.900Z","dependency_job_id":"f67ff400-e373-495c-9563-b31dec85da3a","html_url":"https://github.com/PrevailExcel/laravel-nowpayments","commit_stats":{"total_commits":4,"total_committers":1,"mean_commits":4.0,"dds":0.0,"last_synced_commit":"e3a2f88de0649f81055537743a4a6f27d749f024"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrevailExcel%2Flaravel-nowpayments","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrevailExcel%2Flaravel-nowpayments/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrevailExcel%2Flaravel-nowpayments/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrevailExcel%2Flaravel-nowpayments/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PrevailExcel","download_url":"https://codeload.github.com/PrevailExcel/laravel-nowpayments/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248225648,"owners_count":21068078,"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":["cryptocurrency","laravel","laravel-nowpayments","library","nowpayments","payment-integration"],"created_at":"2024-11-24T10:22:09.870Z","updated_at":"2025-04-10T13:14:38.414Z","avatar_url":"https://github.com/PrevailExcel.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# laravel-nowpayments\n\n[![Latest Stable Version](https://poser.pugx.org/prevailexcel/laravel-nowpayments/v/stable.svg)](https://packagist.org/packages/prevailexcel/laravel-nowpayments)\n[![License](https://poser.pugx.org/prevailexcel/laravel-nowpayments/license.svg)](LICENSE.md)\n\n\u003e A Laravel Package for working with NOWPayments seamlessly \n##\n\u003e This package comes now with a default dashboard that show the list of all payments and also shows a log of endpoints that have been accessed from your application, fluent methods to handle payments easily and removes the bulk of the heavy work from you.\n## Installation\n\n[PHP](https://php.net) 5.4+ or [HHVM](http://hhvm.com) 3.3+, and [Composer](https://getcomposer.org) are required.\n\nTo get the latest version of Laravel NOWPayments, simply require it\n\n```bash\ncomposer require prevailexcel/laravel-nowpayments\n```\n\nOr add the following line to the require block of your `composer.json` file.\n\n```\n\"prevailexcel/laravel-nowpayments\": \"1.0.*\"\n```\n\nYou'll then need to run `composer install` or `composer update` to download it and have the autoloader updated.\n\n\n\nOnce Laravel NOWPayments is installed, you need to register the service provider. Open up `config/app.php` and add the following to the `providers` key.\n\n```php\n'providers' =\u003e [\n    ...\n    PrevailExcel\\Nowpayments\\NowpaymentsServiceProvider::class,\n    ...\n]\n```\n\n\u003e If you use **Laravel \u003e= 5.5** you can skip this step and go to [**`configuration`**](https://github.com/PrevailExcel/laravel-nowpayments#configuration)\n\n* `PrevailExcel\\Nowpayments\\NowpaymentsServiceProvider::class`\n\nAlso, register the Facade like so:\n\n```php\n'aliases' =\u003e [\n    ...\n    'Nowpayments' =\u003e PrevailExcel\\Nowpayments\\Facades\\Nowpayments::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=\"PrevailExcel\\Nowpayments\\NowpaymentsServiceProvider\"\n```\n\nA configuration-file named `nowpayments.php` with some sensible defaults will be placed in your `config` directory:\n\n```php\n\u003c?php\n\n\nreturn [\n\n    /**\n     * API Key From NOWPayments Dashboard\n     *\n     */\n    'apiKey' =\u003e env('NOWPAYMENTS_API_KEY'),\n    \n    /**\n     * IPN Secret from NOWPayments Dashboard\n     */\n    'ipnSecret' =\u003e env('NOWPAYMENTS_IPN_SECRET'),\n    \n    /**\n     * You enviroment can either be live or sandbox.\n     * Make sure to add the appropriate API key after changing the enviroment in .env\n     *\n     */\n    'env' =\u003e env('NOWPAYMENTS_ENV', 'sandbox'),\n\n    /**\n     * NOWPayments Live URL\n     *\n     */\n    'liveUrl' =\u003e env('NOWPAYMENTS_LIVE_URL', \"https://api.nowpayments.io/v1\"),\n\n    /**\n     * NOWPayments Sandbox URL\n     *\n     */\n    'sandboxUrl' =\u003e env('NOWPAYMENTS_SANDBOX_URL', \"https://api-sandbox.nowpayments.io/v1\"),\n\n    /**\n     * Your callback URL\n     *\n     */\n    'callbackUrl' =\u003e env('NOWPAYMENTS_CALLBACK_URL'),\n\n    /**\n     * Your URL Path\n     *\n     */\n    'path' =\u003e 'laravel-nowpayments',\n\n    /**\n     * You can add your custom middleware to access the dashboard here\n     *\n     */\n    'middleware' =\u003e null, // \"Authorise::class\",\n\n    /**\n     * Your Nowpayment email here\n     *\n     */\n    'email' =\u003e env('NOWPAYMENTS_EMAIL'),\n    \n    /**\n     * Your Nowpayment password here\n     *\n     */\n    'password' =\u003e  env('NOWPAYMENTS_PASSWORD'),\n];\n```\n\nRemeber to run your migration to add one table to the database for logging with this command\n\n```bash\nphp artisan migrate\n```\n\nYou can test the dashboard to see if your set up is ready by serving your application and going to /laravel-nowpayments\n\n```bash\n127.0.0.1:8000/laravel-nowpayments\n```\nYou can change this default path/url by changing the 'path' from the config file at `nowpayments.php` in your `config` folder\n\n```php\n\u003c?php\n\nreturn [\n    ...\n    // 'path' =\u003e 'laravel-nowpayments',\n    'path' =\u003e 'new-endpoint',\n];\n```\n\n## General E-commerce Payment Flow\n\n### 1 UI - Ask a customer to select item/items for purchase to determine the total sum\n### 2 UI - Ask a customer to select payment currency\n### 3 API - Call Nowpayments::createPayment() method;\nPass the data from the User as an array. This method does the magic. First it gets the minimum payment amount for the currency pair, then it gets the estimate of the total amount in crypto and checks that it is larger than the minimum payment amount.\n\nIf it's true, it sends the payload and gets the payment data that inclues the generated wallet address for the user.\n### 4 UI - Ask a customer to send the payment to the generated deposit address.\n### 5 UI - A customer sends coins, NOWPayments processes and exchanges them (if required), and settles the payment to your Outcome Wallet.\n### 6 API - Check the payment status\nYou can get the payment status either via NOWPayments IPN callbacks or manually using \"nowpayments()-\u003egetPaymentStatus()\" and display it to a customer so that they know when their payment has been processed.\n### 7 Check the dashboard for a list of all your payments\nThis package comes with a default Dashboard that show a list of all payments and also shows a log of endpoints thta have been accessed from your application.\nAdditionally, you can see all of this information in your Account on NOWPayments website.\n\n\n## Usage\n\nOpen your .env file and add your api key, env, callback url like so:\n\n```php\nNOWPAYMENTS_ENV=\"live\"\nNOWPAYMENTS_API_KEY=\"*******-*******-*******-*******\"\nNOWPAYMENTS_CALLBACK_URL=\"https://yourcallback.com\"\nNOWPAYMENTS_EMAIL=\"hello@example.com\"\nNOWPAYMENTS_PASSWORD=\"your password\"\n```\n*If you are using a hosting service like heroku, ensure to add the above details to your configuration variables.*\n\n\n```php\n// Laravel 5.1.17 and above\nRoute::post('/pay', 'PaymentController@createCryptoPayment')-\u003ename('pay');\n```\n\nOR\n\n```php\nRoute::post('/pay', [\n    'uses' =\u003e 'PaymentController@createCryptoPayment',\n    'as' =\u003e 'pay'\n]);\n```\nOR\n\n```php\n// Laravel 8 \u0026 9\nRoute::post('/pay', [App\\Http\\Controllers\\PaymentController::class, 'createCryptoPayment'])-\u003ename('pay');\n```\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 Illuminate\\Support\\Facades\\Redirect;\nuse PrevailExcel\\Nowpayments\\Facades\\Nowpayments;\n\nclass PaymentController extends Controller\n{\n\n    /**\n     * Collect Order data and create Payment\n     * @return Url\n     */\n    public function createCryptoPayment()\n    {\n        try{\n            $data = [\n                'price_amount' =\u003e request()-\u003eprice_amount ?? 100,\n                'price_currency' =\u003e request()-\u003eprice_currency ?? 'usd',\n                'order_id' =\u003e request()-\u003eorder_id ?? uniqid(), // you can generate your order id as you wish\n                'pay_currency' =\u003e request()-\u003epay_currency ?? 'btc',\n                'payout_currency' =\u003e request()-\u003epayout_currency ?? 'btc',\n            ];\n\n           $paymentDetails = Nowpayments::createPayment($data);\n            \n            dd($paymentDetails);\n            // Now you have the payment details,\n            // you can then redirect or do whatever you want\n\n            return Redirect::back()-\u003ewith(['msg'=\u003e\"Payment created successfully\", 'type'=\u003e'success'], 'data'=\u003e$paymentDetails);\n        }catch(\\Exception $e) {\n            return Redirect::back()-\u003ewithMessage(['msg'=\u003e\"There's an error in the data\", 'type'=\u003e'error']);\n        }        \n    }\n}\n```\n\nSome fluent methods this package provides are listed here.\n```php\n\n/**\n * This is the method to create a payment. You need to provide your data as an array.\n * @returns array\n */\nNowpayments::createPayment();\n\n/**\n * Alternatively, use the helper.\n */\nnowpayments()-\u003ecreatePayment();\n\n\n/**\n * Gets the payment details of a particular transaction including the status with the paymentId \n * @returns array\n */\nNowpayments::getPaymentStatus();\n\n/**\n * Alternatively, use the helper.\n */\nnowpayments()-\u003egetPaymentStatus();\n\n\n/**\n * Get all currenices\n * @returns array\n */\nNowpayments::getCurrencies()\n\n/**\n * Alternatively, use the helper.\n */\nnowpayments()-\u003egetCurrencies();\n\n\n/**\n *   Get the minimum payment amount for a specific pair.\n */\nNowpayments::getMinimumPaymentAmount();\n\n/**\n * Alternatively, use the helper.\n */\nnowpayments()-\u003egetMinimumPaymentAmount();\n\n\n/**\n *  Creates invoice with url where user can complete the payment.\n * @returns array\n */\nNowpayments::createInvoice();\n\n/**\n * Alternatively, use the helper.\n */\nnowpayments()-\u003ecreateInvoice();\n\n\n/**\n * This method allows you to obtain information about all the payment plans you’ve created.\n * @returns array\n */\nNowpayments::getPlans();\n/**\n * Alternatively, use the helper.\n */\nnowpayments()-\u003egetPlans();\n\n\n/**\n * Get information about a particular recurring payment via its ID.\n * @returns array\n */\nNowpayments::getSubscription();\n/**\n * Alternatively, use the helper.\n */\nnowpayments()-\u003egetSubscription();\n\n\n/**\n * This method allows you to send payment links to your customers via email.\n * @returns array\n */\nNowpayments::emailSubscription();\n/**\n * Alternatively, use the helper.\n */\nnowpayments()-\u003eemailSubscription();\n\n\n/**\n * Completely removes a particular payment from the recurring payment plan.\n * @returns array\n */\nNowpayments::deleteSubscription();\n/**\n * Alternatively, use the helper.\n */\nnowpayments()-\u003edeleteSubscription();\n\n\n/**\n     * Returns the entire list of all transactions, created with certain API key.\n * @returns array\n */\nNowpayments::getListOfPayments();\n\n/**\n * Alternatively, use the helper.\n */\nnowpayments()-\u003egetListOfPayments();\n\n\n/**\n* This method gets the estitmate price of an amount in different pairs\n* @return array\n*/\nNowpayments::getEstimatePrice();\n\n/**\n * Alternatively, use the helper.\n */\nnowpayments()-\u003egetEstimatePrice();\n\n```\n\n## Todo\n\n* Add Comprehensive Tests\n* Add Support For Billing Endpoints\n* Add Support For Payout Endpoints\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\nWhy not star the github repo? I'd love the attention! Why not 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/EjimaduPrevail)!\nAlso check out my page on medium to catch articles and tutorials on Laravel [follow me on medium](https://medium.com/@prevailexcellent)!\n\nThanks!\nChimeremeze Prevail Ejimadu.\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%2Fprevailexcel%2Flaravel-nowpayments","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprevailexcel%2Flaravel-nowpayments","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprevailexcel%2Flaravel-nowpayments/lists"}