'use client'; import React, { useState } from 'react'; import { useRouter } from 'next/navigation'; import { ArrowLeft, Building2, Globe, CheckCircle2, Loader2, ShieldCheck, Smartphone, CreditCard } from 'lucide-react'; import Link from 'next/link'; export default function NewMerchantPage() { const router = useRouter(); const [isLoading, setIsLoading] = useState(false); const [name, setName] = useState(''); const [webhookUrl, setWebhookUrl] = useState(''); const [paymentProvider, setPaymentProvider] = useState('stripe'); const [feePercent, setFeePercent] = useState('1.0'); const [success, setSuccess] = useState(false); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setIsLoading(true); try { const response = await fetch('/api/merchants', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ name, webhook_url: webhookUrl, payment_provider: paymentProvider, fee_percent: parseFloat(feePercent || '1.0') }), }); if (!response.ok) { const data = await response.json(); throw new Error(data.error || 'Firma eklenemedi.'); } setSuccess(true); setTimeout(() => { router.push('/admin/merchants'); router.refresh(); }, 2000); } catch (err: any) { alert(err.message || 'Firma eklenirken bir hata oluştu.'); } finally { setIsLoading(false); } }; if (success) { return (

Firma Başarıyla Oluşturuldu!

Yönlendiriliyorsunuz...

); } return (
{/* Header */}

Yeni Firma Kaydı

Sisteme yeni bir işletme entegre edin

{/* Form Column */}
{/* Name Input */}
setName(e.target.value)} className="w-full pl-16 pr-8 py-5 bg-gray-50 border-2 border-transparent focus:border-blue-100 focus:bg-white rounded-3xl text-base font-bold text-gray-900 outline-none transition-all placeholder:text-gray-300" />
{/* Provider Selection */}
{[ { id: 'stripe', name: 'Stripe', icon: CreditCard, desc: 'Global kart ödemeleri' }, { id: 'cryptomus', name: 'Cryptomus', icon: Globe, desc: 'Kripto Para' }, { id: 'nuvei', name: 'Nuvei', icon: ShieldCheck, desc: 'E-commerce Experts' }, { id: 'paykings', name: 'PayKings', icon: ShieldCheck, desc: 'High Risk Specialist' }, { id: 'seurionpay', name: 'SecurionPay', icon: CreditCard, desc: 'Simple Payments' }, ].map((p) => ( ))}
{/* Fee Percentage Input */}
%
setFeePercent(e.target.value)} placeholder="1.0" className="w-full pl-8 pr-12 py-5 bg-gray-50 border-2 border-transparent focus:border-blue-100 focus:bg-white rounded-3xl text-lg font-black text-gray-900 outline-none transition-all placeholder:text-gray-300" />

Bu firmadan her işlemde kesilecek platform payı. (Varsayılan: %1.0)

{/* Webhook Input */}
setWebhookUrl(e.target.value)} className="w-full pl-16 pr-8 py-5 bg-gray-50 border-2 border-transparent focus:border-blue-100 focus:bg-white rounded-3xl text-base font-bold text-gray-900 outline-none transition-all placeholder:text-gray-300" />

Ödeme sonuçlarını gerçek zamanlı almak için firmanın API uç noktasını buraya girebilirsiniz. (Opsiyonel)

{/* Submit Button */}
{/* Info Column */}

Hızlı Başlangıç

  • Firma ismi sisteme özel bir ID ile kaydedilir.

  • Kayıt sonrası hemen ödeme linki oluşturulur.

  • Tüm işlemler 256-bit SSL ile korunur.

Desteklenen Kartlar

Visa, Mastercard, Troy ve tüm yerel banka kartları ile ödeme alabilirsiniz.

); }