update
This commit is contained in:
parent
8f5a415e35
commit
61cefd9380
11
server.js
11
server.js
@ -164,16 +164,23 @@ app.post('/api/payment/create', async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 创建 UPay 支付订单
|
// 创建 UPay 支付订单
|
||||||
|
const baseUrl = `${req.protocol}://${req.get('host')}`;
|
||||||
|
const redirectUrl = `${baseUrl}/success.html?order_id=${order_id}`;
|
||||||
|
|
||||||
const paymentData = {
|
const paymentData = {
|
||||||
appId: UPAY_APP_ID,
|
appId: UPAY_APP_ID,
|
||||||
merchantOrderNo: order_id,
|
merchantOrderNo: order_id,
|
||||||
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: `${req.protocol}://${req.get('host')}/api/payment/callback`,
|
notifyUrl: `${baseUrl}/api/payment/callback`,
|
||||||
redirectUrl: `${req.protocol}://${req.get('host')}/success.html?order_id=${order_id}`
|
redirectUrl: encodeURIComponent(redirectUrl)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log('Payment data before signature:', paymentData);
|
||||||
|
console.log('Original redirectUrl:', redirectUrl);
|
||||||
|
console.log('Encoded redirectUrl:', paymentData.redirectUrl);
|
||||||
|
|
||||||
// 生成签名
|
// 生成签名
|
||||||
paymentData.signature = generateUpaySignature(paymentData, UPAY_APP_SECRET);
|
paymentData.signature = generateUpaySignature(paymentData, UPAY_APP_SECRET);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user