娱乐

转账API

该API提供端点,用于查询所有交易信息、在余额平台内转移资金,或将资金从余额平台发送至转账工具。

查看官方文档 ↗

接入教程

1. 在Adyen平台注册并获取API密钥
2. 调用交易查询端点获取历史记录
3. 使用余额转移端点进行内部调拨
4. 配置转账工具并执行外部汇款
5. 通过Webhook接收转账状态通知
6. 查看API文档处理错误代码

使用Python发起转账

python
import requests
import json

url = "https://api.example.com/transfers"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_API_KEY"
}
payload = {
    "amount": {"currency": "USD", "value": 1000},
    "source": {"type": "balanceAccount", "id": "BA1234567890"},
    "destination": {"type": "transferInstrument", "id": "TI0987654321"},
    "reference": "ORDER_12345"
}

response = requests.post(url, headers=headers, data=json.dumps(payload))
print(response.status_code)
print(response.json())

使用PHP查询交易记录

php
<?php
$url = 'https://api.example.com/transfers';
$apiKey = 'YOUR_API_KEY';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
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);

if ($httpCode == 200) {
    $data = json_decode($response, true);
    print_r($data);
} else {
    echo "Request failed with status: $httpCode";
}
?>

使用JavaScript获取转账详情

javascript
const fetchTransferDetails = async (transferId) => {
    const url = `https://api.example.com/transfers/${transferId}`;
    const options = {
        method: 'GET',
        headers: {
            'Authorization': 'Bearer YOUR_API_KEY',
            'Content-Type': 'application/json'
        }
    };

    try {
        const response = await fetch(url, options);
        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }
        const data = await response.json();
        console.log(data);
        return data;
    } catch (error) {
        console.error('Error fetching transfer details:', error);
    }
};

// Example usage
fetchTransferDetails('TR_ABC123XYZ');

常见问题

转账API的主要用途是什么?

转账API主要用于在余额平台内转移资金、查询所有交易信息,以及将资金从余额平台发送至指定的转账工具。

调用API时如何认证身份?

需要在请求头中使用Bearer Token进行身份认证,格式为:Authorization: Bearer YOUR_API_KEY。请将YOUR_API_KEY替换为您的实际API密钥。

API支持哪些货币和金额格式?

API支持多种货币,金额需以对象形式提供,包含currency(如USD)和value字段。value单位为最小货币单位(例如美分为分)。

相似接口推荐

AWS Compute Optimizer

Compute Optimizer是一项分析亚马逊云服务计算资源配置和利用率的服务,涵盖Amazon EC2实例、Auto Scaling组、Lambda函数、EBS卷及Fargate上的ECS服务。它会评估资源使用效率

待确认
资金API

该API用于经典集成方案,提供管理平台账户资金的端点功能,包括资金分配、余额查询等操作。如需全新集成请参考官方最新指南。

待确认
Square支付

Square提供便捷的在线收款解决方案,支持支付处理和退款管理,帮助商家优化客户结账体验。

免费试用
狗事实API

提供随机狗事实的简单REST API,可用于娱乐或教育目的

免费