### Install OxaPay Python SDK Source: https://github.com/oxapay/oxapay-python/blob/main/README.md Installs the OxaPay Python SDK using pip. This is the first step to integrating OxaPay services into your Python application. ```bash pip install oxapay ``` -------------------------------- ### Initialize OxaPay Payment Module in Python Source: https://context7.com/oxapay/oxapay-python/llms.txt Initializes the Payment module for handling cryptocurrency payment operations. Requires a merchant API key obtained from the OxaPay dashboard. This setup is the first step before using any payment-related methods. ```python from oxapay import Payment # Initialize with merchant key from OxaPay dashboard merchant_key = '2SV7MF-OXAPAY-WZM7XG-5VI64K' payment = Payment(merchant_key) # Now ready to use payment methods ``` -------------------------------- ### Get Current Cryptocurrency Prices (Python) Source: https://context7.com/oxapay/oxapay-python/llms.txt Retrieves real-time prices for all supported cryptocurrencies in USD. This function requires the 'oxapay' library to be installed. It returns a dictionary where keys are currency codes and values are their current prices. ```python from oxapay import Common common = Common() try: result = common.price() for currency, price in result.items(): print(f"{currency}: ${price}") # Expected output: # { # "BTC": 94876.5500000000, # "ETH": 3301.4500000000, # "USDT": 1.0000000000, # "TRX": 0.2422000000, # "BNB": 695.7900000000, # ... # } except Exception as e: print(f"Error fetching prices: {e}") ``` -------------------------------- ### Get Supported Currencies with Python Source: https://github.com/oxapay/oxapay-python/blob/main/README.md Retrieves a comprehensive list of all currencies supported by the OxaPay service. This includes details about each currency's symbol, name, status, and available networks with their specific parameters such as confirmation requirements and fees. Requires an initialized Common object from the Oxapay SDK. ```python from oxapay import Common oxapay_service = Common() result = oxapay_service.supported_currencies() print(result) ``` -------------------------------- ### Get Asset Prices with Python Source: https://github.com/oxapay/oxapay-python/blob/main/README.md Retrieves the current market prices for a range of supported digital assets. The output is a dictionary mapping asset symbols to their current price in a default currency. Requires an initialized Common object. ```python from oxapay import Common oxapay_service = Common() result = oxapay_service.price() print(result) ``` -------------------------------- ### Get Supported Currencies - Python Source: https://context7.com/oxapay/oxapay-python/llms.txt Retrieves detailed information about all cryptocurrencies supported by OxaPay including network details, withdrawal fees, and minimum deposit amounts. Requires Common instance without authentication. Returns dictionary mapping currency symbols to detailed information including networks, fees, and status. ```python from oxapay import Common common = Common() try: result = common.supported_currencies() for symbol, info in result.items(): print(f"\n{info['name']} ({symbol})") print(f"Status: {'Active' if info['status'] else 'Inactive'}") for network_key, network in info['networks'].items(): print(f" Network: {network['name']}") print(f" Withdraw Fee: {network['withdraw_fee']}") print(f" Min Deposit: {network['deposit_min']}") except Exception as e: print(f"Error fetching currencies: {e}") ``` -------------------------------- ### Get Supported Networks with Python Source: https://github.com/oxapay/oxapay-python/blob/main/README.md Fetches a list of all blockchain networks supported by the OxaPay platform. This is useful for determining which networks are available for transactions. The function returns a simple list of network names. Requires an initialized Common object. ```python from oxapay import Common oxapay_service = Common() result = oxapay_service.supported_networks() print(result) ``` -------------------------------- ### Python: Get Account Balance Source: https://context7.com/oxapay/oxapay-python/llms.txt Retrieves the current balance of all cryptocurrencies in the OxaPay account. Requires an initialized General module with a valid general key. ```python from oxapay import General general_key = '2SV7MF-ISVQSV-WZM7XG-OXAPAY' general = General(general_key) try: result = general.get_account_balance() for currency, balance in result.items(): if balance > 0: print(f"{currency}: {balance}") # Expected output: # { # "BTC": 2.3502949200, # "ETH": 0.0000000000, # "USDT": 10746.7139400000, # "TRX": 0.0000000000, # ... # } except Exception as e: print(f"Error fetching balance: {e}") ``` -------------------------------- ### Get Supported Networks - Python Source: https://context7.com/oxapay/oxapay-python/llms.txt Retrieves a list of all blockchain networks supported by OxaPay for cryptocurrency transactions. Requires Common instance without authentication. Returns object containing array of supported network names. ```python from oxapay import Common common = Common() try: result = common.supported_networks() print("Supported Networks:") for network in result['list']: print(f" - {network}") except Exception as e: print(f"Error fetching networks: {e}") ``` -------------------------------- ### Get Swap Pairs - Python Source: https://context7.com/oxapay/oxapay-python/llms.txt Retrieves a complete list of all available cryptocurrency pairs supported for swapping, including minimum swap amounts for each pair. Requires General instance with API key. Returns array of pair objects containing source currency, destination currency, and minimum swap amount. ```python from oxapay import General general_key = '2SV7MF-ISVQSV-WZM7XG-OXAPAY' general = General(general_key) try: result = general.swap_pairs() for pair in result: print(f"{pair['from']} -> {pair['to']}: Min amount {pair['min_amount']}") except Exception as e: print(f"Error fetching swap pairs: {e}") ``` -------------------------------- ### Get Swap Rate - Python Source: https://context7.com/oxapay/oxapay-python/llms.txt Fetches the current exchange rate between two specified cryptocurrencies. Requires General instance with API key and accepts source and destination currency codes. Returns the real-time conversion rate for the currency pair. ```python from oxapay import General general_key = '2SV7MF-ISVQSV-WZM7XG-OXAPAY' general = General(general_key) data = { "from_currency": "BTC", "to_currency": "USDT" } try: result = general.swap_rate(data) print(f"Current rate: 1 {data['from_currency']} = {result['rate']} {data['to_currency']}") except Exception as e: print(f"Error fetching swap rate: {e}") ``` -------------------------------- ### Get Account Balance API Source: https://github.com/oxapay/oxapay-python/blob/main/README.md Retrieve the current balance of all cryptocurrencies held in your Oxapay account. ```APIDOC ## GET /general/balance ### Description Retrieves the account balance for all supported cryptocurrencies. ### Method GET ### Endpoint /general/balance ### Response #### Success Response (200) A JSON object where keys are currency symbols (e.g., 'BTC', 'USDT') and values are their corresponding balances (number). #### Response Example ```json [ "BNB": 0.0000000000, "DGB": 0.0000000000, "XMR": 0.0000000000, "BTC": 2.3502949200, "ETH": 0.0000000000, "USDC": 0.0000000000, "POL": 0.0000000000, "SOL": 0.0000000000, "NOT": 0.0000000000, "SHIB": 0.0000000000, "TRX": 0.0000000000, "USDT": 10746.7139400000, "DOGS": 0.0000000000, "TON": 0.0000000000, "BCH": 0.0000000000, "DOGE": 0.0000000000, "LTC": 0.0000000000 ] ``` ``` -------------------------------- ### Python: Get Payout History Source: https://context7.com/oxapay/oxapay-python/llms.txt Retrieves a paginated list of all payout transactions with optional filtering by status, currency, network, amount, and sorting options. Requires a payout key. ```python from oxapay import Payout payout_key = '2SV7MF-ISVQSV-OXAPAY-5VI64K' payout = Payout(payout_key) params = { "status": "completed", "currency": "BTC", "network": "Bitcoin Network", "from_amount": 0.001, "sort_by": "create_date", "sort_type": "desc", "page": 1, "size": 20 } try: result = payout.payout_history(params) for transaction in result: print(f"Track ID: {transaction['track_id']}") print(f"Amount: {transaction['amount']} {transaction['currency']}") print(f"Status: {transaction['status']}") print("---") except Exception as e: print(f"Error fetching payout history: {e}") ``` -------------------------------- ### Get Swap History - Python Source: https://context7.com/oxapay/oxapay-python/llms.txt Retrieves paginated history of all swap transactions with optional filtering by status, amount range, and sorting options. Requires General instance with API key and accepts parameters for pagination, filtering, and sorting. Returns array of swap transaction objects with details including track ID, amounts, and currencies. ```python from oxapay import General general_key = '2SV7MF-ISVQSV-WZM7XG-OXAPAY' general = General(general_key) params = { "status": "completed", "from_amount": 0.01, "page": 1, "size": 20, "sort_by": "create_date", "sort_type": "desc" } try: result = general.swap_history(params) for swap in result: print(f"Track ID: {swap['track_id']}") print(f"{swap['from_amount']} {swap['from_currency']} -> {swap['to_amount']} {swap['to_currency']}") print("---") except Exception as e: print(f"Error fetching swap history: {e}") ``` -------------------------------- ### Get Payout Transaction Information (Python) Source: https://github.com/oxapay/oxapay-python/blob/main/README.md Retrieves the status and details of a specific payout transaction using its track ID. This is useful for monitoring the progress of a payout request. ```python track_id = 258298451 result = payout.payout_information(track_id) print(result) ``` -------------------------------- ### Python: Get Payout Information Source: https://context7.com/oxapay/oxapay-python/llms.txt Retrieves detailed information about a specific payout transaction using its track ID. Returns details such as address, amount, fees, status, and transaction hash. Requires a payout key. ```python from oxapay import Payout payout_key = '2SV7MF-ISVQSV-OXAPAY-5VI64K' payout = Payout(payout_key) track_id = "258298451" try: result = payout.payout_information(track_id) print(f"Address: {result['address']}") print(f"Amount: {result['amount']} {result['currency']}") print(f"Fee: {result['fee']}") print(f"Status: {result['status']}") print(f"TX Hash: {result['tx_hash']}") # Expected output: # { # "track_id": "258298351", # "address": "1AmH3Qz2LooYa1YSyLhySuatwoRMsfznPJ", # "currency": "BTC", # "network": "Bitcoin Network", # "amount": 0.0200000000, # "fee": 0.0000100000, # "status": "processing", # "tx_hash": "", # "date": 1736501470 # } except Exception as e: print(f"Error fetching payout info: {e}") ``` -------------------------------- ### Get Supported Fiat Currencies (Python) Source: https://context7.com/oxapay/oxapay-python/llms.txt Retrieves a list of fiat currencies supported by the OxaPay system for payment amounts. The function depends on the 'oxapay' library and returns a list of dictionaries, each containing the 'code' and 'name' of a supported fiat currency. ```python from oxapay import Common common = Common() try: result = common.supported_fiat_currencies() print("Supported Fiat Currencies:") for currency in result: print(f" - {currency['code']}: {currency['name']}") except Exception as e: print(f"Error fetching fiat currencies: {e}") ``` -------------------------------- ### Get Payment Transaction History (Python) Source: https://github.com/oxapay/oxapay-python/blob/main/README.md Retrieves detailed information for a specific payment transaction using its track ID. This function requires the 'payment' object and a valid transaction track ID as input. ```python track_id = 184747701 result = payment.payment_history(track_id) print(result) ``` -------------------------------- ### Get Paginated Payment History with Python Source: https://context7.com/oxapay/oxapay-python/llms.txt Retrieves a paginated list of payment transactions. This function allows filtering by status, currency, network, and amount ranges. It returns a list of transactions, each with details like track ID, amount, and status. ```python from oxapay import Payment merchant_key = '2SV7MF-OXAPAY-WZM7XG-5VI64K' payment = Payment(merchant_key) params = { "status": "paid", "currency": "USD", "from_amount": 10, "to_amount": 1000, "page": 1, "size": 20 } try: result = payment.payment_history(params) for transaction in result: print(f"Track ID: {transaction['track_id']}") print(f"Amount: {transaction['amount']} {transaction['currency']}") print(f"Status: {transaction['status']}") print("---") except Exception as e: print(f"Error fetching payment history: {e}") ``` -------------------------------- ### Initialize OxaPay General Client Source: https://github.com/oxapay/oxapay-python/blob/main/README.md Initializes the General client for the OxaPay Python SDK. Requires a General Key for authentication. ```python from oxapay import General General_key = '2SV7MF-ISVQSV-WZM7XG-OXAPAY' general = General(General_key) ``` -------------------------------- ### Initialize OxaPay Payout Client Source: https://github.com/oxapay/oxapay-python/blob/main/README.md Initializes the Payout client for the OxaPay Python SDK. Requires a Payout Key for authentication. ```python from oxapay import Payout Payout_key = '2SV7MF-ISVQSV-OXAPAY-5VI64K' payout = Payout(Payout_key) ``` -------------------------------- ### Initialize OxaPay Payment Client Source: https://github.com/oxapay/oxapay-python/blob/main/README.md Initializes the Payment client for the OxaPay Python SDK. Requires a Merchant Key for authentication. ```python from oxapay import Payment Merchant_key = '2SV7MF-OXAPAY-WZM7XG-5VI64K' payment = Payment(Merchant_key) ``` -------------------------------- ### Python: Initialize General Module Source: https://context7.com/oxapay/oxapay-python/llms.txt Initializes the General module for account management operations like checking balances and currency swaps. Requires a general key obtained from the OxaPay dashboard. ```python from oxapay import General # Initialize with general key from OxaPay dashboard general_key = '2SV7MF-ISVQSV-WZM7XG-OXAPAY' general = General(general_key) # Now ready to use general methods ``` -------------------------------- ### Initialize Common Module - Python Source: https://context7.com/oxapay/oxapay-python/llms.txt Creates a Common instance for accessing public API endpoints that don't require authentication. This module provides access to general cryptocurrency and network information without needing an API key. ```python from oxapay import Common # No API key required for common methods common = Common() # Now ready to use common methods ``` -------------------------------- ### Swap Request API Source: https://github.com/oxapay/oxapay-python/blob/main/README.md Initiate a currency swap request to exchange one cryptocurrency for another. ```APIDOC ## POST /general/swap/request ### Description Allows you to swap your account assets. ### Method POST ### Endpoint /general/swap/request ### Request Body - **amount** (number) - Required - The amount of the source currency to swap. - **from_currency** (string) - Required - The currency to swap from (e.g., 'BTC'). - **to_currency** (string) - Required - The currency to swap to (e.g., 'USDT'). ### Request Example ```json { "amount": 0.5, "from_currency": "BTC", "to_currency": "USDT" } ``` ### Response #### Success Response (200) - **track_id** (string) - The tracking ID for the swap request. - **from_currency** (string) - The currency swapped from. - **to_currency** (string) - The currency swapped to. - **from_amount** (number) - The amount of the source currency. - **to_amount** (number) - The amount of the destination currency received. - **rate** (number) - The exchange rate used for the swap. - **date** (integer) - The timestamp when the swap was initiated. #### Response Example ```json { "track_id": "393831199", "from_currency": "USDT", "to_currency": "BTC", "from_amount": 0.5000000000, "to_amount": 47438.330170780, "rate": 94876.66034156, "date": 1736508792 } ``` ``` -------------------------------- ### Initialize Payout Module with Python Source: https://context7.com/oxapay/oxapay-python/llms.txt Initializes the Payout module for sending cryptocurrency payments. This requires a specific payout key obtained from the OxaPay dashboard. Once initialized, the Payout object can be used to perform various payout operations. ```python from oxapay import Payout # Initialize with payout key from OxaPay dashboard payout_key = '2SV7MF-ISVQSV-OXAPAY-5VI64K' payout = Payout(payout_key) # Now ready to use payout methods ``` -------------------------------- ### Python: Execute Currency Swap Source: https://context7.com/oxapay/oxapay-python/llms.txt Executes a currency swap between two cryptocurrencies in the account at current market rates. Requires an initialized General module and specifies amounts and currencies involved. ```python from oxapay import General general_key = '2SV7MF-ISVQSV-WZM7XG-OXAPAY' general = General(general_key) data = { "amount": 0.5, "from_currency": "BTC", "to_currency": "USDT" } try: result = general.swap_request(data) print(f"Swap Track ID: {result['track_id']}") print(f"From: {result['from_amount']} {result['from_currency']}") print(f"To: {result['to_amount']} {result['to_currency']}") print(f"Rate: {result['rate']}") # Expected output: # { # "track_id": "393831199", # "from_currency": "BTC", # "to_currency": "USDT", # "from_amount": 0.5000000000, # "to_amount": 47438.330170780, # "rate": 94876.66034156, # "date": 1736508792 # } except Exception as e: print(f"Error executing swap: {e}") ``` -------------------------------- ### Handle OxaPay SDK Request Exceptions (Python) Source: https://context7.com/oxapay/oxapay-python/llms.txt Demonstrates robust error handling for OxaPay SDK methods using RequestExceptionsBuilder. This code snippet shows how to catch specific exceptions, retrieve detailed error information such as the API method, error message, and specific error details. ```python from oxapay import Payment from oxapay.request_exceptions import RequestExceptionsBuilder merchant_key = '2SV7MF-OXAPAY-WZM7XG-5VI64K' payment = Payment(merchant_key) data = { "amount": 100, "currency": "INVALID" } try: result = payment.generate_invoice(data) except RequestExceptionsBuilder as e: print(f"API Method: {e.get_method()}") print(f"Error Message: {str(e)}") print(f"Error Details: {e.get_errors()}") # Handle specific errors for error in e.get_errors(): print(f" - {error}") except Exception as e: print(f"Unexpected error: {e}") ``` -------------------------------- ### Perform Currency Swap (Python) Source: https://github.com/oxapay/oxapay-python/blob/main/README.md Executes a currency swap request, exchanging a specified amount of one currency for another. It returns the transaction details including the exchange rate and amounts. ```python data = { "amount": 0.5, "from_currency": "BTC", "to_currency": "USDT" } result = general.swap_request(data) print(result) ``` -------------------------------- ### Python: Generate Cryptocurrency Payout Source: https://context7.com/oxapay/oxapay-python/llms.txt Creates a cryptocurrency payout request to send funds to a specified wallet address. Supports optional memo and description fields. Requires a payout key for authentication. ```python from oxapay import Payout payout_key = '2SV7MF-ISVQSV-OXAPAY-5VI64K' payout = Payout(payout_key) data = { "address": "TQraad2MBFgYUYhTFYeXS5jVpaLZuBwr3w", "amount": 5, "currency": "TRX", "network": "TRC20", "callback_url": "https://example.com/payout-callback", "memo": "Payment to supplier", "description": "Vendor payment for services" } try: result = payout.generate_payout(data) print(f"Payout Track ID: {result['track_id']}") print(f"Status: {result['status']}") # Expected output: # { # "track_id": "258298451", # "status": "processing" # } except Exception as e: print(f"Error creating payout: {e}") ``` -------------------------------- ### Generate Payment Invoice with Python Source: https://context7.com/oxapay/oxapay-python/llms.txt Creates a payment invoice URL for customers to pay with various cryptocurrencies. Supports features like mixed payments and automatic currency conversion. Requires payment details such as amount, currency, lifetime, and callback URLs. Returns a payment URL, track ID, and expiry time. ```python from oxapay import Payment merchant_key = '2SV7MF-OXAPAY-WZM7XG-5VI64K' payment = Payment(merchant_key) data = { "amount": 100, "currency": "USD", "lifetime": 30, "fee_paid_by_payer": 1, "under_paid_coverage": 2.5, "to_currency": "USDT", "auto_withdrawal": False, "mixed_payment": True, "callback_url": "https://example.com/callback", "return_url": "https://example.com/success", "email": "customer@example.com", "order_id": "ORD-12345", "description": "Order #12345", "sandbox": False } try: result = payment.generate_invoice(data) print(f"Payment URL: {result['payment_url']}") print(f"Track ID: {result['track_id']}") print(f"Expires at: {result['expired_at']}") except Exception as e: print(f"Error creating invoice: {e}") ``` -------------------------------- ### Retrieve Account Balance (Python) Source: https://github.com/oxapay/oxapay-python/blob/main/README.md Fetches the current balance for all supported cryptocurrencies in your OxaPay account. The response is a dictionary where keys are currency symbols and values are their respective balances. ```python result = general.get_account_balance() print(result) ``` -------------------------------- ### Check OxaPay System Status (Python) Source: https://context7.com/oxapay/oxapay-python/llms.txt Monitors the OxaPay system status and uptime. This function requires the 'oxapay' library. It returns a dictionary with the overall system 'status', 'uptime', and the status of individual 'services'. ```python from oxapay import Common common = Common() try: result = common.system_status() print(f"System Status: {result['status']}") print(f"Uptime: {result['uptime']}") for service, status in result['services'].items(): print(f" {service}: {status}") except Exception as e: print(f"Error checking system status: {e}") ``` -------------------------------- ### Generate OxaPay Invoice Source: https://github.com/oxapay/oxapay-python/blob/main/README.md Generates an invoice URL for payments using the OxaPay SDK. Requires payment details such as amount, currency, and callback URLs. Returns a track ID and payment URL. ```python data = { "amount": 100, "currency": "USD", "lifetime": 30, "fee_paid_by_payer": 1, "under_paid_coverage": 2.5, "to_currency": "USDT", "auto_withdrawal": False, "mixed_payment": True, "callback_url": "https://example.com/callback", "return_url": "https://example.com/success", "email": "customer@oxapay.com", "order_id": "ORD-12345", "thanks_message": "Thanks message", "description": "Order #12345", "sandbox": False } result = payout.generate_invoice(data) print(result) ``` -------------------------------- ### Generate Payout API Source: https://github.com/oxapay/oxapay-python/blob/main/README.md Create a new payout request by specifying the recipient's address, amount, and currency. ```APIDOC ## POST /payout/generate ### Description Creates a payout request. ### Method POST ### Endpoint /payout/generate ### Request Body - **address** (string) - Required - The recipient's wallet address. - **amount** (number) - Required - The amount to be paid out. - **currency** (string) - Required - The currency for the payout (e.g., 'TRX'). - **network** (string) - Required - The blockchain network for the payout (e.g., 'TRC20'). - **callback_url** (string) - Optional - The URL for receiving payout status notifications. - **memo** (string) - Optional - A memo or tag for the transaction. - **description** (string) - Optional - A description for the payout. ### Request Example ```json { "address": "RECEIVER_ADDRESS", "amount": 5, "currency": "TRX", "network": "TRC20", "callback_url": "https://example.com/callback", "memo": "Memo12345", "description": "Order #12345" } ``` ### Response #### Success Response (200) - **track_id** (string) - The tracking ID for the payout request. - **status** (string) - The initial status of the payout request (e.g., 'processing'). #### Response Example ```json { "track_id": "258298451", "status": "processing" } ``` ``` -------------------------------- ### Generate OxaPay White Label Address Source: https://github.com/oxapay/oxapay-python/blob/main/README.md Creates a white-label payment address using the OxaPay SDK. This function is part of the Payment client and requires details about the payment, including amount, currency, and network. It returns details of the generated address, including a QR code. ```python data = { "amount": 100, "currency": "USD", "pay_currency": "TRX", "network": "TRC20", "lifetime": 60, "fee_paid_by_payer": 1, "under_paid_coverage": 20, "to_currency": "USDT", "auto_withdrawal": False, "callback_url": "https://example.com/callback", "email": "customer@oxapay.com", "order_id": "ORD-12345", "description": "Order #12345", } result = payment.generate_white_label(data) print(result) ``` -------------------------------- ### Generate Payout Request (Python) Source: https://github.com/oxapay/oxapay-python/blob/main/README.md Creates a new payout request with specified details including the recipient address, amount, currency, network, and optional memo and description. The function returns a track ID and status upon successful creation. ```python data = { "address": "RECEIVER_ADDRESS", "amount": 5, "currency": "TRX", "network": "TRC20", "callback_url": "https://example.com/callback", "memo": "Memo12345", "description": "Order #12345" } result = payout.generate_payout(data) print(result) ``` -------------------------------- ### Swap Calculate API Source: https://github.com/oxapay/oxapay-python/blob/main/README.md Calculate the estimated amount you will receive when swapping one cryptocurrency for another, based on the current exchange rate. ```APIDOC ## POST /general/swap/calculate ### Description Calculates the amount you'll receive when swapping one cryptocurrency for another. ### Method POST ### Endpoint /general/swap/calculate ### Request Body - **amount** (number) - Required - The amount of the source currency. - **fromCurrency** (string) - Required - The currency to swap from. - **toCurrency** (string) - Required - The currency to swap to. ### Request Example ```json { 'amount': 12, 'fromCurrency': 'USDT', 'toCurrency': 'TRX' } ``` ### Response #### Success Response (200) - **to_amount** (number) - The estimated amount of the destination currency. - **rate** (number) - The current exchange rate. - **amount** (number) - The input amount of the source currency. #### Response Example ```json { "to_amount": 94763.06, "rate": 94763.06000000, "amount": 1 } ``` ``` -------------------------------- ### Generate OxaPay Static Address Source: https://github.com/oxapay/oxapay-python/blob/main/README.md Generates a static payment address using the OxaPay SDK. This function is useful for creating persistent addresses for receiving payments. It requires network and currency information and returns the address and a QR code. ```python data = { "network": "TRON", "to_currency": "USDT", "auto_withdrawal": False, "callback_url": "https://example.com/callback", "email": "customer@oxapay.com", "order_id": "ORD-12345", "description": "Order #12345" } result = payment.generate_static_address(data) print(result) ``` -------------------------------- ### Generate White Label Payment Address in Python Source: https://context7.com/oxapay/oxapay-python/llms.txt Creates a dedicated cryptocurrency address for a specific payment with custom branding. Allows direct blockchain transfers with exact payment amounts. Requires payment details including amount, currency, pay currency, network, and lifetime. Returns the payment address, pay amount, QR code, and track ID. ```python from oxapay import Payment merchant_key = '2SV7MF-OXAPAY-WZM7XG-5VI64K' payment = Payment(merchant_key) data = { "amount": 100, "currency": "USD", "pay_currency": "TRX", "network": "TRC20", "lifetime": 60, "fee_paid_by_payer": 1, "under_paid_coverage": 20, "to_currency": "USDT", "auto_withdrawal": False, "callback_url": "https://example.com/callback", "email": "customer@example.com", "order_id": "ORD-12345", "description": "Order #12345" } try: result = payment.generate_white_label(data) print(f"Payment Address: {result['address']}") print(f"Pay Amount: {result['pay_amount']} {result['pay_currency']}") print(f"QR Code: {result['qr_code']}") print(f"Track ID: {result['track_id']}") except Exception as e: print(f"Error generating white label: {e}") ``` -------------------------------- ### Swap Calculate - Python Source: https://context7.com/oxapay/oxapay-python/llms.txt Calculates the amount that will be received when swapping between two cryptocurrencies without executing the transaction. Requires a General instance with API key authentication and accepts source/destination currencies and amount as input. Returns the calculated exchange rate and resulting amount. ```python from oxapay import General general_key = '2SV7MF-ISVQSV-WZM7XG-OXAPAY' general = General(general_key) data = { 'amount': 12, 'fromCurrency': 'USDT', 'toCurrency': 'TRX' } try: result = general.swap_calculate(data) print(f"Amount: {result['amount']} USDT") print(f"Will receive: {result['to_amount']} TRX") print(f"Rate: {result['rate']}") except Exception as e: print(f"Error calculating swap: {e}") ``` -------------------------------- ### Generate Static Cryptocurrency Address with Python Source: https://context7.com/oxapay/oxapay-python/llms.txt Creates a permanent cryptocurrency address for receiving multiple payments. This is useful for recurring donations or subscriptions. It requires a merchant key and specific data like network, currency, and callback URL. ```python from oxapay import Payment merchant_key = '2SV7MF-OXAPAY-WZM7XG-5VI64K' payment = Payment(merchant_key) data = { "network": "TRON", "to_currency": "USDT", "auto_withdrawal": False, "callback_url": "https://example.com/callback", "email": "customer@example.com", "order_id": "ORD-12345", "description": "Subscription payments" } try: result = payment.generate_static_address(data) print(f"Static Address: {result['address']}") print(f"Network: {result['network']}") print(f"Track ID: {result['track_id']}") print(f"QR Code: {result['qr_code']}") except Exception as e: print(f"Error generating static address: {e}") ``` -------------------------------- ### List Static Cryptocurrency Addresses with Python Source: https://context7.com/oxapay/oxapay-python/llms.txt Retrieves a list of all static addresses created under the merchant account. This function supports filtering by network and whether transactions have occurred. It returns information for each static address, including its address, network, and track ID. ```python from oxapay import Payment merchant_key = '2SV7MF-OXAPAY-WZM7XG-5VI64K' payment = Payment(merchant_key) params = { "network": "TRON", "have_tx": True, "page": 1, "size": 10 } try: result = payment.static_address_list(params) for address_info in result: print(f"Address: {address_info['address']}") print(f"Network: {address_info['network']}") print(f"Track ID: {address_info['track_id']}") except Exception as e: print(f"Error fetching static addresses: {e}") ``` -------------------------------- ### Calculate Swap Amount (Python) Source: https://github.com/oxapay/oxapay-python/blob/main/README.md Calculates the estimated amount of cryptocurrency you will receive for a given swap amount and currency pair. This function helps in planning trades without executing them. ```python data = { 'amount': 12, 'fromCurrency': 'USDT', 'toCurrency': 'TRX' } result = general.swap_calculate(data) print(result) ``` -------------------------------- ### Payout Information API Source: https://github.com/oxapay/oxapay-python/blob/main/README.md Retrieve the status and details of a specific payout transaction using its tracking ID. ```APIDOC ## GET /payout/information ### Description Retrieves information for a specific payout transaction. ### Method GET ### Endpoint /payout/information ### Query Parameters - **track_id** (integer) - Required - The unique identifier for the payout transaction. ### Response #### Success Response (200) - **track_id** (string) - The transaction tracking ID. - **address** (string) - The recipient's wallet address. - **currency** (string) - The currency of the payout. - **network** (string) - The blockchain network of the payout. - **amount** (number) - The payout amount. - **fee** (number) - The transaction fee. - **status** (string) - The current status of the payout. - **tx_hash** (string) - The transaction hash (if confirmed). - **description** (string) - A description of the payout. - **internal** (boolean) - Indicates if the payout was internal. - **memo** (string) - The memo or tag used for the transaction. - **date** (integer) - The timestamp when the payout was initiated. #### Response Example ```json { "track_id": "258298351", "address": "1AmH3Qz2LooYa1YSyLhySuatwoRMsfznPJ", "currency": "BTC", "network": "Bitcoin Network", "amount": 0.0200000000, "fee": 0.0000100000, "status": "processing", "tx_hash": "", "description": "test", "internal": false, "memo": "test", "date": 1736501470 } ``` ``` -------------------------------- ### Retrieve Payment Transaction Information with Python Source: https://context7.com/oxapay/oxapay-python/llms.txt Fetches detailed information about a specific payment transaction using its track ID. This includes the payment status, amounts, currency, and associated blockchain transaction details if available. It requires the track ID of the payment. ```python from oxapay import Payment merchant_key = '2SV7MF-OXAPAY-WZM7XG-5VI64K' payment = Payment(merchant_key) track_id = "184747701" try: result = payment.payment_information(track_id) print(f"Status: {result['status']}") print(f"Amount: {result['amount']} {result['currency']}") if result.get('txs'): for tx in result['txs']: print(f"TX Hash: {tx['tx_hash']}") print(f"Confirmations: {tx['confirmations']}") print(f"Amount: {tx['amount']} {tx['currency']}") except Exception as e: print(f"Error fetching payment info: {e}") ``` -------------------------------- ### Payment History API Source: https://github.com/oxapay/oxapay-python/blob/main/README.md Retrieve detailed information about a specific payment transaction using its tracking ID. ```APIDOC ## GET /payment/history ### Description Retrieves information for a specific payment transaction. ### Method GET ### Endpoint /payment/history ### Query Parameters - **track_id** (integer) - Required - The unique identifier for the payment transaction. ### Response #### Success Response (200) - **track_id** (string) - The transaction tracking ID. - **type** (string) - The type of transaction (e.g., 'invoice'). - **amount** (number) - The transaction amount. - **currency** (string) - The currency of the transaction. - **status** (string) - The current status of the payment (e.g., 'paid'). - **mixed_payment** (boolean) - Indicates if the payment involved multiple currencies. - **fee_paid_by_payer** (number) - The fee paid by the payer. - **under_paid_coverage** (number) - The coverage amount for underpaid transactions. - **lifetime** (integer) - The transaction lifetime in minutes. - **callback_url** (string) - The URL to send payment notifications to. - **return_url** (string) - The URL to redirect the user after payment. - **email** (string) - The email associated with the payment. - **order_id** (string) - The order ID associated with the payment. - **description** (string) - A description of the order. - **thanks_message** (string) - A custom thank you message. - **expired_at** (integer) - The timestamp when the payment expires. - **date** (integer) - The timestamp when the payment was created. - **txs** (array) - An array of transaction hash details. - **tx_hash** (string) - The transaction hash. - **amount** (number) - The amount of the transaction. - **currency** (string) - The currency of the transaction. - **network** (string) - The blockchain network. - **address** (string) - The recipient address. - **status** (string) - The status of the transaction. - **confirmations** (integer) - The number of confirmations. - **auto_convert** (object) - Details about automatic currency conversion. - **processed** (boolean) - Whether auto-conversion was processed. - **amount** (number) - The converted amount. - **currency** (string) - The converted currency. - **auto_withdrawal** (object) - Details about automatic withdrawal. - **processed** (boolean) - Whether auto-withdrawal was processed. - **date** (integer) - The timestamp of the transaction. #### Response Example ```json { "track_id": "168931368", "type": "invoice", "amount": 15, "currency": "USD", "status": "paid", "mixed_payment": false, "fee_paid_by_payer": 0, "under_paid_coverage": 21.5, "lifetime": 60, "callback_url": "https://example.com/callback", "return_url": "https://example.com/success", "email": "customer@oxapay.com", "order_id": "ORD-12345", "description": "Order #12345", "thanks_message": "Thanks Message", "expired_at": 1728121075, "date": 1728117475, "txs": [ { "tx_hash": "0x2DehmnxMDFMhS3KHXCPpGSx41NeLBjH34q5vjN1oGbUDFFAMC9rG3", "amount": 0.00613418, "currency": "ETH", "network": "Ethereum Network", "address": "HEHCVjnxD8cQrFwfo4k9WXJXErpmK9Ym1nRaEiJJ8DP4", "status": "confirmed", "confirmations": 11, "auto_convert": { "processed": true, "amount": 14.73130872, "currency": "USDT" }, "auto_withdrawal": { "processed": false }, "date": 1728117736 } ] } ``` ``` -------------------------------- ### Revoke Static Cryptocurrency Address with Python Source: https://context7.com/oxapay/oxapay-python/llms.txt Deactivates a previously generated static cryptocurrency address, preventing it from receiving further payments. This operation requires the specific address to be revoked. ```python from oxapay import Payment merchant_key = '2SV7MF-OXAPAY-WZM7XG-5VI64K' payment = Payment(merchant_key) data = { "address": "TX7U8wnnafXeXED3ChjeuiZFznL3BU1gX3" } try: result = payment.revoking_static_address(data) print("Static address revoked successfully") except Exception as e: print(f"Error revoking address: {e}") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.