接入教程
1. 注册Adyen平台账户并获取API密钥
2. 配置API请求头中的身份验证信息
3. 调用/accounts端点获取账户列表
4. 使用/funds端点进行资金操作
5. 通过webhook接收资金状态通知
6. 在仪表板查看资金流转记录
Python查询账户余额示例
python
import requests
url = "https://api.example.com/v1/accounts/balance"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
params = {
"accountId": "ACC123456"
}
response = requests.get(url, headers=headers, params=params)
print(f"Status Code: {response.status_code}")
print(f"Response: {response.json()}")
PHP资金分配示例
php
<?php
$url = "https://api.example.com/v1/funds/allocate";
$apiKey = "YOUR_API_KEY";
$data = [
"sourceAccount" => "ACC123456",
"destinationAccount" => "ACC789012",
"amount" => 1000.50,
"currency" => "USD"
];
$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, [
"Authorization: Bearer " . $apiKey,
"Content-Type: application/json"
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "Status Code: " . $httpCode . "\n";
echo "Response: " . $response . "\n";
?>
JavaScript交易记录查询示例
javascript
const fetch = require('node-fetch');
async function getTransactionHistory() {
const url = "https://api.example.com/v1/transactions";
const apiKey = "YOUR_API_KEY";
const params = new URLSearchParams({
accountId: "ACC123456",
startDate: "2024-01-01",
endDate: "2024-01-31"
});
try {
const response = await fetch(`${url}?${params}`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
}
});
console.log(`Status Code: ${response.status}`);
const data = await response.json();
console.log(`Response: ${JSON.stringify(data, null, 2)}`);
} catch (error) {
console.error(`Error: ${error.message}`);
}
}
getTransactionHistory();
常见问题
如何获取API密钥?
API密钥需要在平台管理后台申请,具体路径为:设置 > 开发者 > API密钥管理。请妥善保管密钥,不要泄露给第三方。
资金API支持哪些货币类型?
资金API支持主流国际货币,包括USD、EUR、GBP、JPY、CNY等。具体支持的货币列表请参考官方文档的货币代码章节。
API调用频率有限制吗?
是的,资金API有调用频率限制。免费套餐每分钟最多60次调用,企业套餐可根据合同约定调整。超出限制会返回429状态码。
Aitishiku.com