Get Invoice Details
whmcs_get_invoiceRetrieves detailed information about a specific invoice by providing its invoice ID.
Instructions
Get detailed information about a specific invoice
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| invoiceid | Yes | The invoice ID |
Implementation Reference
- src/index.ts:280-295 (registration)Registration of the 'whmcs_get_invoice' MCP tool with the McpServer. It defines the input schema (required invoiceid) and calls whmcsClient.getInvoice() to execute the logic.
server.registerTool( 'whmcs_get_invoice', { title: 'Get Invoice Details', description: 'Get detailed information about a specific invoice', inputSchema: { invoiceid: z.number().describe('The invoice ID'), }, }, async (params) => { const result = await whmcsClient.getInvoice(params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } ); - src/whmcs-client.ts:451-501 (handler)The getInvoice() method on WhmcsApiClient that actually makes the 'GetInvoice' API call to WHMCS. It accepts an invoiceid parameter, calls the WHMCS API with the 'GetInvoice' action, and returns detailed invoice data including items and transactions.
/** * Get invoice details */ async getInvoice(params: { invoiceid: number }) { return this.call<WhmcsApiResponse & { invoiceid: number; invoicenum: string; userid: number; date: string; duedate: string; datepaid: string; status: string; paymentmethod: string; paymethodid: string | null; subtotal: string; credit: string; tax: string; tax2: string; total: string; balance: string; taxrate: string; taxrate2: string; currencycode: string; currencyprefix: string; currencysuffix: string; notes: string; ccgateway: boolean; items: { item: Array<{ id: number; type: string; relid: number; description: string; amount: string; taxed: number; }> }; transactions: { transaction: Array<{ id: number; userid: number; currency: number; gateway: string; date: string; description: string; amountin: string; amountout: string; rate: string; transid: string; invoiceid: number; refundid: number; }> }; }>('GetInvoice', params); }