Skip to main content
Glama

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
NameRequiredDescriptionDefault
orderidYesOrder ID
serveridNoServer to provision on
serviceusernameNoUsername for service
servicepasswordNoPassword for service
registrarNoDomain registrar module
autosetupNoAuto setup products
sendemailNoSend setup email

Implementation Reference

  • 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) }],
            };
        }
    );
  • 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'),
    },
  • 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;
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/scarecr0w12/whmcs-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server