whmcs_add_payment
Record payments on WHMCS invoices by specifying invoice ID, transaction details, gateway, and amount. Use this tool to update payment records in your WHMCS installation.
Instructions
Record a payment on an invoice
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| invoiceid | Yes | Invoice ID | |
| transid | Yes | Transaction ID | |
| gateway | Yes | Payment gateway name | |
| amount | No | Payment amount | |
| fees | No | Transaction fees | |
| noemail | No | Do not send email | |
| date | No | Payment date (YYYY-MM-DD) |
Implementation Reference
- src/whmcs-client.ts:555-565 (handler)Core implementation of the tool logic: records a payment on an invoice by invoking the WHMCS API 'AddInvoicePayment' endpoint.async addPayment(params: { invoiceid: number; transid: string; gateway: string; amount?: number; fees?: number; noemail?: boolean; date?: string; }) { return this.call<WhmcsApiResponse>('AddInvoicePayment', params); }
- src/index.ts:354-362 (schema)Input schema using Zod for validating tool parameters.inputSchema: { invoiceid: z.number().describe('Invoice ID'), transid: z.string().describe('Transaction ID'), gateway: z.string().describe('Payment gateway name'), amount: z.number().optional().describe('Payment amount'), fees: z.number().optional().describe('Transaction fees'), noemail: z.boolean().optional().describe('Do not send email'), date: z.string().optional().describe('Payment date (YYYY-MM-DD)'), },
- src/index.ts:349-370 (registration)MCP server tool registration including title, description, schema, and thin wrapper handler delegating to WhmcsApiClient.addPayment.server.registerTool( 'whmcs_add_payment', { title: 'Add Payment', description: 'Record a payment on an invoice', inputSchema: { invoiceid: z.number().describe('Invoice ID'), transid: z.string().describe('Transaction ID'), gateway: z.string().describe('Payment gateway name'), amount: z.number().optional().describe('Payment amount'), fees: z.number().optional().describe('Transaction fees'), noemail: z.boolean().optional().describe('Do not send email'), date: z.string().optional().describe('Payment date (YYYY-MM-DD)'), }, }, async (params) => { const result = await whmcsClient.addPayment(params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } );