當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


PHP WHMCS GetTLDPricing用法及代碼示例

檢索 TLD 定價

請求參數

參數 類型 說明 必需的
action string “GetTLDPricing” Required
currencyid int 要獲取定價的貨幣 ID。傳遞這個或 clientid,但不能同時傳遞。客戶端 ID 覆蓋貨幣 ID。 Optional
clientid int 要獲取定價的客戶 ID。傳遞這個或 clientid,但不能同時傳遞。客戶端 ID 覆蓋貨幣 ID。 Optional

響應參數

參數 類型 說明
result string 操作結果:成功或錯誤
currency array 有關相關貨幣的信息數組。
pricing array 已配置 TLD 的一係列定價和其他信息。此數組中的項目是有條件的,僅在用戶已經配置定價(包括價格 0)時才會出現。

示例請求 (CURL)

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
    http_build_query(
        array(
            'action' => 'GetTLDPricing',
            // See https://developers.whmcs.com/api/authentication
            'username' => 'IDENTIFIER_OR_ADMIN_USERNAME',
            'password' => 'SECRET_OR_HASHED_PASSWORD',
            'currencyid' => '1',
            'responsetype' => 'json',
        )
    )
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);

示例請求(本地 API)

$command = 'GetTLDPricing';
$postData = array(
    'currencyid' => '1',
);
$adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later

$results = localAPI($command, $postData, $adminUsername);
print_r($results);

示例響應 JSON

{
    "result": "success",
    "currency": {
        "id": 1,
        "code": "USD",
        "prefix": "$",
        "suffix": " USD",
        "format": 1,
        "rate": "1.00000"
    },
    "pricing": {
        "com": {
            "categories": [
                "Popular"
            ],
            "addons": {
                "dns": false,
                "email": false,
                "idprotect": false
            },
            "group": "",
            "register": {
                "1": "14.95"
            },
            "transfer": {
                "1": "14.95"
            },
            "renew": {
                "1": "14.95"
            },
            "grace_period": null,
            "redemption_period": null
        },
        "net": {
            "categories": [
                "Popular"
            ],
            "addons": {
                "dns": false,
                "email": false,
                "idprotect": false
            },
            "group": "",
            "register": {
                "1": "14.95"
            },
            "transfer": {
                "1": "14.95"
            },
            "renew": {
                "1": "14.95"
            },
            "grace_period": null,
            "redemption_period": null
        },
        "org": {
            "categories": [
                "Popular"
            ],
            "addons": {
                "dns": false,
                "email": false,
                "idprotect": false
            },
            "group": "",
            "register": {
                "1": "14.95"
            },
            "transfer": {
                "1": "14.95"
            },
            "renew": {
                "1": "14.95"
            },
            "grace_period": null,
            "redemption_period": null
        },
        "biz": {
            "categories": [
                "Popular"
            ],
            "addons": {
                "dns": false,
                "email": false,
                "idprotect": false
            },
            "group": "",
            "register": {
                "1": "14.95"
            },
            "transfer": {
                "1": "14.95"
            },
            "renew": {
                "1": "14.95"
            },
            "grace_period": null,
            "redemption_period": null
        },
        "info": {
            "categories": [
                "Popular"
            ],
            "addons": {
                "dns": false,
                "email": false,
                "idprotect": false
            },
            "group": "",
            "register": {
                "1": "14.95"
            },
            "transfer": {
                "1": "14.95"
            },
            "renew": {
                "1": "14.95"
            },
            "grace_period": null,
            "redemption_period": null
        }
    }
}

相關用法


注:本文由純淨天空篩選整理自whmcs.com大神的英文原創作品 GetTLDPricing。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。