### Get Order Information Request Example (Node.js) Source: https://ccpayment.com/api/doc/index This Node.js code snippet demonstrates how to make a POST request to the Get Order Information API. It includes generating a signature using App ID, Timestamp, and App Secret for authentication, and sending the order ID in the request body. ```javascript const https = require("https"); const crypto = require("crypto"); const appId = "*** your appId ***"; const appSecret = "*** your appSecret ***"; const orderId = "your_order_id"; const path = "***"; const args = JSON.stringify({ "orderId":"1709889675" }); const timestamp = Math.floor(Date.now() / 1000); let signText = appId + timestamp; if (args.length !== 0) { signText += args; } const sign = crypto .createHmac("sha256", appSecret) .update(signText) .digest("hex"); const options = { method: "POST", headers: { "Content-Type": "application/json", "Appid": appId, "Sign": sign, "Timestamp": timestamp.toString(), }, }; const req = https.request(path, options, (res) => { let respData = ""; res.on("data", (chunk) => { respData += chunk; }); res.on("end", () => { console.log("Response:", respData); }); }); req.write(args); req.end(); ``` -------------------------------- ### Get Token Information Request Example (Node.js) Source: https://ccpayment.com/api/doc/index This Node.js code snippet shows the beginning of a request to the CCPayment API for specific token information. It initializes variables for AppID, AppSecret, and includes the necessary 'https' and 'crypto' modules for making the authenticated API call. ```javascript const https = require('https'); const crypto = require('crypto'); const appId ='*** your appId ***'; const appSecret ='*** your appSecret ***'; ``` -------------------------------- ### Get Chain List Request Example Source: https://ccpayment.com/api/doc/index This JavaScript code snippet illustrates how to query the CCPayment API for the status of supported blockchain networks. It demonstrates constructing a POST request with an optional 'chains' parameter to specify particular chains, using Node.js's 'https' and 'crypto' modules for authentication. ```JavaScript const https = require('https'); const crypto = require('crypto'); const appId ='*** your appId ***'; const appSecret ='*** your appSecret ***'; const path = '***'; const args = JSON.stringify({ 'chains': ['ETH','POLYGON']});; const timestamp = Math.floor(Date.now() / 1000); let signText = appId + timestamp; if (args) { signText += args; } const sign = crypto .createHmac('sha256', appSecret) .update(signText) .digest('hex'); const options = { method: 'POST', headers: { 'Content-Type': 'application/json', ``` -------------------------------- ### Get User Deposit Record List Request Example Source: https://ccpayment.com/api/doc/index This code snippet demonstrates how to make an HTTP POST request to the CCPayment API to retrieve a list of user deposit records. It includes setting up request headers with authentication (Appid, Sign, Timestamp) and sending request parameters in JSON format. The example uses Node.js with the 'https' and 'crypto' modules. ```javascript const https = require('https'); const crypto = require('crypto'); const appId ='*** your appId ***'; const appSecret ='*** your appSecret ***'; const path = '***'; const args = JSON.stringify({'userId': '1737014581861', # 'coinId': 1280, # 'chain': 'POLYGON', # 'startAt': 1697216461, # 'endAt': 1708334085, # 'nextId': '38fe94d7f06594bb9c1832b51601bc' }); const timestamp = Math.floor(Date.now() / 1000); let signText = appId + timestamp; if (args) { signText += args; } const sign = crypto .createHmac('sha256', appSecret) .update(signText) .digest('hex'); const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Appid': appId, 'Sign': sign, 'Timestamp': timestamp.toString(), }, }; const req = https.request(path, options, (res) => { let respData = ''; res.on('data', (chunk) => { respData += chunk; }); res.on('end', () => { console.log('Response:', respData); }); }); req.write(args); req.end(); ``` -------------------------------- ### Swap Record Example Response (JSON) Source: https://ccpayment.com/api/doc/index An example of a successful response from the CCPayment API for a swap record query. It details the transaction, including input/output coins, amounts, rates, fees, and status. ```JSON { "code": 10000, "msg": "success", "data": { "recordId": "20240719085639165937311982694400", "orderId": "1721379398507", "coinIdIn": 1280, "coinIdOut": 1329, "amountOut": "1.9428459962937677", "amountIn": "1", "swapRate": "1.9428459962937677", "fee": "0.1950648590656393", "feeRate": "0.1004016064257028", "netAmountOut": "1.7477811372281284" } } ``` -------------------------------- ### Get Swap Coin List Response Example Source: https://ccpayment.com/api/doc/index This JSON response shows the data structure returned by the CCPayment API for the 'Get Swap Coin List' endpoint. It includes a success code and a data object containing an array of coins, where each coin object has a coinId, symbol, and logo URL. ```JSON { "code": 10000, "msg": "success", "data": { "coins": [ { "coinId": 1254, "symbol": "WAVES", "logoUrl": "https://resource.ccpayment.com/token/icon/waves.png" }, { "coinId": 1630, "symbol": "ONE", "logoUrl": "https://resource.ccpayment.com/token/icon/one.png" }, { "coinId": 1193, "symbol": "DCR", "logoUrl": "https://resource.ccpayment.com/token/icon/dcr.png" } ... ] } } ``` -------------------------------- ### Get Token List Response Example Source: https://ccpayment.com/api/doc/index This JSON structure represents a successful response from the 'Get Token List' endpoint of the CCPayment API. It contains a list of coins, each with its ID, symbol, full name, logo URL, status, and supported networks with detailed chain information, deposit/withdrawal status, and minimum/maximum amounts. ```json { "code": 10000, "msg": "success", "data": { "coins": [ { "coinId": 1207, "symbol": "LINK", "coinFullName":"ChainLink Token", "logoUrl": "https://resource.ccpayment.com/token/icon/link.png", "status": "Normal", "networks": { "BSC": { "chain": "BSC", "chainFullName": "Binance Smart Chain", "contract": "0xf8a0bf9cf54bb92f17374d9e9a321e6a111a51bd", "precision": 18, "canDeposit": true, "canWithdraw": true, "minimumDepositAmount": "0", "minimumWithdrawAmount": "0.025", "maximumWithdrawAmount": "0", "isSupportMemo": false }, "ETH": { "chain": "ETH", "chainFullName": "Ethereum", "contract": "0x514910771af9ca656af840dff83e8264ecf986ca", "precision": 18, "canDeposit": true, "canWithdraw": true, "minimumDepositAmount": "0", "minimumWithdrawAmount": "0.025", "maximumWithdrawAmount": "0", "isSupportMemo": false } } }, ... ] } } ``` -------------------------------- ### Get Fiat List Request Example Source: https://ccpayment.com/api/doc/index This JavaScript code snippet demonstrates how to make a POST request to the CCPayment API to retrieve a list of supported fiat currencies. It includes authentication using an AppId, AppSecret, and a generated signature based on a timestamp. The request is made using Node.js's built-in 'https' and 'crypto' modules. ```JavaScript const https = require('https'); const crypto = require('crypto'); const appId ='*** your appId ***'; const appSecret ='*** your appSecret ***'; const path = '***'; const args = ''; const timestamp = Math.floor(Date.now() / 1000); let signText = appId + timestamp; if (args) { signText += args; } const sign = crypto .createHmac('sha256', appSecret) .update(signText) .digest('hex'); const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Appid': appId, 'Sign': sign, 'Timestamp': timestamp.toString(), }, }; const req = https.request(path, options, (res) => { let respData = ''; res.on('data', (chunk) => { respData += chunk; }); res.on('end', () => { console.log('Response:', respData); }); }); req.write(args); req.end(); ``` -------------------------------- ### Get Token List Request Example (Node.js) Source: https://ccpayment.com/api/doc/index This Node.js code snippet demonstrates how to make a POST request to the CCPayment API to retrieve a list of all enabled tokens. It includes authentication using AppID, AppSecret, and a generated signature based on a timestamp. The request is made using the 'https' module. ```javascript const https = require("https"); const crypto = require("crypto"); const appId = "*** your appId ***"; const appSecret = "*** your appSecret ***"; const path = "***"; const args = ""; const timestamp = Math.floor(Date.now() / 1000); let signText = appId + timestamp; if (args) { signText += args; } const sign = crypto .createHmac("sha256", appSecret) .update(signText) .digest("hex"); const options = { method: "POST", headers: { "Content-Type": "application/json", "Appid": appId, "Sign": sign, "Timestamp": timestamp.toString(), }, }; const req = https.request(path, options, (res) => { let respData = ""; res.on("data", (chunk) => { respData += chunk; }); res.on("end", () => { console.log("Response:", respData); }); }); req.write(args); req.end(); ``` -------------------------------- ### Get User Deposit Record API Response Example Source: https://ccpayment.com/api/doc/index This JSON object shows a successful response from the 'Get User Deposit Record' API. It includes a status code, a success message, and a data object containing the deposit record details, such as the destination address and memo. ```json { "code": 10000, "msg": "success", "data": { "address": "xxxxxxxxx", "memo": "" } } ``` -------------------------------- ### Get Swap Coin List Request Example Source: https://ccpayment.com/api/doc/index This JavaScript code snippet demonstrates how to request a list of all coins available for swapping from the CCPayment API. Similar to other endpoints, it uses Node.js's 'https' and 'crypto' modules for making an authenticated POST request with necessary headers like AppId, Sign, and Timestamp. ```JavaScript const https = require('https'); const crypto = require('crypto'); const appId = '*** your appId ***'; const appSecret = '*** your appSecret ***'; const path = '***'; const args = ''; const timestamp = Math.floor(Date.now() / 1000); let signText = appId + timestamp; if (args) { signText += args; } const sign = crypto .createHmac('sha256', appSecret) .update(signText) .digest('hex'); const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'AppId': appId, 'Sign': sign, 'Timestamp': timestamp.toString(), }, }; const req = https.request(path, options, (res) => { let respData = ''; res.on('data', (chunk) => { respData += chunk; }); res.on('end', () => { console.log('Response:', respData); }); }); req.write(args); req.end(); ``` -------------------------------- ### Get Deposit Record (Node.js) Source: https://ccpayment.com/api/doc/index This Node.js example shows how to retrieve deposit record details using the CCPayment API. It involves creating a request with a specific record ID and signing it for authentication. ```javascript const https = require("https"); const crypto = require("crypto"); const appId = "*** your appId ***"; const appSecret = "*** your appSecret ***"; const path = "***"; const args = JSON.stringify({ "recordId": "20250116073333231508600365121536" }); const timestamp = Math.floor(Date.now() / 1000); let signText = appId + timestamp; if (args.length !== 0) { ``` -------------------------------- ### Get Fiat List Response Example Source: https://ccpayment.com/api/doc/index This JSON object represents a successful response from the CCPayment API's 'Get Fiat List' endpoint. It contains a success code, a message, and a data object that includes an array of fiat currency information, such as fiat ID, symbol, logo URL, and USD exchange rate. ```JSON { "code": 10000, "msg": "success", "data": { "fiats": [ { "fiatId": 1022, "symbol": "DKK", "logoUrl": "https://resource.ccpayment.com/fiat/DKK.png", "mark": "KR", "usdRate": "6.825765" }, ... ] } } ``` -------------------------------- ### Get Withdrawal Record - JavaScript Example Source: https://ccpayment.com/api/doc/index This JavaScript code snippet demonstrates how to retrieve a specific withdrawal record using the CCPayment API. It includes setting up the request with necessary headers like AppId, Sign, and Timestamp, and handling the response. ```JavaScript const https = require("https"); const crypto = require("crypto"); const appId = "*** your appId ***"; const appSecret = "*** your appSecret ***"; const path = "***"; const args = JSON.stringify({ "recordId": '202403010341121763409125674323968' //"orderId": '17071162236' }); const timestamp = Math.floor(Date.now() / 1000); let signText = appId + timestamp; if (args.length !== 0) { signText += args; } const sign = crypto .createHmac("sha256", appSecret) .update(signText) .digest("hex"); const options = { method: "POST", headers: { "Content-Type": "application/json", "Appid": appId, "Sign": sign, "Timestamp": timestamp.toString(), }, }; const req = https.request(path, options, (res) => { let respData = ""; res.on("data", (chunk) => { respData += chunk; }); res.on("end", () => { console.log("Response:", respData); }); }); req.write(args); req.end(); ``` -------------------------------- ### CCPayment API Success Response Example Source: https://ccpayment.com/api/doc/index This is an example of a successful response from the CCPayment API, likely for a user deposit record query. It includes a success code (10000), a success message, and a data object containing a record with details such as userId, recordId, coinId, chain, txId, addresses, amount, status, and more. ```json { 'code': 10000, 'msg': 'success', 'data': { 'record': { 'userId': '1737014581861', 'recordId': '20250116080551231516731711291392', 'coinId': 1482, 'chain': 'TRX', 'contract': 'TRX', 'coinSymbol': 'TRX', 'txId': 'dcb10a262e6a445dc1da0cf642bb095b2619b0d3789fdade3ba7b963adf1bccc', 'coinUSDPrice': '0.23803', 'fromAddress': 'TRPKg7eGMy9aZS2RumSPeWoyVkDqTVwLgL', 'toAddress': 'TMGT5iUxyNcdeYiwSD3L8cfVzhTFrVbWTX', 'toMemo': '', 'amount': '0.5', 'serviceFee': '0.0025', 'status': 'Success', 'arrivedAt': 1737014751, 'isFlaggedAsRisky': false } } } ``` -------------------------------- ### Get User Balance List Request Source: https://ccpayment.com/api/doc/index This JavaScript snippet shows how to construct a request to get a user's balance list from the CCPayment API. It includes setting up authentication headers with appId, appSecret, and a generated signature, and sending a POST request with the userId. ```JavaScript const https = require('https'); const crypto = require('crypto'); const appId ='*** your appId ***'; const appSecret ='*** your appSecret ***'; const path = "***"; const args = JSON.stringify({ 'userId': "1709021102608" }); ``` -------------------------------- ### Get User Swap Record Request Source: https://ccpayment.com/api/doc/index This code snippet demonstrates how to make a POST request to the CCPayment API to retrieve a user's swap record. It includes setting up request options, generating a signature, and handling the response. ```JavaScript const https = require('https'); const crypto = require('crypto'); const appId = '*** your appId ***'; const appSecret = '*** your appSecret ***'; const path = '***'; const args = JSON.stringify({ "recordId": "20240722021342166923068583059456", }); const timestamp = Math.floor(Date.now() / 1000); let signText = appId + timestamp; if (args) { signText += args; } const sign = crypto .createHmac('sha256', appSecret) .update(signText) .digest('hex'); const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'AppId': appId, 'Sign': sign, 'Timestamp': timestamp.toString(), }, }; const req = https.request(path, options, (res) => { let respData = ''; res.on('data', (chunk) => { respData += chunk; }); res.on('end', () => { console.log('Response:', respData); }); }); req.write(args); req.end(); ``` -------------------------------- ### Get Chain Information Source: https://ccpayment.com/api/doc/index Retrieves a list of supported cryptocurrency chains, including their full names, explorer URLs, logo URLs, status, confirmation requirements, base URLs for transaction queries, EVM compatibility, and memo support. ```json { "code": 10000, "msg": "success", "data": { "code": 10000, "msg": "success", "data": { "chains": [ { "chain": "ETH", "chainFullName": "Ethereum", "explorer": "https://etherscan.io/", "logoUrl": "https://resource.ccpayment.com/token/icon/ETH.png", "status": "Normal", "confirmations": 2, "baseUrl": "https://etherscan.io/tx/%s", "isEVM": true, "supportMemo": false }, { "chain": "POLYGON", "chainFullName": "Polygon", "explorer": "https://polygonscan.com", "logoUrl": "https://resource.ccpayment.com/token/icon/matic.png", "status": "Normal", "confirmations": 50, "baseUrl": "https://polygonscan.com/tx/%s", "isEVM": true, "supportMemo": false } ] } } } ``` -------------------------------- ### Create User Withdrawal Request Source: https://ccpayment.com/api/doc/index Initiates a withdrawal order to a blockchain address using the CCPayment API. This Node.js example demonstrates how to construct the request, generate a signature, and send the POST request. ```javascript const https = require('https'); const crypto = require('crypto'); const appId ='*** your appId ***'; const appSecret ='*** your appSecret ***'; const path = 'https://ccpayment.com/ccpayment/v2/applyUserWithdrawToNetwork'; const args = JSON.stringify({ 'coinId': 1280, 'address': '0x12438F04093EBc87f0Ba629bbe93F2451711d967', 'orderId': '121231313', 'userId': '1709021102608', 'chain': 'POLYGON', 'amount': '0.001', # 'merchantPayNetworkFee': false, # 'memo': '' }); const timestamp = Math.floor(Date.now() / 1000); let signText = appId + timestamp; if (args) { signText += args; } const sign = crypto .createHmac('sha256', appSecret) .update(signText) .digest('hex'); const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Appid': appId, 'Sign': sign, 'Timestamp': timestamp.toString(), }, }; const req = https.request(path, options, (res) => { let respData = ''; res.on('data', (chunk) => { respData += chunk; }); res.on('end', () => { console.log('Response:', respData); }); }); req.write(args); req.end(); ``` -------------------------------- ### Get User Withdrawal Record List Request Example (Node.js) Source: https://ccpayment.com/api/doc/index This Node.js code snippet demonstrates how to make a POST request to retrieve a list of user withdrawal records. It includes setting up request headers with authentication (AppId, Sign, Timestamp) and sending parameters like userId, coinId, and address in the request body. The signature is generated using HMAC-SHA256. ```javascript const https = require('https'); const crypto = require('crypto'); const appId ='*** your appId ***'; const appSecret ='*** your appSecret ***'; const path = '***'; const args = JSON.stringify({ 'userId': '1709021102608', // 'coinId': 272366, // 'address': 'kava1fc72crkczxzpdkn0xlxt65mklfywt485jqwazq', // 'chain': 'DOGE', // 'startAt': 1704042061, // 'endAt': 1708426738, // 'nextId': '' }); const timestamp = Math.floor(Date.now() / 1000); let signText = appId + timestamp; if (args) { signText += args; } const sign = crypto .createHmac('sha256', appSecret) .update(signText) .digest('hex'); const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Appid': appId, 'Sign': sign, 'Timestamp': timestamp.toString(), }, }; const req = https.request(path, options, (res) => { let respData = ''; res.on('data', (chunk) => { respData += chunk; }); res.on('end', () => { console.log('Response:', respData); }); }); req.write(args); req.end(); ``` -------------------------------- ### Checkout URL Response Example Source: https://ccpayment.com/api/doc/index This JSON response indicates that a checkout URL has been generated for a transaction. It includes the URL where the payer can complete their payment and the number of confirmations required for an on-chain transaction. ```json { "code": 10000, "msg": "success", "data": { "address": "0x9aBDDCE1EE18D1857C0653EB4a3Fa9d9E0dcd584", "amount": "0.008552856654122477", "memo": "", "checkoutUrl": "https://i.ccpayment.com/xxx", "confirmsNeeded": 50 } } ``` -------------------------------- ### CCPayment API Withdrawal Response Source: https://ccpayment.com/api/doc/index Example of a successful response from the CCPayment API after initiating a user withdrawal. It includes a success code, message, and the record ID for the transaction. ```json { "code": 10000, "msg": "success", "data": { "recordId": "2024032203112917xxxxxxxx" } } ``` -------------------------------- ### Create CCPayment Network Withdrawal Order (Node.js) Source: https://ccpayment.com/api/doc/index Example of creating a network withdrawal order using Node.js. It demonstrates how to construct the request body, generate a signature using HMAC-SHA256, and set up HTTPS request options for the CCPayment API. ```javascript const https = require("https"); const crypto = require("crypto"); const appId = "*** your appId ***"; const appSecret = "*** your appSecret ***"; const path = "***"; const getPath = "***"; const args = JSON.stringify({ "coinId": 1280, "address": "0xBb9C4e7F3687aca1AE2828c18f9E3ae067F569FE", "orderId": String(Math.floor(Date.now() / 1000)), "chain": "POLYGON", "amount": "0.001", //"merchantPayNetworkFee": False, //"memo": "" }); const timestamp = Math.floor(Date.now() / 1000); let signText = appId + timestamp; if (args.length !== 0) { signText += args; } const sign = crypto .createHmac("sha256", appSecret) .update(signText) .digest("hex"); const options = { method: "POST", headers: { "Content-Type": "application/json", "Appid": appId, "Sign": sign, "Timestamp": timestamp.toString(), }, timeout: 15000, }; function isTimeoutError(err) { return err.code === "ETIMEDOUT"; } function makeRequest(path, args, retryCount = 3) { return new Promise((resolve, reject) => { const req = https.request(path, options, (res) => { let respData = ""; res.on("data", (chunk) => { respData += chunk; }); res.on("end", () => { resolve(respData); }); }); ``` -------------------------------- ### Address Unbinding Response Example (JSON) Source: https://ccpayment.com/api/doc/index This JSON object represents a successful response from the Address Unbinding API endpoint, detailing the unbound address and associated transaction information. ```json { "code": 10000, "msg": "success", "data": { "unbound": [ { "chain": "POLYGON", "address": "0xa9a363196b22c1760cc7B777C5dD6264C376F20a" } ], "unboundAt": 1741783734, "userID": "", "referenceID": "1735287108" } } ``` -------------------------------- ### CCPayment API Response Example Source: https://ccpayment.com/api/doc/index This JSON object represents a successful response from the CCPayment API, detailing a withdrawal transaction. It includes transaction specifics like record ID, coin information, amount, status, and fee details. ```json { "code": 10000, "msg": "success", "data": { "records": [ { "recordId": "20250609081114283701939096506368", "coinId": 1280, "coinSymbol": "USDT", "chain": "POLYGON", "orderId": "20250609081114283701939096506368", "toAddress": "0x0bB246b74A0E12328E38B2b5Ac226805BA8C77ba", "toMemo": "", "amount": "0.125292", "txId": "0xce9442353a6a73d00fe43b6874720f617f6db416b5b4249ab62e826296358962", "status": "Success", "fee": { "coinId": 1280, "coinSymbol": "USDT", "amount": "0.006577" }, "serviceFee": "0.00081" } ], "nextId": "" } } ``` -------------------------------- ### CCPayment API Deposit Address Response Example Source: https://ccpayment.com/api/doc/index This JSON response shows the details of a permanent deposit address obtained from the CCPayment API. It includes a success code, message, and the deposit address along with an optional memo for specific coins. ```JSON { "code": 10000, "msg": "success", "data": { "address": "0x7C631947c139F0163fECc0eef39f251D72dAE3B8", "memo": "" } } ``` -------------------------------- ### CCPayment API Response Example Source: https://ccpayment.com/api/doc/index This JSON object represents a successful response from the CCPayment API. It includes a success code, a message, and a data object containing details about the order, such as the amount to pay, coin information, addresses, timestamps, exchange rate, fiat symbol, and a list of paid transactions. ```json { "code": 10000, "msg": "success", "data": { "amountToPay": "0.008552856654122477", "coinId": 1329, "coinSymbol": "MATIC", "chain": "POLYGON", "toAddress": "0x9abddce1ee18d1857c0653eb4a3fa9d9e0dcd584", "createAt": 1710233933, "rate": "1.1692", "fiatId": 1033, "fiatSymbol": "USD", "expiredAt": 1710243931, "checkoutUrl": "https://i.ccpayment.com/1djqz1m", "paidList": [ { "recordId": "20240312090316119190942031876096", "fromAddress": "0x12438f04093ebc87f0ba629bbe93f2451711d967", "amount": "0.001", "serviceFee": "0.0000005", "txid": "0xef4abf7175cefbe2f06002a959892e4b407bef02175980eaa9bb1967fcba1b22", "status": "Success", "arrivedAt": 1710234197, "rate": "1.1692" } ] } } ``` -------------------------------- ### Get User Coin Balance (All Assets) Source: https://ccpayment.com/api/doc/index Retrieves a list of all coin balances for a given user. This involves creating a signed POST request to the CCPayment API, including user-specific data and authentication headers. ```JavaScript const https = require('https'); const crypto = require('crypto'); const appId ='*** your appId ***'; const appSecret ='*** your appSecret ***'; const path = '***'; const args = JSON.stringify({'coinId':1280,'userId': "1709021102608" }); const timestamp = Math.floor(Date.now() / 1000); let signText = appId + timestamp; if (args) { signText += args; } const sign = crypto .createHmac('sha256', appSecret) .update(signText) .digest('hex'); const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Appid': appId, 'Sign': sign, 'Timestamp': timestamp.toString(), }, }; const req = https.request(path, options, (res) => { let respData = ''; res.on('data', (chunk) => { respData += chunk; }); res.on('end', () => { console.log('Response:', respData); }); }); req.write(args); req.end(); ``` -------------------------------- ### Request Permanent Deposit Address Source: https://ccpayment.com/api/doc/index This JavaScript code example shows how to request a permanent deposit address from CCPayment. It constructs the request body with a reference ID and chain symbol, generates a signature for authentication, and sends a POST request to the API. ```JavaScript const https = require("https"); const crypto = require("crypto"); const appId = "*** your appId ***"; const appSecret = "*** your appSecret ***"; const path = "***"; const args = JSON.stringify({ "referenceId": String(Math.floor(Date.now() / 1000)), "chain": "POLYGON", }); const timestamp = Math.floor(Date.now() / 1000); let signText = appId + timestamp; if (args.length !== 0) { signText += args; } const sign = crypto .createHmac("sha256", appSecret) .update(signText) .digest("hex"); const options = { method: "POST", headers: { "Content-Type": "application/json", "Appid": appId, "Sign": sign, "Timestamp": timestamp.toString(), }, }; const req = https.request(path, options, (res) => { let respData = ""; res.on("data", (chunk) => { respData += chunk; }); res.on("end", () => { console.log("Response:", respData); }); }); req.write(args); req.end(); ``` -------------------------------- ### Create or Get User Deposit Address Source: https://ccpayment.com/api/doc/index Generates or retrieves a permanent deposit address for a user on a specified blockchain. This involves creating a signed POST request with user ID and chain information. ```JavaScript const https = require('https'); const crypto = require('crypto'); const appId ='*** your appId ***'; const appSecret ='*** your appSecret ***'; const path = '***'; const args = JSON.stringify({'userId': '1737014581861','chain':'BSC', }); const timestamp = Math.floor(Date.now() / 1000); let signText = appId + timestamp; if (args) { signText += args; } const sign = crypto .createHmac('sha256', appSecret) .update(signText) .digest('hex'); const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Appid': appId, 'Sign': sign, 'Timestamp': timestamp.toString(), }, }; const req = https.request(path, options, (res) => { let respData = ''; res.on('data', (chunk) => { respData += chunk; }); res.on('end', () => { console.log('Response:', respData); }); }); req.write(args); req.end(); ``` -------------------------------- ### CCPayment API Success Response Example Source: https://ccpayment.com/api/doc/index This JSON object represents a successful response from the CCPayment API, indicating a success code and a message. It includes data related to the transaction, such as the number of webhooks resent. ```JSON { "code": 10000, "msg": "Success", "data": { "resendCount": 1 } } ``` -------------------------------- ### Get Coin Information Source: https://ccpayment.com/api/doc/index Retrieves detailed information about a specific coin, including its ID, symbol, supported networks, and withdrawal/deposit statuses. The request requires authentication with an App ID and a generated signature. ```JavaScript const path = '***'; const args = JSON.stringify({ 'coinId': 1280 }); const timestamp = Math.floor(Date.now() / 1000); let signText = appId + timestamp; if (args) { signText += args; } const sign = crypto .createHmac('sha256', appSecret) .update(signText) .digest('hex'); const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Appid': appId, 'Sign': sign, 'Timestamp': timestamp.toString(), }, }; const req = https.request(path, options, (res) => { let respData = ''; res.on('data', (chunk) => { respData += chunk; }); res.on('end', () => { console.log('Response:', respData); }); }); req.write(args); req.end(); ``` -------------------------------- ### Get Balance List - JavaScript Source: https://ccpayment.com/api/doc/index Retrieves all balances in the merchant account using a POST request. It requires authentication headers including Appid, Sign, and Timestamp, generated using SHA256 HMAC. ```JavaScript const https = require("https"); const crypto = require("crypto"); const appId = "*** your appId ***"; const appSecret = "*** your appSecret ***"; const path = "***"; const args = ""; const timestamp = Math.floor(Date.now() / 1000); let signText = appId + timestamp; if (args) { signText += args; } const sign = crypto .createHmac("sha256", appSecret) .update(signText) .digest("hex"); const options = { method: "POST", headers: { "Content-Type": "application/json", "Appid": appId, "Sign": sign, "Timestamp": timestamp.toString(), }, }; const req = https.request(path, options, (res) => { let respData = ""; res.on("data", (chunk) => { respData += chunk; }); res.on("end", () => { console.log("Response:", respData); }); }); req.write(args); req.end(); ``` -------------------------------- ### CCPayment API Transaction Response Example (JSON) Source: https://ccpayment.com/api/doc/index This JSON object represents a successful response from the CCPayment API when retrieving transaction records. It includes a status code, a success message, and a data object containing an array of transaction records and a `nextId` for pagination. ```json { "code": 10000, "msg": "success", "data": { "records": [ { "recordId": "202403120909501767478092588126208", "withdrawType": "Network", "coinId": 1891, "coinSymbol": "TETH", "chain": "POLYGON", "fromAddress": "0x1AE2828c18f9E3ae067F569aca1AE2828C4e7", "toAddress": "0xBb9C4e7F3687aca1AE2828c18f9E3ae067F569FE", "orderId": "1710234589577", "txId": "0xb55bb28292de56432b06204f71c68847a71670f2fc311af5c53a6ded45ab047b", "toMemo": "", "status": "Success", "amount": "0.004", "fee": { "coinId": 1891, "coinSymbol": "TETH", "amount": "0.001" } }, { "recordId": "202403120913091767478929213362176", "withdrawType": "Cwallet", "coinId": 1329, "coinSymbol": "MATIC", "chain": "Cwallet OS", "cwalletUser": "35255142", "orderId": "1710234789039", "txId": "", "toMemo": "", "status": "Success", "amount": "0.002" }], "nextId": "" } } ``` -------------------------------- ### Unbind Deposit Address (Node.js) Source: https://ccpayment.com/api/doc/index This Node.js example demonstrates how to unbind a deposit address using the CCPayment API. It includes generating a signature for authentication and making a POST request to the unbind endpoint. ```javascript const https = require('https'); const crypto = require('crypto'); const appId ='*** your appId ***'; const appSecret ='*** your appSecret ***'; const path = "***"; const args = JSON.stringify({ 'chain': "POLYGON" ,'address':'0x3720C7f5b352E9da3A102B3b8c49080acAa4ceee'}); const timestamp = Math.floor(Date.now() / 1000); let signText = appId + timestamp; if (args) { signText += args; } const sign = crypto .createHmac('sha256', appSecret) .update(signText) .digest('hex'); const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Appid': appId, 'Sign': sign, 'Timestamp': timestamp.toString(), }, }; const req = https.request(path, options, (res) => { let respData = ''; res.on('data', (chunk) => { respData += chunk; }); res.on('end', () => { console.log('Response:', respData); }); }); req.write(args); req.end(); ``` -------------------------------- ### Withdrawal Success Response Example in JSON Source: https://ccpayment.com/api/doc/index This JSON object represents a successful withdrawal response from the CCPayment API. It includes a success code, a success message, and data containing the record ID for the transaction. ```JSON { "code": 10000, "msg": "success", "data": { "recordId": "202403120909501767478092588126208" } } ``` -------------------------------- ### Get User Internal Transaction Record List Source: https://ccpayment.com/api/doc/index This snippet demonstrates how to retrieve a list of a user's internal transaction records using the CCPayment API. It includes setting up the request with necessary headers like Appid, Sign, and Timestamp, and handling the response data. ```JavaScript const https = require('https'); const crypto = require('crypto'); const appId = '*** your appId ***'; const appSecret = '*** your appSecret ***'; const path = '***'; const args = JSON.stringify({ 'fromUserId': '1709021102608', # 'toUserId': '1709021101247', # 'coinId': 2523, # 'startAt': 1704042061, # 'endAt': 1708581993, # 'nextId': '' }); const timestamp = Math.floor(Date.now() / 1000); let signText = appId + timestamp; if (args) { signText += args; } const sign = crypto .createHmac('sha256', appSecret) .update(signText) .digest('hex'); const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Appid': appId, 'Sign': sign, 'Timestamp': timestamp.toString(), }, }; const req = https.request(path, options, (res) => { let respData = ''; res.on('data', (chunk) => { respData += chunk; }); res.on('end', () => { console.log('Response:', respData); }); }); req.write(args); req.end(); ``` -------------------------------- ### User Deposit Webhook Request Example Source: https://ccpayment.com/api/doc/index This JSON object represents a webhook payload for a user deposit event. It includes the event type and a message object containing details about the deposit, such as record ID, user ID, coin symbol, amount, and transaction status. ```json { "type": "UserDeposit", "msg": { "recordId": "202403130938151...", "userId": "6322718677975328", "coinId": 1329, "coinSymbol": "MATIC", "amount": "0.1", "status": "Success", "isFlaggedAsRisky":false } } ``` -------------------------------- ### Get User Internal Transaction Record with CCPayment API Source: https://ccpayment.com/api/doc/index This snippet shows how to retrieve a user's internal transaction record using the CCPayment API. It demonstrates making a POST request with authentication headers and providing either a recordId or orderId to query the transaction. ```JavaScript const https = require('https'); const crypto = require('crypto'); const appId ='*** your appId ***'; const appSecret ='*** your appSecret ***'; const path = '***'; const args = JSON.stringify({ 'recordId': '202403010610541763446796748591104', # 'orderId': '1708507495559' }); const timestamp = Math.floor(Date.now() / 1000); let signText = appId + timestamp; ```