金融与汇率

Hosted onboarding API

该API用于经典集成,提供端点生成Adyen托管的页面链接,如网站。如刚开始实施,请参考新集成指南。

查看官方文档 ↗

接入教程

1. 注册Adyen账户并获取API密钥。
2. 调用API端点生成托管页面链接。
3. 将链接嵌入您的平台中。
4. 测试链接确保功能正常。
5. 监控集成状态并进行优化。

使用Python生成托管页面链接

python
import requests

base_url = 'https://api.example.com'
headers = {
    'X-API-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json'
}

# 准备请求数据
payload = {
    'reference': 'your_unique_reference',
    'returnUrl': 'https://your-return-url.com'
}

# 调用API端点生成链接
response = requests.post(
    f'{base_url}/generateHostedLink',
    headers=headers,
    json=payload
)

if response.status_code == 200:
    result = response.json()
    hosted_link = result.get('url')
    print(f'Hosted link generated: {hosted_link}')
else:
    print(f'Error: {response.status_code}')
    print(response.text)

使用PHP调用托管集成API

php
<?php

$baseUrl = 'https://api.example.com';
$apiKey = 'YOUR_API_KEY';

$data = [
    'reference' => 'your_unique_reference',
    'returnUrl' => 'https://your-return-url.com'
];

$ch = curl_init($baseUrl . '/generateHostedLink');
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);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

if ($httpCode === 200) {
    $result = json_decode($response, true);
    $hostedLink = $result['url'] ?? '';
    echo "Hosted link generated: " . $hostedLink;
} else {
    echo "Error: " . $httpCode;
    echo $response;
}

curl_close($ch);
?>

使用JavaScript集成托管页面API

javascript
const baseUrl = 'https://api.example.com';
const apiKey = 'YOUR_API_KEY';

async function generateHostedLink() {
    const payload = {
        reference: 'your_unique_reference',
        returnUrl: 'https://your-return-url.com'
    };

    try {
        const response = await fetch(`${baseUrl}/generateHostedLink`, {
            method: 'POST',
            headers: {
                'X-API-Key': apiKey,
                'Content-Type': 'application/json'
            },
            body: JSON.stringify(payload)
        });

        if (response.ok) {
            const result = await response.json();
            const hostedLink = result.url;
            console.log(`Hosted link generated: ${hostedLink}`);
            return hostedLink;
        } else {
            console.error(`Error: ${response.status}`);
            const errorText = await response.text();
            console.error(errorText);
        }
    } catch (error) {
        console.error('Request failed:', error);
    }
}

// 调用函数
generateHostedLink();

常见问题

什么是托管集成API?

托管集成API允许您通过调用API端点生成Adyen托管的页面链接,如网站或支付页面,简化集成流程。

如何获取API密钥?

API密钥需从您的Adyen账户控制台获取。请登录后,在API凭证部分生成或查看您的API密钥,并确保安全存储。

API调用失败怎么办?

请检查API密钥是否正确、网络连接是否正常,并确认请求参数符合文档要求。如问题持续,请参考Adyen官方文档或联系支持。

相似接口推荐

AWS Import/Export

AWS Import/Export服务通过邮寄物理存储设备的方式,在AWS云和用户本地环境间高效传输海量数据。该服务利用亚马逊高速内部网络直接读写存储设备,适用于大规模数据迁移场景。

待确认
AWS Greengrass

AWS IoT Greengrass可将AWS功能无缝扩展至物理设备,使设备能够本地处理生成的数据,同时仍利用云端进行管理、分析和持久存储。该服务确保设备能够快速响应本地事件,并在间歇性连接下稳定运行。

待确认
Amazon ElastiCache

Amazon ElastiCache是一项Web服务,可简化云端分布式缓存的设置、操作和扩展。它让客户能够获得高性能内存缓存的所有优势,同时减少管理负担。

待确认
Amazon Elastic Inference

Elastic Inference是AWS提供的弹性推理服务公共API。自2023年4月15日起,AWS不再接受新客户使用该服务,并协助现有客户迁移至性价比更优的替代方案。该API用于管理云端AI推理的加速计算资源。

待确认