{"activeVersionTag":"latest","latestAvailableVersionTag":"latest","collection":{"info":{"_postman_id":"2757f478-7c1c-47de-9f58-ace057629478","name":"NOWPayments API for Casinos","description":"NOWPayments offers you a unique solution developed and customized specifically for the needs of  \ncasinos and the gambling industry in general. Here you can find the workflow and detailed explanation  \nof API requests. If you have any questions/ feedback, feel free to reach out to us at  \n[partners@nowpayments.io](mailto:partners@nowpayments.io)\n\n# Authentication\n\nTo use the NOWPayments API you should do the following:\n\n- Sign up at [nowpayments.io](https://nowpayments.io)\n- Specify your outcome wallet\n- Generate an API key\n- Contact us to whitelist your ip\n    \n\n# API Documentation\n\n## Instant Payments Notifications\n\nIPN (Instant payment notifications, or callbacks) are used to notify you when transaction status is changed.  \nTo use them, you should complete the following steps:\n\n1. Generate and save the IPN Secret key in Store Settings tab at the Dashboard.\n2. Insert your URL address where you want to get callbacks in create_payment request. The parameter name is ipn_callback_url. You will receive payment updates (statuses) to this URL address.\n3. You will receive all the parameters at the URL address you specified in (2) by POST request.  \n    The POST request will contain the _x-nowpayments-sig_ parameter in the header.  \n    The body of the request is similiar to a [get payment status](https://documenter.getpostman.com/view/7907941/S1a32n38?version=latest#0b77a8e3-2344-4760-a0bd-247da067db6d) response body.\n4. Sort all the parameters from the POST request in alphabetical order.\n5. Convert them to string using  \n    [JSON.stringify](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) (params, Object.keys(params).sort()) or the same function.\n6. Sign a string with an IPN-secret key with HMAC and sha-512 key\n7. Compare the signed string from the previous step with the x-nowpayments-sig , which is stored in the header of the callback request.  \n    If these strings are similar it is a success.  \n    Otherwise, contact us on [support@nowpayments.io](mailto:support@nowpayments.io) to solve the problem.\n    \n\nExample of creating a signed string at Node.JS\n\n```\nconst hmac = crypto.createHmac('sha512', notificationsKey);\nhmac.update(JSON.stringify(params, Object.keys(params).sort()));\nconst signature = hmac.digest('hex');\n\n```\n\nExample of comparing signed strings in PHP\n\n```\nfunction check_ipn_request_is_valid()\n    {\n        $error_msg = \"Unknown error\";\n        $auth_ok = false;\n        $request_data = null;\n        if (isset($_SERVER['HTTP_X_NOWPAYMENTS_SIG']) && !empty($_SERVER['HTTP_X_NOWPAYMENTS_SIG'])) {\n            $recived_hmac = $_SERVER['HTTP_X_NOWPAYMENTS_SIG'];\n            $request_json = file_get_contents('php://input');\n            $request_data = json_decode($request_json, true);\n            ksort($request_data);\n            $sorted_request_json = json_encode($request_data);\n            if ($request_json !== false && !empty($request_json)) {\n                $hmac = hash_hmac(\"sha512\", $sorted_request_json, trim($this->ipn_secret));\n                if ($hmac == $recived_hmac) {\n                    $auth_ok = true;\n                } else {\n                    $error_msg = 'HMAC signature does not match';\n                }\n            } else {\n                $error_msg = 'Error reading POST data';\n            }\n        } else {\n            $error_msg = 'No HMAC signature sent.';\n        }\n    }\n\n```\n\n## Recommended flow\n\n### User's / Player's deposit flow\n\n1. The initial step is to integrate NP API to receive deposits from users. We recommend to use custody for all services that operates with users' funds. To activate your Custody please Sign In to your account, go to Custody section, fill all the fields, and then request disabling wallet address whitelisting. You can do that by sending an e-mail to partners@nowpayments.io . In your e-mail you must confirm that you are awared of all risks and want to disable wallet address whitelisting.\n2. Check out \"Create payment\" request to start receiveing deposits from players to your custody.\n3. When calling the request, make sure to enter the cryptocurrency in which you want to receive the funds from the user. You should also enter your ipn_callback_url - the address of your server - it will allow us to send you notifications about the payment status.\n4. In response to this address, you'll get pay_address - this is the constant deposit address where the user should send the money.\n5. When the user sends the money to this address, it is deposited on your custody. At this step, the automatic conversion takes place. For example, when you only have a USDT wallet in your NOWPayments Personal Account, and the user sends you BTC - NOWPayments performs the conversion and you receive the payment in USDT. Your custody is stored inside the NOWPayments system. You can withdraw the money from your balance at any point upon request.\n    \n\n### Payouts flow (payouts to users)\n\n1. In order to pay the users their rewards, you should use Authentification, Create Payout, Get Payout status, Get balance methods\n2. First, you need to get a jwt-token usin the Authentification method. jwt-token is needed to validate requests on our side.\n3. After that, you can view the available balance using the Get balance method. Pending amount - the amount of currency that is currently being processed, that is, in the process of payout.\n4. To create a payout, use the Create payout method. Enter the address, currency, and amount of currency you want to pay.\n5. You can monitor the payment status using the method get payout status.","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","isPublicCollection":false,"owner":"7907941","team":411802,"collectionId":"2757f478-7c1c-47de-9f58-ace057629478","publishedId":"TVmHFfYf","public":true,"publicUrl":"https://documenter-api.postman.tech/view/7907941/TVmHFfYf","privateUrl":"https://go.postman.co/documentation/7907941-2757f478-7c1c-47de-9f58-ace057629478","customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"documentationLayout":"classic-double-column","customisation":null,"version":"8.10.1","publishDate":"2020-11-27T15:07:06.000Z","activeVersionTag":"latest","documentationTheme":"light","metaTags":{},"logos":{}},"statusCode":200},"environments":[],"user":{"authenticated":false,"permissions":{"publish":false}},"run":{"button":{"js":"https://run.pstmn.io/button.js","css":"https://run.pstmn.io/button.css"}},"web":"https://www.getpostman.com/","team":{"logo":"https://res.cloudinary.com/postman/image/upload/t_team_logo_pubdoc/v1/team/4cdafe0c99d47ced702482e394e077d26df58a20ae76a604273728139b829231","favicon":""},"isEnvFetchError":false,"languages":"[{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"HttpClient\"},{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"RestSharp\"},{\"key\":\"curl\",\"label\":\"cURL\",\"variant\":\"cURL\"},{\"key\":\"dart\",\"label\":\"Dart\",\"variant\":\"http\"},{\"key\":\"go\",\"label\":\"Go\",\"variant\":\"Native\"},{\"key\":\"http\",\"label\":\"HTTP\",\"variant\":\"HTTP\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"OkHttp\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"Unirest\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"Fetch\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"jQuery\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"XHR\"},{\"key\":\"c\",\"label\":\"C\",\"variant\":\"libcurl\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Axios\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Native\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Request\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Unirest\"},{\"key\":\"objective-c\",\"label\":\"Objective-C\",\"variant\":\"NSURLSession\"},{\"key\":\"ocaml\",\"label\":\"OCaml\",\"variant\":\"Cohttp\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"cURL\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"Guzzle\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"HTTP_Request2\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"pecl_http\"},{\"key\":\"powershell\",\"label\":\"PowerShell\",\"variant\":\"RestMethod\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"http.client\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"Requests\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"httr\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"RCurl\"},{\"key\":\"ruby\",\"label\":\"Ruby\",\"variant\":\"Net::HTTP\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"Httpie\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"wget\"},{\"key\":\"swift\",\"label\":\"Swift\",\"variant\":\"URLSession\"}]","languageSettings":[{"key":"csharp","label":"C#","variant":"HttpClient"},{"key":"csharp","label":"C#","variant":"RestSharp"},{"key":"curl","label":"cURL","variant":"cURL"},{"key":"dart","label":"Dart","variant":"http"},{"key":"go","label":"Go","variant":"Native"},{"key":"http","label":"HTTP","variant":"HTTP"},{"key":"java","label":"Java","variant":"OkHttp"},{"key":"java","label":"Java","variant":"Unirest"},{"key":"javascript","label":"JavaScript","variant":"Fetch"},{"key":"javascript","label":"JavaScript","variant":"jQuery"},{"key":"javascript","label":"JavaScript","variant":"XHR"},{"key":"c","label":"C","variant":"libcurl"},{"key":"nodejs","label":"NodeJs","variant":"Axios"},{"key":"nodejs","label":"NodeJs","variant":"Native"},{"key":"nodejs","label":"NodeJs","variant":"Request"},{"key":"nodejs","label":"NodeJs","variant":"Unirest"},{"key":"objective-c","label":"Objective-C","variant":"NSURLSession"},{"key":"ocaml","label":"OCaml","variant":"Cohttp"},{"key":"php","label":"PHP","variant":"cURL"},{"key":"php","label":"PHP","variant":"Guzzle"},{"key":"php","label":"PHP","variant":"HTTP_Request2"},{"key":"php","label":"PHP","variant":"pecl_http"},{"key":"powershell","label":"PowerShell","variant":"RestMethod"},{"key":"python","label":"Python","variant":"http.client"},{"key":"python","label":"Python","variant":"Requests"},{"key":"r","label":"R","variant":"httr"},{"key":"r","label":"R","variant":"RCurl"},{"key":"ruby","label":"Ruby","variant":"Net::HTTP"},{"key":"shell","label":"Shell","variant":"Httpie"},{"key":"shell","label":"Shell","variant":"wget"},{"key":"swift","label":"Swift","variant":"URLSession"}],"languageOptions":[{"label":"C# - HttpClient","value":"csharp - HttpClient - C#"},{"label":"C# - RestSharp","value":"csharp - RestSharp - C#"},{"label":"cURL - cURL","value":"curl - cURL - cURL"},{"label":"Dart - http","value":"dart - http - Dart"},{"label":"Go - Native","value":"go - Native - Go"},{"label":"HTTP - HTTP","value":"http - HTTP - HTTP"},{"label":"Java - OkHttp","value":"java - OkHttp - Java"},{"label":"Java - Unirest","value":"java - Unirest - Java"},{"label":"JavaScript - Fetch","value":"javascript - Fetch - JavaScript"},{"label":"JavaScript - jQuery","value":"javascript - jQuery - JavaScript"},{"label":"JavaScript - XHR","value":"javascript - XHR - JavaScript"},{"label":"C - libcurl","value":"c - libcurl - C"},{"label":"NodeJs - Axios","value":"nodejs - Axios - NodeJs"},{"label":"NodeJs - Native","value":"nodejs - Native - NodeJs"},{"label":"NodeJs - Request","value":"nodejs - Request - NodeJs"},{"label":"NodeJs - Unirest","value":"nodejs - Unirest - NodeJs"},{"label":"Objective-C - NSURLSession","value":"objective-c - NSURLSession - Objective-C"},{"label":"OCaml - Cohttp","value":"ocaml - Cohttp - OCaml"},{"label":"PHP - cURL","value":"php - cURL - PHP"},{"label":"PHP - Guzzle","value":"php - Guzzle - PHP"},{"label":"PHP - HTTP_Request2","value":"php - HTTP_Request2 - PHP"},{"label":"PHP - pecl_http","value":"php - pecl_http - PHP"},{"label":"PowerShell - RestMethod","value":"powershell - RestMethod - PowerShell"},{"label":"Python - http.client","value":"python - http.client - Python"},{"label":"Python - Requests","value":"python - Requests - Python"},{"label":"R - httr","value":"r - httr - R"},{"label":"R - RCurl","value":"r - RCurl - R"},{"label":"Ruby - Net::HTTP","value":"ruby - Net::HTTP - Ruby"},{"label":"Shell - Httpie","value":"shell - Httpie - Shell"},{"label":"Shell - wget","value":"shell - wget - Shell"},{"label":"Swift - URLSession","value":"swift - URLSession - Swift"}],"layoutOptions":[{"value":"classic-single-column","label":"Single Column"},{"value":"classic-double-column","label":"Double Column"}],"versionOptions":[],"environmentOptions":[{"value":"0","label":"No Environment"}],"canonicalUrl":"https://documenter.gw.postman.com/view/metadata/TVmHFfYf"}