获取与提供的客户 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。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。