This commit is contained in:
aaron 2025-08-10 18:54:02 +08:00
parent bc56eb02ad
commit 0fd991a1ce

View File

@ -64,6 +64,11 @@ app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'index.html'));
});
// 支付成功页面路由
app.get('/success', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'success.html'));
});
// 获取产品信息
app.get('/api/products', (req, res) => {
res.json(PRODUCTS);
@ -172,14 +177,14 @@ app.post('/api/payment/create', async (req, res) => {
chainType: '1', // USDT TRC20
fiatAmount: order.total_amount.toFixed(2),
fiatCurrency: 'USD',
notifyUrl: `${baseUrl}/api/payment/callback`,
redirectUrl: `${baseUrl}/success.html`
notifyUrl: `${baseUrl}/api/payment/callback`
};
console.log('Payment data with redirectUrl:', paymentData);
// 生成签名
paymentData.signature = generateUpaySignature(paymentData, UPAY_APP_SECRET);
paymentData.redirectUrl = `${baseUrl}/success`;
try {
const response = await axios.post(`${UPAY_API_URL}/order/apply`, paymentData, {