### WISECP License API - Getting Started Source: https://dev.wisecp.com/en/kb/change_config Guides users on how to get started with the WISECP License API, including setup and authentication. ```APIDOC ## Getting Started with WISECP License API ### Description This guide covers the initial steps required to begin using the WISECP License API, including obtaining API credentials and setting up authentication. ### Method N/A ### Endpoint N/A ### Parameters #### Request Body (for authentication endpoint, if applicable) - **api_key** (string) - Required - Your WISECP API key. - **api_secret** (string) - Required - Your WISECP API secret. ### Request Example (Authentication) ```json { "api_key": "your_license_api_key", "api_secret": "your_license_api_secret" } ``` ### Response (Authentication) #### Success Response (200) - **token** (string) - An authentication token for subsequent requests. - **expires_in** (integer) - The validity period of the token in seconds. #### Response Example (Authentication) ```json { "token": "generated_auth_token_xyz", "expires_in": 3600 } ``` ``` -------------------------------- ### Download Installation File Source: https://dev.wisecp.com/en/kb/download-installation-file Provides the WISECP setup file specific to a license. The download type ('file' or 'link') determines the response format. ```APIDOC ## POST /order/download ### Description Provides the WISECP setup file specific to a license. The download type ('file' or 'link') determines the response format. ### Method POST ### Endpoint < API URL >order/download ### Parameters #### Query Parameters - **key** (string) - Required - Api key information you obtained. - **id** (integer) - Required - ID number of the service. ### Request Example ```json { "key": "< API KEY >", "id": 1001 } ``` ### Response #### Success Response (200) - **download_type** (string) - Indicates if the download is a 'file' or 'link'. - **download_link** (string) - The URL to download the file if download_type is 'link'. #### Response Example ```json { "download_type": "file", "download_link": "" } ``` ``` -------------------------------- ### Download WISECP Installation File (API) Source: https://dev.wisecp.com/en/kb/download-installation-file This API command facilitates the download of a WISECP setup file tailored for a specific license. It requires an API key and service ID. The response handling depends on the 'download_type' parameter, which can be 'file' for a direct download or 'link' to redirect to a download URL. ```json { "key": "< API KEY >", "id": 1001 } ``` -------------------------------- ### WISECP License API - Introduction Source: https://dev.wisecp.com/en/kb/get_prices-costs Provides an overview of the WISECP License API, including getting started and core functionalities. ```APIDOC ## WISECP License API Overview ### Description This section details the WISECP License API, which allows you to manage your WISECP licenses programmatically. It covers functionalities such as purchasing new licenses, renewing existing ones, switching packages, viewing license details, and managing license domains. ### Getting Started To use the WISECP License API, you will need an API key, which can be obtained from your WISECP client area. Ensure you have the necessary authentication credentials before making any API requests. ### Core Functionalities - **Buying New License**: Initiate the purchase of a new WISECP license. - **Renewing License Time**: Extend the validity period of an existing license. - **Switch to Different Package**: Upgrade or downgrade your current license package. - **Viewing License Details**: Retrieve comprehensive information about your active licenses. - **Create License Cancellation Request**: Submit a request to cancel a license. - **Change License Domain Information**: Update the domain associated with a license. - **Listing Current Licenses**: Fetch a list of all currently active licenses under your account. ``` -------------------------------- ### Module Configuration Example in PHP Source: https://dev.wisecp.com/en/kb/product-configuration-options This PHP code snippet demonstrates how to define configuration fields for a module in WiseCP. It shows an example of an array structure for placeholder values and highlights the importance of naming conventions for form elements. ```php $config = [ 'placeholder' => "Sample placeholder", ]; ``` -------------------------------- ### Create Product Order with create() - PHP Source: https://dev.wisecp.com/en/kbc/functions-ssl_p=2 This mandatory function is used during the product installation stage. If automatic installation is enabled and the invoice is paid, `create()` activates the order. Failure results in the order remaining in a processing state. ```php public function create($params) { // Activate order if conditions are met // Return status indicating success or failure } ``` -------------------------------- ### WISECP Theme Variables and Functions Example Source: https://dev.wisecp.com/en/kb/5-variables-and-functions Demonstrates the usage of global theme variables and functions within a WISECP theme file. These variables provide access to theme information, language strings, and system paths. The example shows how to echo function calls and access language arrays. ```php /*Sample Function Call Code*/ echo $_theme->example_function(); /*Sample Variable Usage */ echo $_theme->language["lang-key"]; ``` -------------------------------- ### WISECP API Request Examples (JSON) Source: https://dev.wisecp.com/en/kb/wisecp-license-api-getting-started Examples of incorrect and successful JSON responses from the WISECP API. These demonstrate the expected structure for error and success messages. ```json { "status":"error", "message":"something write here..." } ``` ```json { "status":"successful", ...another datas... } ``` -------------------------------- ### SSL Service Module Development Source: https://dev.wisecp.com/en/kb/pages-order-detail-php Guides and files for developing custom SSL service modules within WISECP. ```APIDOC ## SSL Service Module Development ### Description This section details the development of custom SSL service modules for WISECP. It includes information on getting started, configuration files, and available functions. ### Files - `config.php` - `pages/product-detail.php` - `pages/order-detail.php` - `pages/ac-order-detail.php` ### Variables - **$module** (Class Object) - The current module's class object. - **$order** (Array) - Information about the current order. - **$controller_link** (String) - The URL for the controller. ### Hooks - Helping Hooks are available for module development. ### Functions - **__construct()**: Constructor method. - **set_order($order_id)**: Sets the order details. - **setConfig($config_data)**: Sets module configuration. - **testConnection()**: Tests the connection to the SSL provider. - **use_method($method_name, $params)**: Calls a specific method within the module. - **run_action($action, $params)**: Executes a defined action. - **checking_enroll()**: Checks the enrollment status of an SSL certificate. - **edit_order_params($params)**: Edits order parameters. - **ac_edit_order_params($params)**: Edits order parameters for activation. - **create($params)**: Creates a new SSL certificate order. - **extend($params)**: Extends an existing SSL certificate. - **delete($params)**: Deletes an SSL certificate. - **list_ssl($params)**: Lists available SSL certificates. - **import($params)**: Imports an existing SSL certificate. ``` -------------------------------- ### Sample Successful Response (JSON) Source: https://dev.wisecp.com/en/kb/structure-and-format An example of a successful response from the API, including user details and a hash. ```JSON { "status": "successful", "data": { "user_id": 19, "hash": "ZmozNFdUNy8wMGM4bkVKK01IeUF5d2tSNzU0d1E1VThLZUJmZXNzdVNkK2dvWEgwdmdOTDE4YldmMzFCTVdheVY3bjhRTDBxSVNOb1FXcjBhVEhiTlE9PQ==" } } ``` -------------------------------- ### PHP Configuration Fields Example Source: https://dev.wisecp.com/en/kb/settings-configuration-page This PHP function demonstrates how to define various configuration fields for a WiseCP module. It includes examples for text, password, checkbox, dropdown, radio button, and textarea field types, along with their respective properties like name, description, type, and default values. This function is crucial for setting up user-configurable options within the WiseCP interface. ```php public function config_fields() { return [ 'example1' => [ 'name' => "Text", 'description' => "Description for Text", 'type' => "text", 'value' => $this->config["settings"]["example1"] ?? '', 'placeholder' => "Example Placeholder", ], 'example2' => [ 'name' => "Password", 'description' => "Description for Password", 'type' => "password", 'value' => $this->config["settings"]["example2"] ?? '', 'placeholder' => "Example Placeholder", ], 'example3' => [ 'name' => "Approval Button", 'description' => "Description for Approval Button", 'type' => "approval", 'value' => 1, 'checked' => (boolean) (int) ($this->config["settings"]["example3"] ?? 0), ], 'example4' => [ 'name' => "Dropdown Menu 1", 'description' => "Description for Dropdown Menu 1", 'type' => "dropdown", 'options' => "Option 1,Option 2,Option 3,Option 4", 'value' => $this->config["settings"]["example4"] ?? '', ], 'example5' => [ 'name' => "Dropdown Menu 2", 'description' => "Description for Dropdown Menu 2", 'type' => "dropdown", 'options' => [ 'opt1' => "Option 1", 'opt2' => "Option 2", 'opt3' => "Option 3", 'opt4' => "Option 4", ], 'value' => $this->config["settings"]["example5"] ?? '', ], 'example6' => [ 'name' => "Radio Button 1", 'description' => "Description for Radio Button 1", 'width' => 40, 'description_pos' => 'L', 'is_tooltip' => true, 'type' => "radio", 'options' => "Option 1,Option 2,Option 3,Option 4", 'value' => $this->config["settings"]["example6"] ?? '', ], 'example7' => [ 'name' => "Radio Button 2", 'description' => "Description for Radio Button 2", 'description_pos' => 'L', 'is_tooltip' => true, 'type' => "radio", 'options' => [ 'opt1' => "Option 1", 'opt2' => "Option 2", 'opt3' => "Option 3", 'opt4' => "Option 4", ], 'value' => $this->config["settings"]["example7"] ?? '', ], 'example8' => [ 'name' => "Text Area", 'description' => "Description for text area", 'rows' => "3", 'type' => "textarea", 'value' => $this->config["settings"]["example8"] ?? '', 'placeholder' => "Example placeholder", ] ]; } ``` -------------------------------- ### Accessing Service Configuration Options in PHP Source: https://dev.wisecp.com/en/kb/hosting-panel-module-development-parameters Demonstrates how to access various service configuration options stored within the $this->order["options"] array in PHP. This includes retrieving information such as domain name, disk and bandwidth limits, email and database limits, addon and subdomain limits, FTP account limits, parked domain limits, hourly email sending limits, CPU limits, and installation status. ```php $this->order["options"]["established"]; // Installation status (true/false) $this->order["options"]["domain"]; // Domain Name $this->order["options"]["disk_limit"]; // Disk Space (MB) $this->order["options"]["bandwidth_limit"]; // Bandwidth Limit (MB) $this->order["options"]["email_limit"]; // EMail Limit $this->order["options"]["database_limit"]; // Database Limit $this->order["options"]["addons_limit"]; // Addon Domain Limit $this->order["options"]["subdomain_limit"]; // Subdomain Limit $this->order["options"]["ftp_limit"]; // Ftp Account Limit $this->order["options"]["park_limit"]; // Domain Park Limit $this->order["options"]["max_email_per_hour"]; // Hourly Email Sending Limit $this->order["options"]["cpu_limit"]; // CPU Limit ``` -------------------------------- ### SSL Service Module Development Source: https://dev.wisecp.com/en/kb/ac_edit_order_params Details on developing and integrating the SSL Service Module, including getting started, configuration files, and available functions. ```APIDOC ## SSL Service Module Development ### Description This section provides guidance on developing and integrating the SSL Service Module within WISECP. It covers initial setup, configuration, and the various functions available for managing SSL services. ### Getting Started Information on how to begin developing the SSL Service Module. ### Configuration Files - `config.php`: Main configuration file for the module. - `pages/product-detail.php`: Handles product detail pages. - `pages/order-detail.php`: Manages order detail pages. - `pages/ac-order-detail.php`: Handles account-related order detail pages. ### Variables Details on available variables for the SSL Service Module. ### Hooks (Helping Hooks) Information on using hooks to extend module functionality. ### Functions - `__construct()`: Constructor function. - `set_order()`: Sets the order details. - `setConfig()`: Sets module configuration. - `testConnection()`: Tests the connection to the SSL provider. - `use_method()`: Uses a specific method for an operation. - `run_action()`: Executes a specific action. - `checking_enroll()`: Checks the enrollment status of an SSL certificate. - `edit_order_params()`: Edits order parameters. - `ac_edit_order_params()`: Edits account-related order parameters. - `create()`: Creates a new SSL order. - `extend()`: Extends an existing SSL certificate. - `delete()`: Deletes an SSL certificate. - `list_ssl()`: Lists available SSL certificates. - `import()`: Imports an SSL certificate. ``` -------------------------------- ### Reseller API - Get Account Information Source: https://dev.wisecp.com/en/kb/reseller-api-usage-examples This endpoint allows you to retrieve information about your reseller account, such as current balance and currency. ```APIDOC ## POST /api/reseller/me ### Description Retrieves account information including balance and currency. ### Method POST ### Endpoint /api/reseller/me ### Parameters #### Request Body - **key** (string) - Required - Your API key for authentication. ### Request Example ```json { "key": "UzZBSlBWeWk0UEcrVWxlU0RjS1B1dz09" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the request (e.g., "successful"). - **balance** (string) - The current account balance. - **currency** (string) - The currency of the balance. - **balance_formatted** (string) - The balance formatted as a string with currency symbol. #### Response Example ```json { "status": "successful", "balance": "12921.6200", "currency": "USD", "balance_formatted": "$12,921.62" } ``` ``` -------------------------------- ### WiseCP System Variables Example (PHP) Source: https://dev.wisecp.com/en/kb/merchant-method Demonstrates how to access various system variables within the WiseCP module, such as configuration settings, module information, language strings, and URL/path details. These variables are crucial for dynamic module behavior and integration. ```php $this->config["settings"]["...your_field..."] // Custom configuration field $this->name // Module Name $this->lang["invoice-name"] // Module Display Name $this->url // Module Directory URL Address $this->dir // Module Directory Path (eg. /coremio/modules/Payment/SamplePay/) $this->lang["example"] // Calling a field from a language file APP_URI // Website URL Address $this->links["successful"] // Payment successful page link $this->links["failed"] // Payment failed page link $this->links["callback"] // Callback link ``` -------------------------------- ### PHP Example: Constructing and Fetching a SELECT Query with WDB Source: https://dev.wisecp.com/en/kb/create-a-query This PHP code snippet demonstrates how to construct a complex SELECT query using WDB methods like select, from, join, where, group_by, order_by, and limit. It then executes the query using build() and fetches the results using fetch_assoc(). ```php from("table1 t1"); $query->join("LEFT","table t2","t2.relid = t1.id"); $query->where("t1.field1","=","apple","||"); $query->where("t1.field1","=","pear"); $query->group_by("t1.id"); $query->order_by("t1.field1 DESC"); $query->limit(0,10); $result = $query->build(); if($result) { print_r(WDB::fetch_assoc()); } else { echo "No result found"; } ?> ``` -------------------------------- ### SSL Service Module Development Source: https://dev.wisecp.com/en/kb/testconnection Documentation for developing SSL service modules within WISECP. Includes getting started, configuration files, variables, hooks, and available functions. ```APIDOC ## SSL Service Module Development ### Description This section details the development of SSL service modules for WISECP. It covers the initial setup, configuration files, and the various functions available for module interaction. ### Getting Started Information on how to begin developing SSL modules. ### Configuration Files - `config.php`: Main configuration file for the module. - `pages/product-detail.php`: Handles product detail pages. - `pages/order-detail.php`: Manages order detail pages. - `pages/ac-order-detail.php`: Handles account order detail pages. ### Variables Details on available variables within the SSL module context. ### Hooks (Helping Hooks) Information on using hooks to extend module functionality. ### Functions - `__construct()`: Class constructor. - `set_order()`: Sets the order details. - `setConfig()`: Configures module settings. - `testConnection()`: Tests the connection to the SSL provider. - `use_method()`: Uses a specific API method. - `run_action()`: Executes an action. - `checking_enroll()`: Checks enrollment status. - `edit_order_params()`: Edits order parameters. - `ac_edit_order_params()`: Edits account order parameters. - `create()`: Creates a new SSL order. - `extend()`: Extends an existing SSL order. - `delete()`: Deletes an SSL order. - `list_ssl()`: Lists available SSL certificates. - `import()`: Imports SSL certificates. ``` -------------------------------- ### Accessing Configurable Options in PHP Source: https://dev.wisecp.com/en/kb/parameters This PHP code demonstrates how to retrieve values for configurable options selected by the client during the ordering process. It shows examples for fetching 'RAM', 'Disk Space', and 'Operating System' values. ```php $this->val_of_conf_opt["RAM"]; $this->val_of_conf_opt["Disk Space"]; $this->val_of_requirements["Operating System"]; ``` -------------------------------- ### Accessing Client Configurable Options in PHP Source: https://dev.wisecp.com/en/kb/hosting-panel-module-development-parameters Demonstrates how to retrieve values for configurable options selected by the client during the ordering process. These values are accessible through the $this->val_of_requirements and $this->val_of_conf_opt arrays, allowing for dynamic service provisioning based on client choices. ```php $this->val_of_requirements["Backup"]; $this->val_of_conf_opt["Extra IP"]; ``` -------------------------------- ### SMS Service Module Development - SMS API Integration Source: https://dev.wisecp.com/en/kb/configuration-options Documentation for integrating the SMS API within the SMS Service Module, including getting started, variables, and available functions for sending SMS and managing reports. ```APIDOC ## SMS Service Module Development - SMS API Integration ### Description Details the integration of the SMS API for sending SMS messages, managing sender IDs, content, recipients, and retrieving reports and balance information. ### Functions - **__construct()**: Initializes the SMS API integration. - **title()**: Sets the Sender ID for SMS messages. - **body()**: Defines the content of the SMS message. - **AddNumber()**: Specifies the phone numbers to send the SMS to. - **submit()**: Sends the SMS message. - **getReportID()**: Retrieves the report ID for a sent SMS. - **getReport()**: Fetches the delivery report for an SMS. - **getBalance()**: Retrieves the current SMS balance information. - **get_prices()**: Fetches the costs associated with sending SMS. ``` -------------------------------- ### Get Invoice Details (Example) Source: https://dev.wisecp.com/en/kb/getinvoices This snippet demonstrates how to retrieve details of an invoice using the WiseCP API. It shows the structure of the response, including transaction ID, payment method details, and itemized billing information. ```json { "Transaction ID": "PM12345" }, "payment_method_commission":1, "payment_method_commission_rate":5, "send_bill_to_address": 0, "share": { "token": "VCsxZWZPQkI0bDFhdDNqV0RWZHdyQllGbmN5cGkzcGhRd09tWEc0VTIyMD0=", "link": "https://example.com/invoice?token=VCsxZWZPQkI0bDFhdDNqV0RWZHdyQllGbmN5cGkzcGhRd09tWEc0VTIyMD0=" }, "discounts": [], "items": [ { "id": 458, "owner_id":367, "description": "test description", "quantity": 1, "tax_exempt": false, "amount": 20, "total": 20, "order_id": 0, "due_date": "0000-00-00 00:00:00", "attributes":[] } ] } ``` -------------------------------- ### Sample Hosting Module Structure (PHP) Source: https://dev.wisecp.com/en/kb/hosting-panel-module-development-getting-started Provides a basic directory structure and file layout for a sample hosting panel module in WISECP. This serves as a starting point for developers, illustrating the placement of language files, page templates, configuration files, and the main module file. ```php SampleHostingCP/ |- lang/ | en.php |- pages/ | activation-html.php (Activation EMail Notification Template) | activation-text.php (Activation SMS Notification Template) | clientArea-another.php (An sample module page for client service detail) | clientArea-home.php | create-account-form-elements.php (The output that will appear on adding or editing Product/Service) | order-detail.php (The output that will appear in the service detail of administration panel) | panel.php (The output that will appear in the client panel service detail) | config.php | logo.png | SampleHostingCP.php__ ``` -------------------------------- ### SSL Service Module Development Source: https://dev.wisecp.com/en/kb/create-cancellation-request Overview of the SSL Service Module development, including getting started, configuration files, page handling, variables, hooks, and available functions for managing SSL orders. ```APIDOC ## SSL Service Module Development ### Description This section provides guidance on developing the SSL Service Module, covering setup, configuration, and core functionalities for managing SSL services. ### Key Areas - **Getting Started**: Initial steps for module development. - **Configuration**: Details on `config.php`. - **Pages**: Information on `pages/product-detail.php`, `pages/order-detail.php`, and `pages/ac-order-detail.php`. - **Variables**: Available variables within the module. - **Hooks**: Utilizing "Helping Hooks" for module extension. ### Functions - **__construct()**: Constructor for the SSL service class. - **set_order()**: Sets the order details. - **setConfig()**: Configures module settings. - **testConnection()**: Tests the connection to the SSL provider. - **use_method()**: Executes a specific method. - **run_action()**: Runs a module action. - **checking_enroll()**: Checks the enrollment status of an SSL certificate. - **edit_order_params()**: Edits order parameters. - **ac_edit_order_params()**: Edits order parameters for account creation. - **create()**: Creates a new SSL order. - **extend()**: Extends an existing SSL order. - **delete()**: Deletes an SSL order. - **list_ssl() and import()**: Lists existing SSL certificates and imports them. ``` -------------------------------- ### External API Example: Validate Client Source: https://dev.wisecp.com/en/kb/usage-examples Example of how to validate a client using the external API with cURL. ```APIDOC ## POST /api/Clients/ValidateClient ### Description Validates a client's credentials using their email and password. ### Method POST ### Endpoint `/api/Clients/ValidateClient` ### Parameters #### Query Parameters None #### Request Body - **email** (string) - Required - The client's email address. - **password** (string) - Required - The client's password. ### Request Example ```json { "email": "wisecptest@gmail.com", "password": "test123" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the operation ('successful' or 'error'). - **data** (object) - Contains additional data upon success. - **user_id** (integer) - The ID of the validated user. - **hash** (string) - A unique hash associated with the user session. #### Response Example ```json { "status": "successful", "data": { "user_id": 19, "hash": "ZmozNFdUNy8wMGM4bkVKK01IeUF5d2tSNzU0d1E1VThLZUJmZXNzdVNkK2dvWEgwdmdOTDE4YldmMzFCTVdheVY3bjhRTDBxSVNOb1FXcjBhVEhiTlE9PQ==" } } ``` ``` -------------------------------- ### Initialize Class and Load Configuration in PHP Source: https://dev.wisecp.com/en/kb/__construct The __construct() function initializes the class by loading module configurations from 'config.php', language files based on client locale, and API service files. It also handles Whois privacy settings and sets up API credentials. ```php $this->config = Modules::Config("Registrars",__CLASS__); $this->lang = Modules::Lang("Registrars",__CLASS__); if(!class_exists("ExampleRegistrarModule_API")){ // Calling API files include __DIR__.DS."api.php"; } if(isset($this->config["settings"]["whidden-amount"])){ $whidden_amount = $this->config["settings"]["whidden-amount"]; $whidden_currency = $this->config["settings"]["whidden-currency"]; $this->whidden["amount"] = $whidden_amount; $this->whidden["currency"] = $whidden_currency; } class ExampleRegistrarModule { public $api = false; // Set API Credentials $username = $this->config["settings"]["username"]; $password = $this->config["settings"]["password"]; $password = Crypt::decode($password,Config::get("crypt/system")); $sandbox = (bool)$this->config["settings"]["test-mode"]; $this->api = new ExampleRegistrarModule_API($sandbox); $this->api->set_credentials($username,$password); ``` -------------------------------- ### Internal API Example: Create Client SSO Token Source: https://dev.wisecp.com/en/kb/usage-examples Example of how to create a client SSO token using the internal PHP API. ```APIDOC ## POST /api/Clients/CreateClientSsoToken ### Description Creates a Single Sign-On (SSO) token for a client using their email and password. ### Method POST ### Endpoint `/api/Clients/CreateClientSsoToken` ### Parameters #### Query Parameters None #### Request Body - **email** (string) - Required - The client's email address. - **password** (string) - Required - The client's password. ### Request Example ```php CreateClientSsoToken([ "email" => "wisecptest@gmail.com", "password" => "test123" ]); if($result["status"] == "error") throw new Exception($result["message"]); echo $result["data"]["user_id"]; } catch (Exception $e) { echo 'Error: '.$e->getMessage(); } ?> ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the operation ('successful' or 'error'). - **data** (array) - Contains additional data upon success. - **user_id** (integer) - The ID of the created user. - **hash** (string) - A unique hash associated with the user session. #### Response Example ```php Array ( [status] => successful [data] => Array ( [user_id] => 22 [hash] => TEtzRzkyUy84N2habVlEQWVUNHhhL0pvRUd0ZVMrMXpQVmVKUTlid2Rac1h5NGJ5L2E0RzhLV082T2EvM1RRbmNmUVVJcFdoT093eExsaWlORERyV1E9PQ== ) ) ``` ``` -------------------------------- ### Accessing Creation Info for Service Options in PHP Source: https://dev.wisecp.com/en/kb/hosting-panel-module-development-parameters Shows how to access creation information for service options, which are stored in the $this->order["options"]["creation_info"] variable. This is useful for retrieving specific details about how a service was configured or created. ```php $this->order["options"]["creation_info"]["example1"]; ``` -------------------------------- ### Implement Installment Rates for Payment Gateways (PHP) Source: https://dev.wisecp.com/en/kb/installment-options This function allows payment modules to offer installment options based on credit card information. It should return an associative array where keys are the number of installments and values are the corresponding rates. If no installment options are available or desired, an empty array should be returned. ```PHP public function installment_rates($card_info=[]) { if($card_info['brand'] == 'American Express') return [ 2 => 3.5, 3 => 3.8, 4 => 4.2, 5 => 5.2, 6 => 6.1, ]; else return []; // it should be empty array if you don't want the option to exit. } ``` -------------------------------- ### Create Hook File in WISECP Source: https://dev.wisecp.com/en/kb/hooks-getting-started Demonstrates how to create a new hook file named 'hello.php' in the WISECP hooks directory using the 'touch' command. This is the initial step for implementing custom hook functionalities. ```bash touch ~/coremio/hooks/hello.php ``` -------------------------------- ### Get Nameserver Details Function Source: https://dev.wisecp.com/en/kbc/functions_p=2 Fetches available nameserver information for a given domain name. It uses the idn_to_ascii function for domain name conversion and then calls an API to get the details. ```php public function NsDetails($params = []) { $domain = idn_to_ascii($params["domain"], 0, INTL_IDNA_VARIANT_UTS46); $details = $this->api->get_details($domain); if (!$details) return false; // Process and return details } ``` -------------------------------- ### WISECP License API - Introduction Source: https://dev.wisecp.com/en/kb/change_config Provides an overview of the WISECP License API. ```APIDOC ## Introduction to WISECP License API ### Description This section provides an introduction to the WISECP License API, outlining its capabilities and purpose for managing WISECP licenses programmatically. ### Method N/A ### Endpoint N/A ### Parameters None ### Request Example N/A ### Response N/A ``` -------------------------------- ### WISECP Billing API - Get Invoices List Source: https://dev.wisecp.com/en/kbc/actions-billing Fetches a list of invoices based on specified criteria, supporting pagination. This is a GET request to the Billing/GetInvoices endpoint with 'page' and 'limit' parameters. ```bash curl --location 'https://example.com/api/Billing/GetInvoices?page=1&limit=10' ``` -------------------------------- ### Define Configuration Fields in PHP Source: https://dev.wisecp.com/en/kb/configuration-options This snippet demonstrates how to define configuration fields within a PHP file for WiseCP. It shows the structure for creating an array of fields, including a placeholder example. This is crucial for customizing module settings. ```php 'placeholder' => "Sample placeholder", ], ]; } ``` -------------------------------- ### WISECP Billing API - Get Invoice Details Source: https://dev.wisecp.com/en/kbc/actions-billing Retrieves full details of a specified invoice using its ID. This is a GET request to the Billing/GetInvoice endpoint. Requires an integer Invoice ID. ```bash curl --location 'https://example.com/api/Billing/GetInvoice/{{ID}}' ``` -------------------------------- ### Accessing Hosting Account Credentials in PHP Source: https://dev.wisecp.com/en/kb/hosting-panel-module-development-parameters Shows how to retrieve hosting account access information, including username and password, which are stored in the $this->order["options"]["config"] array. This is typically used during service activation to set up the hosting account. ```php $this->order["options"]["config"]["user"]; // User Name $this->order["options"]["config"]["password"]; // Password ``` -------------------------------- ### Hosting Panel Module Development - Supported Functions Source: https://dev.wisecp.com/en/kbc/hosting-panel-module-development_p=2 Details on supported functions within the Hosting Panel module, including `testConnect` for connection testing and `create` for initiating services. ```APIDOC ## POST /hosting/module/testConnect ### Description Tests the connection to the hosting server. This function, when implemented, adds a 'Test Connection' button to the add/edit server page. The return value must be a boolean. ### Method POST ### Endpoint /hosting/module/testConnect ### Parameters #### Query Parameters - **connection_details** (object) - Required - Details for testing the connection. ### Request Example ```json { "connection_details": { "host": "your_server_ip", "username": "your_username", "password": "your_password" } } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the connection test was successful. #### Response Example ```json { "success": true } ``` ``` ```APIDOC ## POST /hosting/module/create ### Description Initiates the creation of a hosting service. This is a mandatory function for the module class and can be run manually or automatically. It must return a success or error response. ### Method POST ### Endpoint /hosting/module/create ### Parameters #### Query Parameters - **service_details** (object) - Required - Details of the service to be created. ### Request Example ```json { "service_details": { "package_id": "1", "domain": "example.com", "username": "user123" } } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the creation (e.g., 'success', 'error'). - **message** (string) - A message describing the outcome. #### Response Example ```json { "status": "success", "message": "Hosting service created successfully." } ``` ``` -------------------------------- ### WISECP SMS API - Incorrect Response Example (JSON) Source: https://dev.wisecp.com/en/kb/international-sms-api-getting-started This code snippet demonstrates an example of an incorrect response from the WISECP SMS API. It indicates an error status and provides a message explaining the issue. This is useful for understanding how to handle API errors. ```json { "status":"error", "message":"something write here..." } ```