獲取與提供的客戶 ID 關聯的付款方式。
請求參數
參數 | 類型 | 說明 | 必需的 |
---|---|---|---|
action | string | “GetPayMethods” | Required |
clientid | int | 獲取支付方式的客戶ID | Required |
paymethodid | int | 要檢索的特定支付方式的 ID | Optional |
type | string | 要返回的付款方式的類型。 “銀行賬戶”或“信用卡” | Optional |
響應參數
參數 | 類型 | 說明 |
---|---|---|
result | string | 操作結果:成功或錯誤 |
clientid | int | 為其返回支付方式的客戶 ID |
paymethods | array | 符合條件的支付方式 |
示例請求 (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' => 'GetPayMethods',
// See https://developers.whmcs.com/api/authentication
'username' => 'IDENTIFIER_OR_ADMIN_USERNAME',
'password' => 'SECRET_OR_HASHED_PASSWORD',
'clientid' => '1',
'responsetype' => 'json',
)
)
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
示例請求(本地 API)
$command = 'GetPayMethods';
$postData = array(
'clientid' => '1',
);
$adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later
$results = localAPI($command, $postData, $adminUsername);
print_r($results);
示例響應 JSON
{
"result": "success",
"clientid": "1",
"paymethods": [
{
"id": 1,
"type": "RemoteCreditCard",
"description": "Default Card",
"gateway_name": "stripe",
"contact_type": "Client",
"contact_id": 1,
"card_last_four": "4242",
"expiry_date": "02\/25",
"start_date": "",
"issue_number": "",
"card_type": "Visa",
"remote_token": "{\"customer\":\"xxx\",\"method\":\"xxx\"}",
"last_updated": "17\/05\/2019 10:01"
},
{
"id": 2,
"type": "CreditCard",
"description": "A Second Card Stored Locally",
"gateway_name": "",
"contact_type": "Client",
"contact_id": 1,
"card_last_four": "4242",
"expiry_date": "11\/22",
"start_date": "",
"issue_number": "",
"card_type": "Visa",
"remote_token": "",
"last_updated": "17\/05\/2019 10:21"
},
{
"id": 3,
"type": "RemoteCreditCard",
"description": "A Third Remotely Stored Card",
"gateway_name": "eonlinedata",
"contact_type": "Client",
"contact_id": 1,
"card_last_four": "4242",
"expiry_date": "02\/23",
"start_date": "",
"issue_number": "",
"card_type": "Visa",
"remote_token": "1919214111,1832201236,33798e677c584bdcba0ad2d85d0a5d97",
"last_updated": "17\/05\/2019 10:01"
},
{
"id": 4,
"type": "BankAccount",
"description": "A Bank Account",
"gateway_name": "",
"contact_type": "Client",
"contact_id": 1,
"bank_name": "Bank of America",
"remote_token": "",
"last_updated": "17\/05\/2019 10:01"
},
{
"id": 5,
"type": "RemoteBankAccount",
"description": "A Remote Bank Account",
"gateway_name": "gocardless",
"contact_type": "Client",
"contact_id": 1,
"bank_name": "",
"remote_token": "MD123456789",
"last_updated": "17\/05\/2019 10:01"
}
]
}
錯誤響應
可能的錯誤條件響應包括:
- 客戶 ID 為必填項
- 支付方式類型無效。應該是“BankAccount”或“CreditCard”
- 未找到客戶
相關用法
- PHP WHMCS GetPaymentMethods用法及代碼示例
- PHP WHMCS GetPermissionsList用法及代碼示例
- PHP WHMCS GetPromotions用法及代碼示例
- PHP WHMCS GetProducts用法及代碼示例
- PHP WHMCS GetProjects用法及代碼示例
- PHP WHMCS GetProject用法及代碼示例
- PHP WHMCS GetTicketNotes用法及代碼示例
- PHP WHMCS GetUsers用法及代碼示例
- PHP WHMCS GetTLDPricing用法及代碼示例
- PHP WHMCS GetToDoItemStatuses用法及代碼示例
- PHP WHMCS GetCurrencies用法及代碼示例
- PHP WHMCS GetStaffOnline用法及代碼示例
- PHP WHMCS GetEmails用法及代碼示例
- PHP WHMCS GetClientPassword用法及代碼示例
- PHP WHMCS GetRegistrars用法及代碼示例
- PHP WHMCS GetAutomationLog用法及代碼示例
- PHP WHMCS GetQuotes用法及代碼示例
- PHP WHMCS GetActivityLog用法及代碼示例
- PHP WHMCS GetModuleQueue用法及代碼示例
- PHP WHMCS GetTickets用法及代碼示例
- PHP WHMCS GetInvoices用法及代碼示例
- PHP WHMCS GetServers用法及代碼示例
- PHP WHMCS GetSupportStatuses用法及代碼示例
- PHP WHMCS GetHealthStatus用法及代碼示例
- PHP WHMCS GetTicketAttachment用法及代碼示例
注:本文由純淨天空篩選整理自whmcs.com大神的英文原創作品 GetPayMethods。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。