PHP示例:
// 创建订单
$url = 'https://sxyskd.457009.icu/api/v1/create_order.php';
$data = [
'api_key' => 'sk_xxxx',
'title' => '测试商品',
'amount' => 100.00
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$response = curl_exec($ch);
$result = json_decode($response, true);
if ($result['success']) {
echo '支付链接:' . $result['pay_url'];
}
Python示例:
# 创建订单
import requests
url = 'https://sxyskd.457009.icu/api/v1/create_order.php'
data = {
'api_key': 'sk_xxxx',
'title': '测试商品',
'amount': 100.00
}
response = requests.post(url, json=data)
result = response.json()
if result['success']:
print(f"支付链接:{result['pay_url']}")
JavaScript示例:
// 创建订单
const response = await fetch('https://sxyskd.457009.icu/api/v1/create_order.php', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
api_key: 'sk_xxxx',
title: '测试商品',
amount: 100.00
})
});
const result = await response.json();
console.log(result.pay_url);