Mark Order as Fraud
whmcs_fraud_orderMark an order as fraudulent in WHMCS by providing order ID. Optionally cancel associated subscriptions.
Instructions
Mark an order as fraudulent
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| orderid | Yes | Order ID | |
| cancelsub | No | Cancel subscription |
Implementation Reference
- src/index.ts:851-867 (registration)Registration of the whmcs_fraud_order tool with input schema for orderid and optional cancelsub. The handler calls whmcsClient.fraudOrder() and returns JSON output.
server.registerTool( 'whmcs_fraud_order', { title: 'Mark Order as Fraud', description: 'Mark an order as fraudulent', inputSchema: { orderid: z.number().describe('Order ID'), cancelsub: z.boolean().optional().describe('Cancel subscription'), }, }, async (params) => { const result = await whmcsClient.fraudOrder(params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } ); - src/whmcs-client.ts:1041-1046 (handler)Handler method on WhmcsApiClient that calls the WHMCS API action 'FraudOrder' with the orderid and optional cancelsub parameters.
async fraudOrder(params: { orderid: number; cancelsub?: boolean; }) { return this.call<WhmcsApiResponse>('FraudOrder', params); } - src/index.ts:856-859 (schema)Input schema for whmcs_fraud_order tool: orderid (required number) and cancelsub (optional boolean).
inputSchema: { orderid: z.number().describe('Order ID'), cancelsub: z.boolean().optional().describe('Cancel subscription'), }, - src/whmcs-client.ts:29-63 (helper)Generic call method on WhmcsApiClient that performs the actual HTTP POST request to the WHMCS API. The 'FraudOrder' action is passed through this method.
async call<T extends WhmcsApiResponse>(action: string, params: Record<string, unknown> = {}): Promise<T> { const url = `${this.config.apiUrl.replace(/\/$/, '')}/includes/api.php`; const postData: Record<string, string> = { identifier: this.config.apiIdentifier, secret: this.config.apiSecret, action: action, responsetype: 'json', ...this.flattenParams(params) }; if (this.config.accessKey) { postData.accesskey = this.config.accessKey; } const response = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, body: new URLSearchParams(postData).toString(), }); if (!response.ok) { throw new Error(`WHMCS API request failed: ${response.status} ${response.statusText}`); } const data = await response.json() as T; if (data.result === 'error') { throw new Error(`WHMCS API error: ${data.message || 'Unknown error'}`); } return data; }