{"activeVersionTag":"latest","latestAvailableVersionTag":"latest","collection":{"info":{"_postman_id":"bf63d049-6b5e-4f22-90fc-97d3bc27f12a","name":"Xnowpay api对外(埃及)","description":"```\nx-sign 签名逻辑：\nbase64(hmacSha256(X-SECRET,requestBody))\nrequestBody：请求体body\nJAVA 示例代码:\nString key = X-SECRET;\nString requestBody = getBodyData(httpServletRequest)\nMac mac = Mac.getInstance(\"HmacSHA256\");\nSecretKeySpec signingKey = new SecretKeySpec(key.getBytes(), mac.getAlgorithm());\nmac.init(signingKey);\nString xSign = Base64.getEncoder().encodeToString(mac.doFinal(requestBody.getBytes()));\nPHP 示例代码:\n$requestBody = file_get_contents('php://input');\n$secretKey = \"xxxxxx\";\n$x-sign = base64_encode(hash_hmac('sha256', $requestBody, $secretKey ,true));\n.NET示例代码:\nusing System;\nusing System.Security.Cryptography;\nusing System.Text;\npublic class XSignGenerator\n{\n    public static string GenerateXSign(string secretKey, string requestBody)\n    {\n        // Convert the key and requestBody to byte arrays\n        byte[] keyBytes = Encoding.UTF8.GetBytes(secretKey);\n        byte[] bodyBytes = Encoding.UTF8.GetBytes(requestBody);\n        // Create an HMAC-SHA256 instance with the key\n        using (var hmac = new HMACSHA256(keyBytes))\n        {\n            // Compute the hash\n            byte[] hashBytes = hmac.ComputeHash(bodyBytes);\n            // Convert the hash to a Base64-encoded string\n            return Convert.ToBase64String(hashBytes);\n        }\n    }\n}\n案例：\nX-SECRET: GAXVKLYLP9QNE1NCFTRBTAIYZ6Z3NMWY\nrequestBody:\n{\n    \"reference_id\": \"6663702000\",\n    \"payment_method\": \"EG_WALLET_CHECKOUT\",\n    \"receive_account\": \"01041278905\",\n    \"status\": \"SUCCESS\",\n    \"amount\": \"100.00\",\n    \"actual_amount\": \"100.00\",\n    \"platform_reference_id\": \"51c23698e51b4497b8b68ebcd25fd06d\"\n}\n加签后结果：xSTWHwPWlortCxcbK4SoqXRm9TbnQm0L6cVuyKU+99g=\n请注意：验签时直接获取请求体并转成字符串格式验签\n\n ```\n\n**正式的X-SECRET（请求参数加密用的安全key)和X-SN（商户号)在我们支付平台为您开户之后通过邮件发送给您，此文档中的X-SECRET、X-SN为测试商户安全key和商户号，仅用于联调测试**","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","isPublicCollection":false,"owner":"9427478","team":573772,"collectionId":"bf63d049-6b5e-4f22-90fc-97d3bc27f12a","publishedId":"2sAY4xAMQu","public":true,"publicUrl":"https://document.xnowpay.com","privateUrl":"https://go.postman.co/documentation/9427478-bf63d049-6b5e-4f22-90fc-97d3bc27f12a","customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"},"documentationLayout":"classic-double-column","customisation":{"metaTags":[{"name":"description","value":""},{"name":"title","value":""}],"appearance":{"default":"light","themes":[{"name":"dark","logo":"https://content.pstmn.io/2bb5f894-bbc9-4f60-ad2b-701087f90997/ZmF2aWNvbi5wbmc=","colors":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"}},{"name":"light","logo":"https://content.pstmn.io/16f5f895-5518-4fc7-a20c-49925ad22961/ZmF2aWNvbi5wbmc=","colors":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"}}]}},"version":"8.10.1","publishDate":"2025-05-22T09:27:57.000Z","activeVersionTag":"latest","documentationTheme":"light","metaTags":{"title":"","description":""},"logos":{"logoLight":"https://content.pstmn.io/16f5f895-5518-4fc7-a20c-49925ad22961/ZmF2aWNvbi5wbmc=","logoDark":"https://content.pstmn.io/2bb5f894-bbc9-4f60-ad2b-701087f90997/ZmF2aWNvbi5wbmc="}},"statusCode":200},"environments":[{"name":"pay_api_prod_对外","id":"7e8a0f00-ca54-464e-9385-642d398d76bc","owner":"9427478","values":[{"key":"domain","value":"https://www.xnowpay.com/api","enabled":true},{"key":"token","value":"b0e58131549855146ef2a5555f53ae66d1e489283ed530faac444e6c528ac77e","enabled":true,"type":"default"},{"key":"x-sn","value":"952777","enabled":true,"type":"default"},{"key":"x-secret","value":"GAXVKLYLP9QNE1NCFTRBTAIYZ6Z3NMWY","enabled":true,"type":"default"}],"published":true}],"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/8ad5abe6fbde9743b4c8b58478518f09623e4e2e46e70406a6bcdd2aa66391b7","favicon":"https://xnowpay.com/favicon.ico"},"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"},{"label":"pay_api_prod_对外","value":"9427478-7e8a0f00-ca54-464e-9385-642d398d76bc"}],"canonicalUrl":"https://document.xnowpay.com/view/metadata/2sAY4xAMQu"}