diff --git a/server.js b/server.js index 79b1054..bd8590f 100644 --- a/server.js +++ b/server.js @@ -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, {