### Node.js GET Endpoint Examples Source: https://docs.onramp.money/onramp/logs Provides code examples for interacting with Onramp.money's GET endpoints. These examples are designed to help developers integrate Onramp.money services into their applications using Node.js. ```Node.js // Example for fetching all supported coin details // GET /api/v3/coins // Requires authentication if applicable async function getAllCoinDetails() { const response = await fetch('https://api.onramp.money/api/v3/coins'); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); console.log(data); return data; } // Example for fetching specific coin details (e.g., Bitcoin) // GET /api/v3/coins/{coinId} async function getCoinDetails(coinId) { const response = await fetch(`https://api.onramp.money/api/v3/coins/${coinId}`); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); console.log(data); return data; } // Note: Actual API endpoints and authentication methods may vary. Refer to official documentation. ``` -------------------------------- ### Onramp User Guides Overview Source: https://docs.onramp.money/onramp/merchant-onboarding-flow Collection of user guides for various Onramp functionalities, including resuming transactions, buying/selling crypto, and specific flows like Binance integration. ```APIDOC User Guides: - /onramp/user-guides/resume-transaction-onramp - /onramp/user-guides/resume-transaction-offramp - /onramp/user-guides/resume-transaction-offramp-alternate-bank-account - /onramp/user-guides/buy-crypto - /onramp/user-guides/sell-crypto - /onramp/user-guides/sell-crypto-binance-flow ``` -------------------------------- ### Node.js GET Endpoint Examples Source: https://docs.onramp.money/onramp/logs/change-logs Provides code examples for interacting with Onramp.money's GET endpoints. These examples are designed to help developers integrate Onramp.money services into their applications using Node.js. ```Node.js // Example for fetching all supported coin details // GET /api/v3/coins // Requires authentication if applicable async function getAllCoinDetails() { const response = await fetch('https://api.onramp.money/api/v3/coins'); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); console.log(data); return data; } // Example for fetching specific coin details (e.g., Bitcoin) // GET /api/v3/coins/{coinId} async function getCoinDetails(coinId) { const response = await fetch(`https://api.onramp.money/api/v3/coins/${coinId}`); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); console.log(data); return data; } // Note: Actual API endpoints and authentication methods may vary. Refer to official documentation. ``` -------------------------------- ### Onramp User Guides Overview Source: https://docs.onramp.money/onramp/merchant-checkout-widget/domain-live-widget-guide Guides for users on how to perform various actions within the Onramp service, including resuming transactions, buying and selling crypto, and specific flows like Binance. ```APIDOC User Guides: - Resume Transaction - onramp: /onramp/user-guides/resume-transaction-onramp - Resume Transaction - offramp: /onramp/user-guides/resume-transaction-offramp - Resume Transaction - offramp (Alternate Bank account): /onramp/user-guides/resume-transaction-offramp-alternate-bank-account - Buy Crypto: /onramp/user-guides/buy-crypto - Sell Crypto: /onramp/user-guides/sell-crypto - Sell Crypto - Binance flow: /onramp/user-guides/sell-crypto-binance-flow ``` -------------------------------- ### Onramp Metamask User Guide Source: https://docs.onramp.money/onramp/merchant-onboarding-flow Specific user guides for Metamask users integrating with Onramp, covering common issues and transaction history checks. ```APIDOC Metamask User Guide: - /onramp/metamask/user-guide-for-metamask-users - /onramp/metamask/user-guide-for-metamask-users/payment-done-but-transaction-not-showing - /onramp/metamask/user-guide-for-metamask-users/how-to-check-transaction-history ``` -------------------------------- ### Get Transaction Quotes (Node.js) Source: https://docs.onramp.money/onramp/rest-api-endpoints/quotes-api-offramp This Node.js example demonstrates how to fetch transaction quotes from the Onramp Money API. It uses CryptoJS for signing the request payload and Axios for making the HTTP POST request. Ensure you have `crypto-js` and `axios` installed. ```javascript var CryptoJS = require('crypto-js'); var axios = require('axios'); async function getQuotes() { try { let body = { coinId: 54, coinCode: "usdt", // (if both coinId and coinCode are passed -> coinCode takes precedence) chainId: 3, network: "bep20", //(if both chainId and network are passed -> network takes precedence) fiatType: 1, // Fiat Type from config file(1 for INR || 2 for TRY) type: 2, // 2 -> offramp quantity: 2 // refers to the crypto quantity to be sold }; let payload = { timestamp: new Date().getTime(), body }; let apiKey = 'API_KEY', apiSecret = 'API_SECRET'; payload = Buffer.from(JSON.stringify(payload)).toString('base64'); let signature = CryptoJS.enc.Hex.stringify(CryptoJS.HmacSHA512(payload, apiSecret)); let options = { url: 'https://api.onramp.money/onramp/api/v2/common/transaction/quotes', method: 'POST', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json;charset=UTF-8', 'X-ONRAMP-SIGNATURE': signature, 'X-ONRAMP-APIKEY': apiKey, 'X-ONRAMP-PAYLOAD': payload }, data: body }; let data = await axios(options); console.log(data?.data); } catch (error) { console.log(error?.response?.data); } } getQuotes(); ``` -------------------------------- ### Onramp Money User Guides Source: https://docs.onramp.money/onramp/offramp-widget-integration/sandbox-mode Collection of user guides for various Onramp Money functionalities, including resuming transactions, buying and selling crypto, and specific flows like the Binance integration. ```APIDOC User Guides: - /onramp/user-guides/resume-transaction-onramp - /onramp/user-guides/resume-transaction-offramp - /onramp/user-guides/resume-transaction-offramp-alternate-bank-account - /onramp/user-guides/buy-crypto - /onramp/user-guides/sell-crypto - /onramp/user-guides/sell-crypto-binance-flow ``` -------------------------------- ### Node.js API Examples for GET Endpoints Source: https://docs.onramp.money/onramp/~/changes/XH0ZLTglNU6NMYVKybvm/logs Provides Node.js code examples for interacting with Onramp.money's GET API endpoints. This includes fetching coin details and other data. ```nodejs // Node.js examples for GET API endpoints // This example demonstrates fetching all coin details using Node.js and the 'axios' library. const axios = require('axios'); const API_BASE_URL = 'https://api.onramp.money/v1'; // Replace with actual API base URL const API_KEY = 'YOUR_API_KEY'; async function getAllCoinDetails() { try { const response = await axios.get(`${API_BASE_URL}/coins`, { headers: { 'Authorization': `Bearer ${API_KEY}` } }); console.log('All Coin Details:', response.data); return response.data; } catch (error) { console.error('Error fetching coin details:', error.response ? error.response.data : error.message); throw error; } } // Example Usage: // getAllCoinDetails() // .catch(err => console.error('Failed to get coin details.')); async function getMerchantHistory(merchantId) { try { const response = await axios.get(`${API_BASE_URL}/merchants/${merchantId}/history`, { headers: { 'Authorization': `Bearer ${API_KEY}` } }); console.log(`Merchant History for ${merchantId}:`, response.data); return response.data; } catch (error) { console.error(`Error fetching merchant history for ${merchantId}:`, error.response ? error.response.data : error.message); throw error; } } // Example Usage: // getMerchantHistory('merchantXYZ') // .catch(err => console.error('Failed to get merchant history.')); ``` -------------------------------- ### Node.js API Examples for GET Endpoints Source: https://docs.onramp.money/onramp/~/changes/XH0ZLTglNU6NMYVKybvm/logs/change-logs Provides Node.js code examples for interacting with Onramp.money's GET API endpoints. This includes fetching coin details and other data. ```nodejs // Node.js examples for GET API endpoints // This example demonstrates fetching all coin details using Node.js and the 'axios' library. const axios = require('axios'); const API_BASE_URL = 'https://api.onramp.money/v1'; // Replace with actual API base URL const API_KEY = 'YOUR_API_KEY'; async function getAllCoinDetails() { try { const response = await axios.get(`${API_BASE_URL}/coins`, { headers: { 'Authorization': `Bearer ${API_KEY}` } }); console.log('All Coin Details:', response.data); return response.data; } catch (error) { console.error('Error fetching coin details:', error.response ? error.response.data : error.message); throw error; } } // Example Usage: // getAllCoinDetails() // .catch(err => console.error('Failed to get coin details.')); async function getMerchantHistory(merchantId) { try { const response = await axios.get(`${API_BASE_URL}/merchants/${merchantId}/history`, { headers: { 'Authorization': `Bearer ${API_KEY}` } }); console.log(`Merchant History for ${merchantId}:`, response.data); return response.data; } catch (error) { console.error(`Error fetching merchant history for ${merchantId}:`, error.response ? error.response.data : error.message); throw error; } } // Example Usage: // getMerchantHistory('merchantXYZ') // .catch(err => console.error('Failed to get merchant history.')); ``` -------------------------------- ### Onramp User Guides Source: https://docs.onramp.money/onramp/rest-api-endpoints/current-timestamp/synchronisation-troubleshooting-guide Provides user guides for various operations within the Onramp service, including resuming transactions, buying/selling crypto, and specific flows like Binance integration. ```APIDOC User Guides: - /onramp/user-guides/resume-transaction-onramp: Guide for resuming onramp transactions. - /onramp/user-guides/resume-transaction-offramp: Guide for resuming offramp transactions. - /onramp/user-guides/resume-transaction-offramp-alternate-bank-account: Guide for resuming offramp transactions with alternate bank accounts. - /onramp/user-guides/buy-crypto: General guide on how to buy cryptocurrency. - /onramp/user-guides/sell-crypto: General guide on how to sell cryptocurrency. - /onramp/user-guides/sell-crypto-binance-flow: Specific guide for selling crypto using the Binance flow. ``` -------------------------------- ### Get History API Endpoint - Node.js Example Source: https://docs.onramp.money/onramp/crypto-merchant-widget/get-history Node.js example demonstrating how to call the Get History API endpoint. It includes generating the payload and signature using CryptoJS and making the request with axios. ```Node.js const CryptoJS = require('crypto-js'); const axios = require('axios'); async function getHistory(apiKey, apiSecret) { try { let body = { "page": "0" }; let payload = { timestamp: new Date().getTime(), body }; payload = Buffer.from(JSON.stringify(payload)).toString('base64'); let signature = CryptoJS.enc.Hex.stringify(CryptoJS.HmacSHA512(payload, apiSecret)); let options = { url: 'https://api.onramp.money/onramp-merchants/widget/getHistory', method: 'POST', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json;charset=UTF-8', 'X-ONRAMP-SIGNATURE': signature, 'X-ONRAMP-APIKEY': apiKey, 'X-ONRAMP-PAYLOAD': payload }, data: body }; let response = await axios(options); console.log(response?.data); } catch (error) { console.log(error?.response?.data); } } // Example usage (replace with your actual apiKey and apiSecret): // getHistory('YOUR_API_KEY', 'YOUR_API_SECRET'); ``` -------------------------------- ### JavaScript Onramp Widget Initialization and Launch Source: https://docs.onramp.money/onramp/~/changes/XH0ZLTglNU6NMYVKybvm/onramp-widget-integration/overlay-mode/overlay-mode-guide This JavaScript code initializes the Onramp Web SDK and sets up an event listener for the launch button. It imports the SDK, creates an instance with necessary parameters, and calls the 'show()' method when the button is clicked. ```Javascript import { OnrampWebSDK } from ''; window.OnrampWebSDK = OnrampWebSDK; const onrampInstance = new OnrampWebSDK({ appId: 1, merchantRecognitionId: "some string", paymentMethod: 1, }); document.getElementById('showOnramp').addEventListener('click', () => { onrampInstance.show(); }); ``` -------------------------------- ### Onramp Money User Guides Source: https://docs.onramp.money/onramp/logs Guides for users on performing various operations within the Onramp Money platform, including resuming transactions, buying and selling crypto, and specific flows like Binance integration. ```APIDOC User Guides: - /onramp/user-guides/resume-transaction-onramp: Guide to resuming onramp transactions. - /onramp/user-guides/resume-transaction-offramp: Guide to resuming offramp transactions. - /onramp/user-guides/resume-transaction-offramp-alternate-bank-account: Guide for offramp transactions with alternate bank accounts. - /onramp/user-guides/buy-crypto: Guide on how to buy cryptocurrency. - /onramp/user-guides/sell-crypto: Guide on how to sell cryptocurrency. - /onramp/user-guides/sell-crypto-binance-flow: Specific guide for selling crypto via the Binance flow. ``` -------------------------------- ### Get History API Endpoint - Python Example Source: https://docs.onramp.money/onramp/crypto-merchant-widget/get-history Python example demonstrating how to call the Get History API endpoint. It utilizes standard libraries for base64 encoding, JSON handling, HMAC-SHA512 hashing, and making HTTP requests. ```Python import base64 import json import time import hmac import hashlib import requests def get_history(api_key, api_secret): url = 'https://api.onramp.money/onramp-merchants/widget/getHistory' body = { "page": "0" } payload_data = { "timestamp": int(time.time() * 1000), "body": body } payload_json = json.dumps(payload_data) payload_base64 = base64.b64encode(payload_json.encode('utf-8')).decode('utf-8') signature = hmac.new(api_secret.encode('utf-8'), payload_base64.encode('utf-8'), hashlib.sha512).hexdigest() headers = { 'Accept': 'application/json', 'Content-Type': 'application/json;charset=UTF-8', 'X-ONRAMP-SIGNATURE': signature, 'X-ONRAMP-APIKEY': api_key, 'X-ONRAMP-PAYLOAD': payload_base64 } try: response = requests.post(url, headers=headers, json=body) response.raise_for_status() # Raise an exception for bad status codes print(response.json()) except requests.exceptions.RequestException as e: print(f"Error: {e}") if e.response is not None: print(f"Response data: {e.response.text}") # Example usage (replace with your actual api_key and api_secret): # get_history('YOUR_API_KEY', 'YOUR_API_SECRET') ``` -------------------------------- ### Get Order Request Example (Python) Source: https://docs.onramp.money/onramp/crypto-merchant-widget/get-order Provides the necessary imports for making a request to the Get Order API endpoint using Python. ```python import base64 import json import time import hmac import hashlib import requests # The rest of the Python implementation would follow here, including payload generation, signing, and making the request. ``` -------------------------------- ### Example Onramp.money Swap URL Source: https://docs.onramp.money/onramp/swap-widget-integration/hosted-mode An example of a constructed URL for initiating a swap transaction on Onramp.money, demonstrating the use of various pre-fillable parameters. ```URL https://onramp.money/main/swap/?appId=1&sellAmount=12&sellCoinCode=usdt&receiveCoinCode=usdc&sellNetwork=bep20&receiveNetwork=matic20 ``` -------------------------------- ### Get Order Request Example Source: https://docs.onramp.money/onramp/crypto-merchant-widget/get-order Demonstrates how to construct and send a request to the Get Order API endpoint using Node.js, including payload signing. ```javascript const CryptoJS = require('crypto-js'); const axios = require('axios'); async function getOrder(apiKey, apiSecret, orderId, hash) { try { let body = { orderId: orderId, // Provide either orderId or hash hash: hash }; let payload = { timestamp: new Date().getTime(), body: body }; payload = Buffer.from(JSON.stringify(payload)).toString('base64'); let signature = CryptoJS.enc.Hex.stringify(CryptoJS.HmacSHA512(payload, apiSecret)); let options = { url: 'https://api.onramp.money/onramp-merchants/widget/getOrder', method: 'POST', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json;charset=UTF-8', 'X-ONRAMP-SIGNATURE': signature, 'X-ONRAMP-APIKEY': apiKey, 'X-ONRAMP-PAYLOAD': payload }, data: body }; let response = await axios(options); console.log(response?.data); } catch (error) { console.log(error?.response?.data); } } // Example usage (replace with your actual keys and order details): // const apiKey = 'YOUR_API_KEY'; // const apiSecret = 'YOUR_API_SECRET'; // const orderId = 'some_order_id'; // or const hash = 'some_hash'; // getOrder(apiKey, apiSecret, orderId, null); ``` -------------------------------- ### Onramp Money User Guides Source: https://docs.onramp.money/onramp/logs/change-logs Guides for users on performing various operations within the Onramp Money platform, including resuming transactions, buying and selling crypto, and specific flows like Binance integration. ```APIDOC User Guides: - /onramp/user-guides/resume-transaction-onramp: Guide to resuming onramp transactions. - /onramp/user-guides/resume-transaction-offramp: Guide to resuming offramp transactions. - /onramp/user-guides/resume-transaction-offramp-alternate-bank-account: Guide for offramp transactions with alternate bank accounts. - /onramp/user-guides/buy-crypto: Guide on how to buy cryptocurrency. - /onramp/user-guides/sell-crypto: Guide on how to sell cryptocurrency. - /onramp/user-guides/sell-crypto-binance-flow: Specific guide for selling crypto via the Binance flow. ``` -------------------------------- ### Example Onramp.money Swap URL Source: https://docs.onramp.money/onramp/swap-widget-integration An example of a constructed URL for initiating a swap transaction on Onramp.money, demonstrating the use of various pre-fillable parameters. ```URL https://onramp.money/main/swap/?appId=1&sellAmount=12&sellCoinCode=usdt&receiveCoinCode=usdc&sellNetwork=bep20&receiveNetwork=matic20 ``` -------------------------------- ### Fetch Coin Details (Node.js) Source: https://docs.onramp.money/onramp/~/changes/XH0ZLTglNU6NMYVKybvm/onramp-widget-integration/allconfig-all-coin-details/coindetails-price-details-for-desired-amount Example using Axios to call the Get Coin Details API in Node.js. It sends a GET request with specified parameters and logs the JSON response or any errors. ```javascript const axios = require('axios'); const coinDetails = async (coinCode, chainId, fiatAmount, fiatType) => { try { const response = await axios.get( `https://api.onramp.money/onramp/api/v3/buy/public/coinDetails?coinCode=${coinCode}&chainId=${chainId}&fiatAmount=${fiatAmount}&fiatType=${fiatType}` ); console.log(JSON.stringify(response.data, null, 2)); } catch (error) { console.error(`Error: ${error}`); } }; coinDetails('usdt', '3', '100', '1'); ``` -------------------------------- ### Fetch Coin Details (Python) Source: https://docs.onramp.money/onramp/~/changes/XH0ZLTglNU6NMYVKybvm/onramp-widget-integration/allconfig-all-coin-details/coindetails-price-details-for-desired-amount Example using the requests library to call the Get Coin Details API in Python. It sends a GET request with specified parameters and prints the JSON response or an error message. ```python import requests def coin_details(coinCode, chainId, fiatAmount, fiatType): url = f'https://api.onramp.money/onramp/api/v3/buy/public/coinDetails?coinCode={coinCode}&chainId={chainId}&fiatAmount={fiatAmount}&fiatType={fiatType}' response = requests.get(url) if response.status_code == 200: print(response.json()) else: print(f"Request failed with status code {response.status_code}") coin_details('usdt', 3, 100, 1) ``` -------------------------------- ### Initialize and Use Onramp SDK Source: https://docs.onramp.money/onramp/onramp-widget-integration/overlay-mode Demonstrates how to create an instance of the Onramp Web SDK with essential configuration parameters and how to control the widget's visibility. Key parameters include appId, walletAddress, flowType, fiatType, paymentMethod, and language. ```javascript const onrampInstance = new OnrampWebSDK({ appId: 1, // replace this with the appID you got during onboarding process walletAddress: '0x495f519017eF0368e82Af52b4B64461542a5430B', // replace with user's wallet address flowType: 1, // 1 -> onramp || 2 -> offramp || 3 -> Merchant checkout fiatType: 1, // 1 -> INR || 2 -> TRY || 3 -> AED || 4 -> MXN || 5-> VND || 6 -> NGN etc. paymentMethod: 1, // 1 -> Instant transafer(UPI) || 2 -> Bank transfer(IMPS/FAST) lang: 'vi', // for more lang values refer theme: { lightMode: { baseColor: string; // * required (hex code e.g. #XXXXXX) inputRadius: string; //optional (in px e.g. 20px) buttonRadius: string; //optional (in px e.g. 10px) }, darkMode: { baseColor: string; // * required (hex code e.g. #XXXXXX) inputRadius: string; //optional (in px e.g. 20px) buttonRadius: string; //optional (in px e.g. 10px) }, defaultMode?:'lightMode' | 'darkMode' //optional }, widgetUrl:string,//can pass valid onramp.money urls. pass the kycUrl response from api to this. isRestricted:boolean; //true by default. hides navigation UI. // ... pass other configs }); // when you are ready to show the widget, call show method onrampInstance.show(); // to close the widget, call close method onrampInstance.close(); ``` -------------------------------- ### Onramp Money User Guides Source: https://docs.onramp.money/onramp/supported-assets-and-fiat Guides for users on performing various transactions and operations within the Onramp Money platform, including resuming transactions and buying/selling crypto. ```APIDOC User Guides: - Resume Transaction (onramp): Guide for resuming onramp transactions. - Resume Transaction (offramp): Guide for resuming offramp transactions. - Resume Transaction (offramp - Alternate Bank account): Specific guide for offramp transactions with alternate bank accounts. - Buy Crypto: Instructions on how to buy cryptocurrency. - Sell Crypto: Instructions on how to sell cryptocurrency. - Sell Crypto - Binance flow: Specific guide for selling crypto using the Binance flow. ``` -------------------------------- ### Get Current Timestamp (Node.js) Source: https://docs.onramp.money/onramp/rest-api-endpoints/current-timestamp Example using Axios to fetch the current timestamp from the server. Handles successful responses and errors. ```javascript const axios = require('axios'); const currentTimestamp = async () => { try { const response = await axios.get(`https://api.onramp.money/onramp/api/v2/common/public/currentTimestamp`); console.log(JSON.stringify(response.data, null, 2)); } catch (error) { console.error(`Error: ${error}`); } }; currentTimestamp(); ``` -------------------------------- ### Onramp Money User Guides Source: https://docs.onramp.money/onramp/supported-assets-and-fiat/crypto-assets Guides for users on performing various transactions and operations within the Onramp Money platform, including resuming transactions and buying/selling crypto. ```APIDOC User Guides: - Resume Transaction (onramp): Guide for resuming onramp transactions. - Resume Transaction (offramp): Guide for resuming offramp transactions. - Resume Transaction (offramp - Alternate Bank account): Specific guide for offramp transactions with alternate bank accounts. - Buy Crypto: Instructions on how to buy cryptocurrency. - Sell Crypto: Instructions on how to sell cryptocurrency. - Sell Crypto - Binance flow: Specific guide for selling crypto using the Binance flow. ``` -------------------------------- ### Onramp.money Redirect Response Example Source: https://docs.onramp.money/onramp/~/changes/XH0ZLTglNU6NMYVKybvm/onramp-widget-integration/hosted-mode Illustrates the format of the redirect URL provided by Onramp.money after a transaction is completed, including order ID and status. ```URL //after successful transaction http://onramp-example.com?orderId=123&status=success //incase transaction is pending http://onramp-example.com?orderId=123&status=pending ``` -------------------------------- ### Initialize and Use Onramp SDK Source: https://docs.onramp.money/onramp/~/changes/XH0ZLTglNU6NMYVKybvm/offramp-widget-integration/user-flow/overlay-mode Demonstrates how to import the SDK, create an instance with configuration options, display the widget, and close it. Configuration includes appId, coinCode, network, fiatAmount, and flowType. ```javascript import { OnrampWebSDK } from '@onramp.money/onramp-web-sdk'; const onrampInstance = new OnrampWebSDK({ appId: 1, // replace this with the appID you got during onboarding process coinCode: "usdt", network: "erc20", fiatAmount: 1000, flowType: 2 // 1 -> onramp || 2 -> offramp || 3 -> Merchant checkout // ... pass other configs here }); // when you are ready to show the widget, call show method onrampInstance.show(); // to close the widget, call close method onrampInstance.close(); ``` -------------------------------- ### Python: Fetch Coin Networks Configuration Source: https://docs.onramp.money/onramp/~/changes/XH0ZLTglNU6NMYVKybvm/onramp-widget-integration/allconfig-all-coin-details/coinnetwork-get-all-supported-networks Provides a Python example for retrieving cryptocurrency network configurations using the requests library. It constructs the API URL with coinCode and fiatType, sends a GET request, and prints the JSON response if the request is successful (status code 200), otherwise reports the failure. ```python import requests def coin_networks(coinCode, fiatType): url = f'https://api.onramp.money/onramp/api/v3/buy/public/coinNetworks?coinCode={coinCode}&fiatType={fiatType}' response = requests.get(url) if response.status_code == 200: print(response.json()) else: print(f"Request failed with status code {response.status_code}") coin_networks('usdt', '1') ``` -------------------------------- ### Get Current Timestamp (Python) Source: https://docs.onramp.money/onramp/rest-api-endpoints/current-timestamp Example using the requests library to fetch the current timestamp from the server. Checks the status code and prints the JSON response or an error message. ```python import requests def current_timestamp(): url = 'https://api.onramp.money/onramp/api/v2/common/public/currentTimestamp' response = requests.get(url) if response.status_code == 200: print(response.json()) else: print(f"Request failed with status code {response.status_code}") current_timestamp() ``` -------------------------------- ### Install Onramp Money SDK Source: https://docs.onramp.money/onramp/onramp-widget-integration/overlay-mode Instructions for installing the Onramp Money Web SDK using package managers like npm or yarn. This is the recommended method for adding the SDK to your project. ```bash # npm $ npm install @onramp.money/onramp-web-sdk # yarn $ yarn add @onramp.money/onramp-web-sdk ``` -------------------------------- ### Initialize and Control Onramp SDK Widget Source: https://docs.onramp.money/onramp/offramp-widget-integration/user-flow/overlay-mode Demonstrates the basic usage of the OnrampWebSDK by creating an instance with essential configuration parameters and controlling the widget's display. It shows how to initialize the SDK with an object containing `appId`, `coinCode`, `network`, `fiatAmount`, and `flowType`, and then how to call `.show()` to display the widget and `.close()` to hide it. ```javascript const onrampInstance = new OnrampWebSDK({ appId: 1, // replace this with the appID you got during onboarding process coinCode: "usdt", network: "erc20", fiatAmount: 1000, flowType: 2 // 1 -> onramp || 2 -> offramp || 3 -> Merchant checkout // ... pass other configs here }); // when you are ready to show the widget, call show method onrampInstance.show(); // to close the widget, call close method onrampInstance.close(); ```