fix: resolve TX-DYNAMIC 404 error and enhance multi-chain API support

This commit is contained in:
mstfyldz
2026-03-13 03:03:35 +03:00
parent 7c9fa48d0b
commit 5f0df83686
5 changed files with 65 additions and 65 deletions

View File

@@ -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,