接入教程
1. 访问Adyen文档获取API凭证
2. 使用凭证进行API身份验证
3. 调用BIN查询端点提交银行卡识别码
4. 解析返回的成本估算与3D Secure支持信息
使用Python查询BIN信息
python
import requests
url = "https://api.example.com/v52/get3dsAvailability"
headers = {
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"cardNumber": "4111111111111111"
}
response = requests.post(url, json=payload, headers=headers)
if response.status_code == 200:
data = response.json()
print("3DS Availability:", data)
else:
print("Error:", response.status_code, response.text)
使用PHP查询BIN信息
php
<?php
$url = 'https://api.example.com/v52/getCostEstimate';
$apiKey = 'YOUR_API_KEY';
$data = [
'merchantAccount' => 'YOUR_MERCHANT_ACCOUNT',
'cardNumber' => '4111111111111111'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-API-Key: ' . $apiKey,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
} else {
$decoded = json_decode($response, true);
print_r($decoded);
}
curl_close($ch);
?>
使用JavaScript查询BIN信息
javascript
const fetchBinInfo = async () => {
const url = 'https://api.example.com/v52/get3dsAvailability';
const payload = {
merchantAccount: 'YOUR_MERCHANT_ACCOUNT',
cardNumber: '4111111111111111'
};
try {
const response = await fetch(url, {
method: 'POST',
headers: {
'X-API-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify(payload)
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
console.log('3DS Availability:', data);
} catch (error) {
console.error('Error:', error);
}
};
fetchBinInfo();
常见问题
什么是BIN查询API的主要用途?
BIN查询API主要用于根据银行卡识别码(BIN)检索支付卡的相关信息,例如成本估算和3D Secure支持的版本,以帮助商家优化支付流程和风险评估。
调用API时遇到认证错误怎么办?
请确保使用正确的API密钥(API Key)和商户账户(Merchant Account),并在请求头中正确设置X-API-Key字段。如果问题持续,请检查API凭证是否有效或在Adyen后台重新生成。
API支持哪些银行卡信息查询?
该API支持查询银行卡的3D Secure可用性、交易成本估算以及发卡行相关信息,具体可用的端点请参考官方文档中的详细说明。
Aitishiku.com