price_monthly ve price_yearly alanları mevcutOption A: Sabit Period'lar (Basit Yaklaşım)
subscription_plans tablosuna eklenecek kolonlar: - price_daily (decimal, nullable) - price_weekly (decimal, nullable) - price_monthly (decimal, nullable) - price_quarterly (decimal, nullable) → YENİ! 3 ay - price_semi_annual (decimal, nullable) → YENİ! 6 ay - price_yearly (decimal, nullable)
Option B: Esnek Period Yapısı (Gelecek-Proof)
subscription_plans tablosuna eklenecek kolonlar:
- billing_cycles (JSON) → {
"monthly": {"price": 99, "duration_days": 30},
"quarterly": {"price": 270, "duration_days": 90},
"semi_annual": {"price": 500, "duration_days": 180},
"yearly": {"price": 990, "duration_days": 365}
}
CREATE TABLE user_subscriptions (
user_subscription_id BIGINT PRIMARY KEY AUTO_INCREMENT,
user_id BIGINT NOT NULL,
subscription_plan_id BIGINT NOT NULL,
-- Süre Yönetimi
billing_cycle VARCHAR(50) NOT NULL, -- monthly, quarterly, yearly
start_date DATETIME NOT NULL,
end_date DATETIME NOT NULL,
trial_end_date DATETIME NULL, -- Trial varsa
-- Durum Takibi
status ENUM('trial', 'active', 'expired', 'cancelled', 'paused') DEFAULT 'active',
-- Ödeme Yönetimi
auto_renew BOOLEAN DEFAULT TRUE,
next_billing_date DATETIME NULL,
last_payment_date DATETIME NULL,
-- Metadata
created_at TIMESTAMP,
updated_at TIMESTAMP,
cancelled_at TIMESTAMP NULL,
FOREIGN KEY (user_id) REFERENCES users(id),
FOREIGN KEY (subscription_plan_id) REFERENCES subscription_plans(subscription_plan_id)
);
billing_cycle metadata olarak string kaydediliyor| Billing Cycle | Süre | Calculation | Kullanım |
|---|---|---|---|
daily |
1 gün | +1 day | Test/Demo için |
weekly |
7 gün | +7 days | Kısa süreli kampanyalar |
monthly |
1 ay | +1 month | Standart aylık abonelik |
quarterly |
3 ay | +3 months | 3 aylık paketler |
semi_annual |
6 ay | +6 months | 6 aylık paketler |
yearly |
1 yıl | +1 year | Yıllık abonelik |
lifetime |
Sınırsız | null (no expiry) | Lifetime access |
features array'i varHer plan kendi features array'ine sahip. Karşılaştırma frontend'de manual yapılır.
Premium Plan features: ["fas fa-infinity|Sınırsız ürün", "fas fa-headset|7/24 Destek"] Basic Plan features: ["fas fa-box|100 Ürün Limiti", "fas fa-envelope|Email Destek"]
Basit Hızlı
Ayrı plan_features tablosu, her özellik tanımlı, planlar işaretler.
plan_features tablosu: feature_id | name | icon | category 1 | Unlimited Products | fas fa-infinity | products 2 | 24/7 Support | fas fa-headset | support plan_feature_pivot: subscription_plan_id | feature_id | included | limit_value 1 | 1 | true | null 1 | 2 | true | null 2 | 1 | false | 100
Kompleks Esnek
Sisteme şimdilik hangi cycle'ları eklemek istiyorsun?
Şu an trial_days kolonu var ama kullanılmıyor. Trial sistemi aktif olacak mı?
Subscription bittiğinde otomatik yenileme olacak mı?
price_quarterly (3 ay fiyatı - opsiyonel)price_semi_annual (6 ay fiyatı - opsiyonel)user_subscriptions createEksik Sadece plan tanımlama ve cart'a ekleme var. Gerçek subscription logic yok!