whmcs_accept_order
Process pending WHMCS orders by accepting them with provisioning details like server ID, credentials, and email settings.
Instructions
Accept and process a pending order
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| orderid | Yes | Order ID | |
| serverid | No | Server to provision on | |
| serviceusername | No | Username for service | |
| servicepassword | No | Password for service | |
| registrar | No | Domain registrar module | |
| autosetup | No | Auto setup products | |
| sendemail | No | Send setup email |
Implementation Reference
- src/whmcs-client.ts:994-1005 (handler)Core handler implementation: WhmcsApiClient.acceptOrder method that invokes the WHMCS 'AcceptOrder' API action with provided parameters.async acceptOrder(params: { orderid: number; serverid?: number; serviceusername?: string; servicepassword?: string; registrar?: string; sendregistrar?: boolean; autosetup?: boolean; sendemail?: boolean; }) { return this.call<WhmcsApiResponse>('AcceptOrder', params); }
- src/index.ts:774-794 (registration)Tool registration: server.registerTool call defining the 'whmcs_accept_order' tool, including Zod input schema validation and thin wrapper handler delegating to WhmcsApiClient.acceptOrder.'whmcs_accept_order', { title: 'Accept Order', description: 'Accept and process a pending order', inputSchema: { orderid: z.number().describe('Order ID'), serverid: z.number().optional().describe('Server to provision on'), serviceusername: z.string().optional().describe('Username for service'), servicepassword: z.string().optional().describe('Password for service'), registrar: z.string().optional().describe('Domain registrar module'), autosetup: z.boolean().optional().describe('Auto setup products'), sendemail: z.boolean().optional().describe('Send setup email'), }, }, async (params) => { const result = await whmcsClient.acceptOrder(params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } );
- src/index.ts:778-786 (schema)Input schema definition using Zod for validating tool parameters during registration.inputSchema: { orderid: z.number().describe('Order ID'), serverid: z.number().optional().describe('Server to provision on'), serviceusername: z.string().optional().describe('Username for service'), servicepassword: z.string().optional().describe('Password for service'), registrar: z.string().optional().describe('Domain registrar module'), autosetup: z.boolean().optional().describe('Auto setup products'), sendemail: z.boolean().optional().describe('Send setup email'), },
- src/whmcs-client.ts:29-63 (helper)Generic API call helper method used by acceptOrder to perform the actual HTTP request to WHMCS API.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; }