update
This commit is contained in:
parent
bc56eb02ad
commit
0fd991a1ce
@ -64,6 +64,11 @@ app.get('/', (req, res) => {
|
|||||||
res.sendFile(path.join(__dirname, 'public', 'index.html'));
|
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) => {
|
app.get('/api/products', (req, res) => {
|
||||||
res.json(PRODUCTS);
|
res.json(PRODUCTS);
|
||||||
@ -172,14 +177,14 @@ app.post('/api/payment/create', async (req, res) => {
|
|||||||
chainType: '1', // USDT TRC20
|
chainType: '1', // USDT TRC20
|
||||||
fiatAmount: order.total_amount.toFixed(2),
|
fiatAmount: order.total_amount.toFixed(2),
|
||||||
fiatCurrency: 'USD',
|
fiatCurrency: 'USD',
|
||||||
notifyUrl: `${baseUrl}/api/payment/callback`,
|
notifyUrl: `${baseUrl}/api/payment/callback`
|
||||||
redirectUrl: `${baseUrl}/success.html`
|
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('Payment data with redirectUrl:', paymentData);
|
console.log('Payment data with redirectUrl:', paymentData);
|
||||||
|
|
||||||
// 生成签名
|
// 生成签名
|
||||||
paymentData.signature = generateUpaySignature(paymentData, UPAY_APP_SECRET);
|
paymentData.signature = generateUpaySignature(paymentData, UPAY_APP_SECRET);
|
||||||
|
paymentData.redirectUrl = `${baseUrl}/success`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await axios.post(`${UPAY_API_URL}/order/apply`, paymentData, {
|
const response = await axios.post(`${UPAY_API_URL}/order/apply`, paymentData, {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user