### Install CryptAPI NodeJS Library Source: https://github.com/cryptapi/nodejs-cryptapi/blob/main/README.md Installs the CryptAPI NodeJS library using npm. This is the first step to integrate CryptAPI's payment gateway into your Node.js application. ```console npm install @cryptapi/api ``` -------------------------------- ### CryptAPI NodeJS: Get Supported Coins Source: https://github.com/cryptapi/nodejs-cryptapi/blob/main/README.md Retrieves a list of all cryptocurrencies supported by CryptAPI. The response is an array containing the supported coin identifiers. ```js const supportedCoins = await CryptAPI.getSupportedCoins() ``` -------------------------------- ### CryptAPI API Reference Source: https://github.com/cryptapi/nodejs-cryptapi/blob/main/README.md This section outlines the core functionalities of the CryptAPI, including creating payment addresses, handling callbacks, checking logs, generating QR codes, estimating fees, and currency conversions. It details the parameters and expected responses for each operation, referencing the official CryptAPI documentation for comprehensive details. ```APIDOC CryptAPI: __init__(coin: str, myAddress: str, callbackUrl: str, params: dict = None, cryptapiParams: dict = None) Initializes the CryptAPI client. - coin: The cryptocurrency to use (e.g., 'btc', 'eth'). - myAddress: Your personal crypto address for receiving funds. - callbackUrl: The URL to receive payment notifications. - params: Optional dictionary for payment identification (e.g., {'orderId': 1234}). - cryptapiParams: Optional dictionary for CryptAPI specific parameters (e.g., {'post': 1}). getAddress(): Generates a new payment address. Returns: The newly generated payment address. Reference: https://docs.cryptapi.io/#operation/create checkLogs(): Retrieves logs for a request. Returns: Log data for the request. Reference: https://docs.cryptapi.io/#operation/logs getQrcode(value: str = None, size: int = None): Generates a QR code for a payment address. - value: The payment amount to include in the QR code (optional). - size: The size of the QR code image in pixels (optional, defaults to 512). Returns: An object containing 'qr_code' (base64 encoded image) and 'payment_uri'. Reference: https://docs.cryptapi.io/#operation/qrcode getEstimate(coin: str, addresses: int = 1, priority: str = 'default'): Estimates transaction fees. - coin: The cryptocurrency to check fees for. - addresses: The number of addresses to forward funds to (defaults to 1). - priority: Confirmation priority (e.g., 'default', 'low', 'high'). Returns: An object with 'estimated_cost' and 'estimated_cost_usd'. Reference: https://docs.cryptapi.io/#operation/estimate getConvert(coin: str, value: float, from: str): Converts between cryptocurrencies and fiat. - coin: The target currency to convert to. - value: The value to convert. - from: The currency to convert from (FIAT or crypto). Returns: An object with 'value_coin' and 'exchange_rate'. Reference: https://docs.cryptapi.io/#operation/convert getSupportedCoins(): Retrieves a list of all supported coins. Returns: An array of supported coin identifiers. ``` -------------------------------- ### Import CryptAPI in NodeJS Source: https://github.com/cryptapi/nodejs-cryptapi/blob/main/README.md Demonstrates how to import the CryptAPI library into your Node.js project file. This allows you to access its functionalities. ```js const CryptAPI = require('@cryptapi/api') ``` -------------------------------- ### CryptAPI NodeJS: Estimate Transaction Fees Source: https://github.com/cryptapi/nodejs-cryptapi/blob/main/README.md Estimates transaction fees for a given cryptocurrency. It allows specifying the number of recipient addresses and the confirmation priority. The response provides the estimated cost in the specified coin and its USD equivalent. ```js const fees = await CryptAPI.getEstimate(coin, addresses, priority) ``` -------------------------------- ### CryptAPI NodeJS: Check Payment Logs Source: https://github.com/cryptapi/nodejs-cryptapi/blob/main/README.md Retrieves logs for a specific CryptAPI request. This function helps in debugging and monitoring payment transactions. It uses the same initialization parameters as generating an address. ```js const ca = new CryptAPI(coin, myAddress, callbackUrl, params, cryptapiParams) const data = await ca.checkLogs() ``` -------------------------------- ### CryptAPI NodeJS: Convert Currency Source: https://github.com/cryptapi/nodejs-cryptapi/blob/main/README.md Converts a value between different cryptocurrencies or between a cryptocurrency and fiat. It requires the target currency, the value to convert, and the currency to convert from. The response includes the converted value and the exchange rate. ```js const conversion = await CryptAPI.getConvert(coin, value, from) ``` -------------------------------- ### CryptAPI NodeJS: Generate QR Code Source: https://github.com/cryptapi/nodejs-cryptapi/blob/main/README.md Generates a QR code for a payment address obtained from `getAddress()`. It allows specifying the payment value and the size of the QR code image. The response includes the base64 encoded QR code image and the payment URI. ```js const ca = new CryptAPI(coin, myAddress, callbackUrl, params, cryptapiParams) const address = await ca.getAddress() // ... const qrCode = await ca.getQrcode(value, size) ``` -------------------------------- ### CryptAPI NodeJS: Generate Payment Address Source: https://github.com/cryptapi/nodejs-cryptapi/blob/main/README.md Generates a new payment address for a specified cryptocurrency using the CryptAPI NodeJS library. It requires coin type, your receiving address, a callback URL for payment notifications, and optional parameters for payment identification and CryptAPI configuration. ```js const ca = new CryptAPI(coin, myAddress, callbackUrl, params, cryptapiParams) const address = await ca.getAddress() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.