Refactor: Fully migrated to direct PostgreSQL, implemented Public API v1, fixed Vercel deployment conflicts, and updated documentation
This commit is contained in:
137
README.md
137
README.md
@@ -1,36 +1,131 @@
|
||||
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
|
||||
# 🚀 Pay2Gateway: Hibrit Kripto & Geleneksel Ödeme Geçidi Altyapısı
|
||||
|
||||
## Getting Started
|
||||
Pay2Gateway, modern e-ticaret siteleri ve dijital platformlar için geliştirilmiş, **Next.js 15** ve **PostgreSQL** tabanlı, hibrit bir ödeme geçidi (Payment Gateway) çözümüdür. Sistem, geleneksel ödeme sağlayıcılarını (Stripe vb.) on-chain kripto ödemeleriyle birleştirerek firmalara tam otomatik ve esnek bir tahsilat altyapısı sunar.
|
||||
|
||||
First, run the development server:
|
||||
---
|
||||
|
||||
## 🌟 Öne Çıkan Özellikler
|
||||
|
||||
### 🛡️ Kurumsal API Yönetimi (v1)
|
||||
* **API Key Yetkilendirme:** Firmalar (Merchants) için sunucu taraflı güvenli erişim.
|
||||
* **Checkout Sessions:** Fiyat manipülasyonunu engelleyen, tek kullanımlık güvenli ödeme oturumları.
|
||||
* **Gelişmiş Webhook'lar:** Ödeme tamamlandığında veya süpürme (sweep) işlemi gerçekleştiğinde otomatik JSON bildirimleri.
|
||||
|
||||
### ⛓️ Çoklu Zincir (Multi-Chain) Desteği
|
||||
* **EVM Desteği:** Ethereum, Polygon ve BSC ağlarında işlem yapabilme.
|
||||
* **Solana Desteği:** SOL ve SPL tokenlar (USDC vb.) için tam entegrasyon.
|
||||
* **Otomatik Süpürme (Auto-Sweep):** Toplanan fonların ana platform cüzdanına saniyeler içinde otomatik olarak aktarılması.
|
||||
|
||||
### 💰 Dinamik Token & Fiyatlandırma
|
||||
* **Top 20 Token:** CoinMarketCap listesindeki en hacimli 20 kripto para birimi desteği.
|
||||
* **Binance API Entegrasyonu:** Gerçek zamanlı TRY/USD kuru ve token fiyat dönüşümleri.
|
||||
* **Merkezi Konfigürasyon:** `lib/crypto-config.json` üzerinden anında yeni ağ veya token ekleme kolaylığı.
|
||||
|
||||
### 📊 Yönetim Panelleri
|
||||
* **Admin Dashboard:** Tüm sistem istatistikleri, toplam ciro, işlem başarı oranları ve müşteri analitiği.
|
||||
* **Merchant (Firma) Paneli:** İşlem listesi, API anahtarı yönetimi, webhook yapılandırması ve teknik entegrasyon rehberi.
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Teknoloji Yığını
|
||||
|
||||
* **Frontend & API:** [Next.js 15](https://nextjs.org/) (App Router)
|
||||
* **Veritabanı:** PostgreSQL (Direct connectivity via `pg`)
|
||||
* **Blockchain:**
|
||||
* [Ethers.js](https://docs.ethers.org/v6/) (EVM)
|
||||
* [@solana/web3.js](https://solana-labs.github.io/solana-web3.js/) (Solana)
|
||||
* **Styling:** Modern Vanilla CSS & Tailwind (Hibrit)
|
||||
* **İkon Seti:** Lucide React
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Hızlı Kurulum
|
||||
|
||||
### 1. Depoyu Klonlayın
|
||||
```bash
|
||||
npm run dev
|
||||
# or
|
||||
yarn dev
|
||||
# or
|
||||
pnpm dev
|
||||
# or
|
||||
bun dev
|
||||
git clone https://github.com/mstfyldz/Pay2Gateway.git
|
||||
cd Pay2Gateway
|
||||
```
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||
### 2. Bağımlılıkları Yükleyin
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
||||
### 3. Ortam Değişkenlerini Yapılandırın
|
||||
`.env` dosyasını oluşturun ve aşağıdaki bilgileri girin:
|
||||
|
||||
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
|
||||
```env
|
||||
DATABASE_URL=postgres://user:pass@host:5432/db
|
||||
NEXT_PUBLIC_BASE_URL=http://localhost:3000
|
||||
NEXT_PUBLIC_USE_MOCK_PAYMENTS=true # Test için true kalsın
|
||||
|
||||
## Learn More
|
||||
# Kripto Platform Cüzdanları (Süpürme Hedefi)
|
||||
SOL_PLATFORM_ADDRESS=...
|
||||
EVM_PLATFORM_ADDRESS=...
|
||||
|
||||
To learn more about Next.js, take a look at the following resources:
|
||||
# Gaz Yakıt Cüzdanı (Fonları süpürmek için gerekli gaz ücreti)
|
||||
CRYPTO_GAS_TANK_KEY=0x...
|
||||
```
|
||||
|
||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||
### 4. Geliştirme Modunu Başlatın
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
|
||||
---
|
||||
|
||||
## Deploy on Vercel
|
||||
## 📡 API Kullanımı (v1)
|
||||
|
||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
||||
### Ödeme Oturumu Başlatma
|
||||
Firmalar kendi sunucularından şu uç noktaya istek atarak bir ödeme oturumu başlatabilirler.
|
||||
|
||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
|
||||
**Request:**
|
||||
- **URL:** `POST /api/v1/checkout`
|
||||
- **Headers:** `x-api-key: YOUR_MERCHANT_API_KEY`
|
||||
|
||||
```json
|
||||
{
|
||||
"amount": 250.00,
|
||||
"currency": "TRY",
|
||||
"order_id": "OD_12345",
|
||||
"customer_name": "John Doe",
|
||||
"success_url": "https://mysite.com/success",
|
||||
"cancel_url": "https://mysite.com/cancel"
|
||||
}
|
||||
```
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"id": "uuid-transaction-id",
|
||||
"checkout_url": "http://localhost:3000/checkout?session_id=uuid-transaction-id",
|
||||
"status": "pending"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📂 Dosya Yapısı
|
||||
|
||||
* `/app/api/v1` - Dışarıya açık profesyonel API endpoints.
|
||||
* `/app/admin` - Merkezi yönetim paneli.
|
||||
* `/app/merchant` - Firma özel dashboard ve ayarlar.
|
||||
* `/lib/crypto-engine.ts` - On-chain ana motor (Doğrulama, Süpürme).
|
||||
* `/lib/crypto-config.json` - Desteklenen ağlar ve token listesi.
|
||||
* `/lib/db.ts` - PostgreSQL bağlantı havuzu.
|
||||
|
||||
---
|
||||
|
||||
## 🔐 Güvenlik Politikası
|
||||
|
||||
1. **Private Key Yönetimi:** Geçici cüzdan anahtarları şifrelenmiş olarak işlem metadata'sında saklanır ve fon süpürüldükten sonra işlevini yitirir.
|
||||
2. **Fiyat Güvenliği:** Ödeme oturumları (`session_id`) sunucu taraflı oluşturulur; istemci tarafında tutar değişikliği yapılamaz.
|
||||
3. **Hız Sınırı (Rate Limiting):** API istekleri anahtar tabanlı olarak sunucu tarafında izlenir.
|
||||
|
||||
---
|
||||
|
||||
⭐ **Pay2Gateway** - *Geleceğin Ödeme Altyapısı.*
|
||||
|
||||
Reference in New Issue
Block a user