Files
Pay2Gateway/app/api/crypto-sweep/route.ts

32 lines
1.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { NextResponse } from 'next/server';
import { CryptoEngine } from '@/lib/crypto-engine';
export async function POST(request: Request) {
try {
const body = await request.json();
const { txId, merchantAddress } = body;
// In a real app, you would fetch the private key for this txId from a secure DB/Vault
// For demo: We just simulate the result of a sweep
console.log(`[API] Checking and Sweeping for Transaction: ${txId}`);
// Mock success response
return NextResponse.json({
success: true,
message: "Ödeme başarıyla doğrulandı ve dağıtıldı.",
split: {
platform: "1.00 USDT (%1)",
merchant: "99.00 USDT (%99)"
},
hashes: {
platform: "0x" + Math.random().toString(16).slice(2, 66),
merchant: "0x" + Math.random().toString(16).slice(2, 66)
}
});
} catch (error: any) {
return NextResponse.json({ success: false, error: error.message }, { status: 500 });
}
}