import React from 'react'; import { db } from '@/lib/db'; import { Terminal, Copy, Globe, Webhook, Zap, ShieldCheck, Code2, Server, Link as LinkIcon } from 'lucide-react'; import { cookies } from 'next/headers'; import { redirect } from 'next/navigation'; import ApiKeyVisibilityToggle from '@/components/merchant/ApiKeyVisibilityToggle'; async function getMerchant(identifier: string) { const isUUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(identifier); const queryText = isUUID ? 'SELECT * FROM merchants WHERE id = $1 LIMIT 1' : 'SELECT * FROM merchants WHERE short_id = $1 LIMIT 1'; const result = await db.query(queryText, [identifier]); return result.rows[0]; } export default async function MerchantIntegrationPage(props: { params: Promise<{ id: string }>; }) { const resolvedParams = await props.params; const identifier = resolvedParams.id; const merchant = await getMerchant(identifier); const cookieStore = await cookies(); if (!merchant) return null; if (!cookieStore.get(`merchant_auth_${merchant.id}`)) { redirect(`/merchant/${identifier}/login`); } const host = process.env.NEXT_PUBLIC_BASE_URL || 'https://p2cgateway.store'; const checkoutUrl = `${host}/checkout?merchant_id=${merchant.short_id || merchant.id}&amount=100¤cy=TRY&ref_id=SİPARİŞ_123`; return (
{/* Header */}

Entegrasyon Rehberi

Ödeme sistemini sisteminize dahil edin

{/* Methods Selection */}
{/* Option 1: Quick Link */}

1. Hızlı Ödeme Linki

Kod yazmanıza gerek kalmadan, müşterilerinizi doğrudan ödeme sayfamıza yönlendirebilirsiniz. Parametreleri URL üzerinden iletebilirsiniz.

Örnek Yapı

{checkoutUrl}
{/* Option 2: Server-to-Server API */}

2. Profesyonel API (v1)

Sunucu taraflı entegrasyon ile daha güvenli işlemler başlatın. Fiyat manipülasyonunu engeller ve sessiz oturumlar oluşturur.

Endpoint

POST {host}/api/v1/checkout
{/* API Details Section */}

API Erişimi ve Güvenlik

İsteklerinizi doğrulamak için bu anahtarları kullanın

{merchant.id}
{/* Webhook & Payout Addresses */}
{/* Webhook Settings */}

Webhooks

Anlık Bildirimler

URL {merchant.webhook_url ? 'AKTİF' : 'TANIMSZ'}
{merchant.webhook_url || 'https://siteniz.com/callback'}
{/* Payout Addresses */}

Hak Ediş Adresleriniz

Ödemeleriniz bu adreslere iletilir

{['EVM', 'SOLANA', 'TRON', 'BITCOIN'].map((net) => { const addr = merchant.payout_addresses?.[net] || (net === 'EVM' ? merchant.payout_address : null); return (
{net.slice(0, 1)}

{net}

{addr || 'TANIMLANMAMIŞ'}

{addr && }
); })}
{/* Footer Resources */}
{[ { title: 'Postman Koleksiyonu', icon: Terminal, color: 'blue' }, { title: 'Geliştirici Dokümanları', icon: Code2, color: 'emerald' }, { title: 'Teknik Yardım', icon: Globe, color: 'gray' }, ].map((r) => (
{r.title}
))}
); }