- Added dedicated merchant dashboard with analytics and transactions - Implemented API Key based authentication for merchants - Introduced 8-character Short IDs for merchants to use in URLs - Refactored checkout and payment intent APIs to support multi-gateway - Enhanced Landing Page with Merchant Portal access and marketing copy - Fixed Next.js 15 async params build issues - Updated internal branding to P2CGateway - Added AyrisTech credits to footer
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { NextRequest, NextResponse } from 'next/server';
|
|
import { supabaseAdmin } from '@/lib/supabase-admin';
|
|
|
|
export async function POST(req: NextRequest) {
|
|
try {
|
|
const { clientSecret, status, customer_name, customer_phone } = await req.json();
|
|
|
|
if (process.env.NEXT_PUBLIC_USE_MOCK_PAYMENTS !== 'true') {
|
|
return NextResponse.json({ error: 'Mock payments are disabled' }, { status: 403 });
|
|
}
|
|
|
|
// Update transaction in Supabase
|
|
const { error } = await supabaseAdmin
|
|
.from('transactions')
|
|
.update({
|
|
status,
|
|
customer_name,
|
|
customer_phone
|
|
})
|
|
.eq('stripe_pi_id', clientSecret); // In mock mode, we use clientSecret as the ID
|
|
|
|
if (error) {
|
|
console.error('Mock update DB error:', error);
|
|
return NextResponse.json({ error: error.message }, { status: 500 });
|
|
}
|
|
|
|
return NextResponse.json({ success: true });
|
|
} catch (err: any) {
|
|
return NextResponse.json({ error: err.message }, { status: 500 });
|
|
}
|
|
}
|