hotmart_sale_refund
Refund a Hotmart sale by providing the transaction code.
Instructions
Sales Refund. Example: hotmart_sale_refund(transaction_code='ABC123XY').
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| transaction_code | Yes | Transaction code. Format: alphanumeric Hotmart code (ex: `H123A4B5`, not UUID, not int) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/hotmart_mcp/tools/sales.py:441-450 (handler)The core handler function that performs a sale refund by sending a PUT request to /payments/api/v1/sales/{transaction_code}/refund using the authenticated HTTP client.
async def hotmart_sale_refund( transaction_code: str, ) -> str: """Sales Refund. Example: hotmart_sale_refund(transaction_code='ABC123XY'). Args: transaction_code: Transaction code. Format: alphanumeric Hotmart code (ex: `H123A4B5`, not UUID, not int)""" endpoint = f"/payments/api/v1/sales/{transaction_code}/refund" result = await get_client().put(endpoint) return json.dumps(result, indent=2) - src/hotmart_mcp/server.py:25-37 (registration)Auto-registration mechanism that discovers all async functions (including hotmart_sale_refund) from the hotmart_mcp.tools package and registers them as FastMCP tools.
def _discover_and_register_tools() -> int: """Import all modules under hotmart_mcp.tools and register async functions.""" registered = 0 for module_info in pkgutil.iter_modules(tools_pkg.__path__, prefix=f"{tools_pkg.__name__}."): if module_info.name.endswith("__init__"): continue module = importlib.import_module(module_info.name) for name, obj in inspect.getmembers(module, iscoroutinefunction): if name.startswith("_"): continue mcp.tool()(obj) registered += 1 return registered - The input parameter: a required string 'transaction_code' (alphanumeric Hotmart code, e.g. H123A4B5).
transaction_code: str, - src/hotmart_mcp/tools/sales.py:6-10 (helper)The shared helper 'get_client' provides the authenticated HTTP client used to make the PUT request for the refund.
from hotmart_mcp._shared import get_client __all__ = ["hotmart_sales_history_list", "hotmart_sales_summary_list", "hotmart_sales_participants_list", "hotmart_sales_commissions_list", "hotmart_sales_price_details_list", "hotmart_sale_refund"] - src/hotmart_mcp/tools/sales.py:8-8 (registration)The module's __all__ export list which explicitly includes hotmart_sale_refund as a public member.
__all__ = ["hotmart_sales_history_list", "hotmart_sales_summary_list", "hotmart_sales_participants_list", "hotmart_sales_commissions_list", "hotmart_sales_price_details_list", "hotmart_sale_refund"]