fix: resolve TX-DYNAMIC 404 error and enhance multi-chain API support
This commit is contained in:
@@ -85,13 +85,15 @@ export async function POST(req: NextRequest) {
|
||||
};
|
||||
|
||||
// 4. Log transaction in Supabase
|
||||
let txId = '';
|
||||
try {
|
||||
await db.query(`
|
||||
const dbResult = await db.query(`
|
||||
INSERT INTO transactions (
|
||||
amount, currency, status, stripe_pi_id, source_ref_id,
|
||||
customer_name, customer_phone, callback_url, merchant_id,
|
||||
provider, metadata
|
||||
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)
|
||||
RETURNING id
|
||||
`, [
|
||||
amount, currency, 'pending', providerTxId, ref_id,
|
||||
customer_name, customer_phone, callback_url, resolvedMerchantId,
|
||||
@@ -101,11 +103,13 @@ export async function POST(req: NextRequest) {
|
||||
wallets: cryptoWallets
|
||||
})
|
||||
]);
|
||||
txId = dbResult.rows[0].id;
|
||||
} catch (dbError) {
|
||||
console.error('Database log error:', dbError);
|
||||
}
|
||||
|
||||
return NextResponse.json({
|
||||
id: txId,
|
||||
clientSecret: clientSecret,
|
||||
nextAction,
|
||||
redirectUrl,
|
||||
|
||||
Reference in New Issue
Block a user