Version 1.9.0
This commit is contained in:
125
CHANGELOG.md
125
CHANGELOG.md
@@ -1,7 +1,7 @@
|
||||
# IGNY8 Change Log
|
||||
|
||||
**Current Version:** 1.8.2
|
||||
**Last Updated:** January 19, 2026
|
||||
**Current Version:** 1.8.3
|
||||
**Last Updated:** January 20, 2026
|
||||
|
||||
---
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
| Version | Date | Summary |
|
||||
|---------|------|---------|
|
||||
| 1.8.3 | Jan 20, 2026 | **Billing System Standardization** - Two-pool credit system (plan + bonus), industry-standard renewal workflow (no advance notice for Stripe/PayPal), simplified bank transfer flow (3 emails), Payment Logs in admin, WebhookEvent logging for all payment types |
|
||||
| 1.8.2 | Jan 19, 2026 | **Keywords Library Redesign & Sector Filtering** - Complete Keywords Library page overhaul with sector metric cards, Smart Suggestions, cascading filters, sector-specific keyword filtering, UI/UX improvements, and backend sector_ids parameter support |
|
||||
| 1.8.1 | Jan 18, 2026 | **Automation Scheduling Overhaul** - Hourly scheduling (replaces 15-min windows), DefaultAutomationConfig singleton for centralized defaults, test mode for admin testing, Reset button fetches from backend, new migrations 0009-0012 |
|
||||
| 1.8.0 | Jan 17, 2026 | **Major** - Unified Settings Consolidation: AI & Automation settings merged into Site Settings > Automation tab; Navigation Refactor Complete; Automation Overview & Run Detail pages; Publishing & Scheduling UX improvements; Skip Stage configuration; Content Calendar fixes |
|
||||
@@ -49,6 +50,126 @@
|
||||
|
||||
---
|
||||
|
||||
## v1.8.3 - January 20, 2026
|
||||
|
||||
### Billing System Standardization & Two-Pool Credit System
|
||||
|
||||
This release implements industry-standard billing practices and introduces the two-pool credit system for clearer credit management.
|
||||
|
||||
---
|
||||
|
||||
### 💳 Two-Pool Credit System
|
||||
|
||||
**Architecture:**
|
||||
- `account.credits` = Plan credits (from subscription, resets on renewal)
|
||||
- `account.bonus_credits` = Purchased credits (NEVER expire, NEVER reset)
|
||||
|
||||
**Deduction Priority:**
|
||||
1. Plan credits consumed FIRST
|
||||
2. Bonus credits consumed only when plan credits = 0
|
||||
|
||||
**Key Behaviors:**
|
||||
| Event | Plan Credits | Bonus Credits |
|
||||
|-------|--------------|---------------|
|
||||
| Payment success | Reset to plan amount | No change |
|
||||
| No payment (24h) | Reset to 0 | No change |
|
||||
| Late payment | Reset to plan amount | No change |
|
||||
|
||||
**Implementation:**
|
||||
- All deduction logic centralized in `CreditService.deduct_credits()`
|
||||
- AI functions unchanged - they call the same credit check/deduct methods
|
||||
- Transparent to all consumers - two-pool logic is internal only
|
||||
|
||||
---
|
||||
|
||||
### 🔄 Renewal Workflow Standardization
|
||||
|
||||
**Stripe/PayPal (Auto-Pay) - Industry Standard:**
|
||||
- **No advance notice** (like Netflix, Spotify, Adobe)
|
||||
- Day 0: Auto-charge attempt
|
||||
- Success: Receipt email + credits reset to plan amount
|
||||
- Failure: Retry notification, Stripe retries 4x over 7 days
|
||||
- Day +7: Expired if all retries fail
|
||||
|
||||
**Bank Transfer (Manual Pay) - Simplified 3-Email Flow:**
|
||||
- Day -3: Invoice created + Email sent
|
||||
- Day 0: Renewal day reminder (if unpaid)
|
||||
- Day +1: Urgent reminder + credits reset to 0
|
||||
- Day +7: Subscription expired
|
||||
|
||||
---
|
||||
|
||||
### 📋 Admin Improvements
|
||||
|
||||
**Payment Logs in Admin Sidebar:**
|
||||
- Added "Payment Logs" link under Plans & Billing menu
|
||||
- Quick access to WebhookEvent records
|
||||
|
||||
**WebhookEvent Logging:**
|
||||
- All payment types now logged to WebhookEvent model:
|
||||
- Stripe webhooks (existing)
|
||||
- PayPal webhooks (existing)
|
||||
- Bank transfer approvals (NEW)
|
||||
- Manual payment events (NEW)
|
||||
|
||||
---
|
||||
|
||||
### 🔧 Celery Task Updates
|
||||
|
||||
**Renamed Tasks:**
|
||||
| Old Name | New Name | Purpose |
|
||||
|----------|----------|---------|
|
||||
| `send_renewal_notices` | `create_bank_transfer_invoices` | Invoice 3 days before (bank transfer only) |
|
||||
| `send_invoice_reminders` | `send_renewal_day_reminders` | Day 0 reminder (bank transfer) |
|
||||
|
||||
**Combined Tasks:**
|
||||
- `send_day_after_reminders` now handles both Day +1 reminder AND credit reset
|
||||
- Removed separate `reset_unpaid_renewal_credits` task
|
||||
|
||||
**Updated Schedule:**
|
||||
| Task | Schedule | Purpose |
|
||||
|------|----------|---------|
|
||||
| `create_bank_transfer_invoices` | Daily 09:00 | Invoice 3 days before |
|
||||
| `process_subscription_renewals` | Daily 00:05 | Auto-pay renewals |
|
||||
| `send_renewal_day_reminders` | Daily 10:00 | Day 0 reminder |
|
||||
| `send_day_after_reminders` | Daily 09:15 | Day +1 urgent + credit reset |
|
||||
| `check_expired_renewals` | Daily 00:15 | Expire after 7-day grace |
|
||||
|
||||
---
|
||||
|
||||
### 📚 Documentation Updates
|
||||
|
||||
**Updated Files:**
|
||||
- `docs/10-MODULES/BILLING-PAYMENTS-COMPLETE.md` - Primary billing reference
|
||||
- `docs/10-MODULES/BILLING.md` - Added two-pool section
|
||||
- `docs/90-REFERENCE/BILLING-SYSTEM-MASTER.md` - Complete rewrite
|
||||
- `docs/90-REFERENCE/PAYMENT-SYSTEM.md` - Updated header
|
||||
- `docs/INDEX.md` - Updated billing links
|
||||
- `docs/40-WORKFLOWS/CONTENT-PIPELINE.md` - Fixed credit terminology
|
||||
- `docs/10-MODULES/PLANNER.md` - Fixed credit cost descriptions
|
||||
- `docs/10-MODULES/WRITER.md` - Fixed credit cost descriptions
|
||||
|
||||
**Key Documentation Changes:**
|
||||
- Removed outdated "idea credit", "content credit", "image credit" terminology
|
||||
- Updated to unified credit system based on AIModelConfig
|
||||
- Credit costs now reference `tokens_per_credit` and `credits_per_image`
|
||||
|
||||
---
|
||||
|
||||
### Files Modified
|
||||
|
||||
**Backend:**
|
||||
- `igny8_core/settings.py` - Added Payment Logs to admin sidebar
|
||||
- `igny8_core/celery.py` - Updated task schedule
|
||||
- `business/billing/billing_views.py` - Added WebhookEvent logging
|
||||
- `modules/billing/views.py` - Added payment approval logging
|
||||
- `business/billing/tasks/subscription_renewal.py` - Refactored tasks
|
||||
|
||||
**Documentation:**
|
||||
- 8 documentation files updated for two-pool system
|
||||
|
||||
---
|
||||
|
||||
## v1.8.2 - January 19, 2026
|
||||
|
||||
### Keywords Library Complete Redesign & Sector-Specific Filtering
|
||||
|
||||
@@ -129,6 +129,8 @@
|
||||
└───────────────┘ └────────────────────┘
|
||||
```
|
||||
|
||||
> **Note:** The two-pool logic is internal to `CreditService.deduct_credits()`. All AI functions and other credit consumers are unaffected - they call the same credit check/deduct methods as before.
|
||||
|
||||
### Credit Operations
|
||||
|
||||
| Operation | Method | Affects | Description |
|
||||
@@ -481,7 +483,7 @@ Invoice Created ──▶ 48 hours ──▶ Reminder Sent ──▶ 48 hours
|
||||
│ │
|
||||
│ SCENARIO 3: No Payment After 24 Hours │
|
||||
│ ───────────────────────────────────── │
|
||||
│ • plan credits → reset to 0 (task: reset_unpaid_renewal_credits) │
|
||||
│ • plan credits → reset to 0 (task: send_day_after_reminders) │
|
||||
│ • bonus_credits → UNCHANGED (user can still use these) │
|
||||
│ • Warning email sent │
|
||||
│ │
|
||||
|
||||
@@ -1,11 +1,32 @@
|
||||
# Billing Module
|
||||
|
||||
**Last Verified:** January 10, 2026
|
||||
**Status:** ✅ Active (Image Generation Credit System Complete January 2026)
|
||||
**Last Verified:** January 20, 2026
|
||||
**Status:** ✅ Active (Two-Pool Credit System v2.0 January 2026)
|
||||
**Backend Path:** `backend/igny8_core/modules/billing/` + `backend/igny8_core/business/billing/`
|
||||
**Frontend Path:** `frontend/src/pages/Billing/` + `frontend/src/pages/Account/`
|
||||
|
||||
> **Payment System Reference:** For comprehensive payment gateway documentation (Stripe, PayPal, Bank Transfer), see [PAYMENT-SYSTEM.md](../90-REFERENCE/PAYMENT-SYSTEM.md)
|
||||
> **Complete Billing Reference:** For comprehensive billing & payment documentation, see [BILLING-PAYMENTS-COMPLETE.md](BILLING-PAYMENTS-COMPLETE.md)
|
||||
> **Payment System Reference:** For payment gateway documentation (Stripe, PayPal, Bank Transfer), see [PAYMENT-SYSTEM.md](../90-REFERENCE/PAYMENT-SYSTEM.md)
|
||||
|
||||
---
|
||||
|
||||
## Two-Pool Credit System (v2.0)
|
||||
|
||||
| Pool | Field | Source | Behavior |
|
||||
|------|-------|--------|----------|
|
||||
| **Plan Credits** | `account.credits` | Subscription plan | Reset on renewal, reset to 0 if unpaid after 24h |
|
||||
| **Bonus Credits** | `account.bonus_credits` | Credit packages | **NEVER expire**, **NEVER reset** |
|
||||
|
||||
### Credit Usage Priority
|
||||
1. **Plan credits** used FIRST
|
||||
2. **Bonus credits** only used when plan credits = 0
|
||||
|
||||
### What Happens on Renewal
|
||||
| Event | Plan Credits | Bonus Credits |
|
||||
|-------|--------------|---------------|
|
||||
| Payment success | Reset to plan amount | No change |
|
||||
| No payment (24h) | Reset to 0 | No change |
|
||||
| Late payment | Reset to plan amount | No change |
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ SeedKeywords (Global) → Keywords (Site/Sector) → Clusters → ContentIdeas
|
||||
|
||||
**Trigger:** User clicks "Auto Cluster" button
|
||||
**AI Function:** `AutoClusterFunction`
|
||||
**Credit Cost:** Per batch (configurable)
|
||||
**Credit Cost:** Based on AI tokens used (see AIModelConfig)
|
||||
|
||||
**Flow:**
|
||||
1. User selects keywords (or all unclustered)
|
||||
@@ -144,7 +144,7 @@ SeedKeywords (Global) → Keywords (Site/Sector) → Clusters → ContentIdeas
|
||||
|
||||
**Trigger:** User clicks "Generate Ideas" on cluster(s)
|
||||
**AI Function:** `GenerateIdeasFunction`
|
||||
**Credit Cost:** Per idea generated
|
||||
**Credit Cost:** Based on AI tokens used (see AIModelConfig)
|
||||
|
||||
**Flow:**
|
||||
1. User selects clusters
|
||||
|
||||
@@ -147,7 +147,7 @@ ContentIdeas → Tasks → Content → Images → Review → Publish
|
||||
|
||||
**Trigger:** User clicks "Generate" on task
|
||||
**AI Function:** `GenerateContentFunction`
|
||||
**Credit Cost:** Per 100 words generated
|
||||
**Credit Cost:** Based on AI tokens used (see AIModelConfig)
|
||||
|
||||
**Flow:**
|
||||
1. User has task with title, keywords, word count target
|
||||
@@ -165,7 +165,7 @@ ContentIdeas → Tasks → Content → Images → Review → Publish
|
||||
|
||||
**Trigger:** Part of content generation or explicit
|
||||
**AI Function:** `GenerateImagePromptsFunction`
|
||||
**Credit Cost:** Per prompt
|
||||
**Credit Cost:** Based on AI tokens used (see AIModelConfig)
|
||||
|
||||
**Flow:**
|
||||
1. Content exists with body
|
||||
@@ -179,7 +179,7 @@ ContentIdeas → Tasks → Content → Images → Review → Publish
|
||||
|
||||
**Trigger:** User clicks "Generate Images" or automation
|
||||
**AI Function:** `GenerateImagesFunction`
|
||||
**Credit Cost:** Per image
|
||||
**Credit Cost:** Deducted per image (see AIModelConfig.credits_per_image)
|
||||
|
||||
**Flow:**
|
||||
1. Image record exists with prompt, status=pending
|
||||
|
||||
@@ -74,7 +74,7 @@ The IGNY8 content pipeline transforms raw keywords into published WordPress arti
|
||||
- Keyword status → `clustered`
|
||||
|
||||
### Credit Usage
|
||||
- 1 idea credit per clustering operation
|
||||
- Credits deducted based on AI tokens used (see AIModelConfig)
|
||||
|
||||
---
|
||||
|
||||
@@ -96,7 +96,7 @@ The IGNY8 content pipeline transforms raw keywords into published WordPress arti
|
||||
- Status: `pending`
|
||||
|
||||
### Credit Usage
|
||||
- 1 idea credit per idea generated
|
||||
- Credits deducted based on AI tokens used (see AIModelConfig)
|
||||
|
||||
---
|
||||
|
||||
@@ -143,7 +143,7 @@ The IGNY8 content pipeline transforms raw keywords into published WordPress arti
|
||||
- Task status → `completed`
|
||||
|
||||
### Credit Usage
|
||||
- 1 content credit per generation
|
||||
- Credits deducted based on AI tokens used (see AIModelConfig)
|
||||
|
||||
---
|
||||
|
||||
@@ -167,7 +167,7 @@ The IGNY8 content pipeline transforms raw keywords into published WordPress arti
|
||||
- Featured image assigned
|
||||
|
||||
### Credit Usage
|
||||
- 1 image credit per image generated
|
||||
- Credits deducted per image (see AIModelConfig.credits_per_image)
|
||||
|
||||
---
|
||||
|
||||
@@ -190,7 +190,7 @@ The IGNY8 content pipeline transforms raw keywords into published WordPress arti
|
||||
|
||||
### Credit Usage
|
||||
- None (free operation)
|
||||
- Regeneration costs additional credits
|
||||
- Regeneration deducts credits based on AI model used
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -2,195 +2,113 @@
|
||||
|
||||
**Last Updated:** 2026-01-20
|
||||
|
||||
This document is the authoritative reference for the billing system implementation, including models, invoice lifecycle, payment flows, credit reset logic, and notification timing.
|
||||
> **Primary Reference:** For complete billing documentation, see [BILLING-PAYMENTS-COMPLETE.md](../10-MODULES/BILLING-PAYMENTS-COMPLETE.md)
|
||||
|
||||
This document provides a summary of the billing system implementation.
|
||||
|
||||
---
|
||||
|
||||
## 1) Core Principles
|
||||
|
||||
- **Two-Pool Credit System:**
|
||||
- `account.credits` = Plan credits (reset on renewal)
|
||||
- `account.bonus_credits` = Purchased credits (NEVER expire, NEVER reset)
|
||||
- **Credit Usage Priority:** Plan credits used FIRST, bonus credits only when plan credits = 0
|
||||
- **No hardcoded products**: Plans, credit packages, and future add-ons are data-driven.
|
||||
- **Explicit invoice type**: `subscription`, `credit_package`, `addon`, `custom`.
|
||||
- **Correct crediting**:
|
||||
- Subscription credits reset to **0** at cycle end.
|
||||
- Subscription credits reset to **full plan amount** on renewal/activation.
|
||||
- Credit package credits add to balance.
|
||||
- **Lifecycle governance**: Credit invoices expire automatically and can be cancelled by users.
|
||||
- Subscription: reset plan credits to **full plan amount** on payment (bonus untouched)
|
||||
- Credit package: add to **bonus_credits** only (never plan credits)
|
||||
- **Renewal Grace Period:** 7 days
|
||||
- **Credit Reset on Non-Payment:** 24 hours after renewal (Day +1), plan credits → 0
|
||||
- **Auditability**: Every credit change is recorded in `CreditTransaction`.
|
||||
|
||||
---
|
||||
|
||||
## 2) Data Model Overview
|
||||
## 2) Two-Pool Credit System
|
||||
|
||||
### 2.1 Invoice
|
||||
| Field | Purpose |
|
||||
|---|---|
|
||||
| `invoice_type` | `subscription`, `credit_package`, `addon`, `custom` |
|
||||
| `status` | `draft`, `pending`, `paid`, `void`, `uncollectible` |
|
||||
| `expires_at` | Expiry for credit invoices |
|
||||
| `void_reason` | Cancellation/expiration reason |
|
||||
| `line_items` | Itemized charges (product‑driven) |
|
||||
| `metadata` | Compatibility + gateway context |
|
||||
| Pool | Field | Source | Behavior |
|
||||
|------|-------|--------|----------|
|
||||
| Plan Credits | `account.credits` | Subscription plan | Reset to plan amount on renewal payment, reset to 0 if unpaid after 24h |
|
||||
| Bonus Credits | `account.bonus_credits` | Credit packages | NEVER expire, NEVER reset, only deducted after plan credits = 0 |
|
||||
|
||||
### 2.2 Payment
|
||||
| Field | Purpose |
|
||||
|---|---|
|
||||
| `status` | `pending_approval`, `succeeded`, `failed`, `refunded` |
|
||||
| `payment_method` | `stripe`, `paypal`, `bank_transfer`, `local_wallet`, `manual` |
|
||||
| `invoice` | FK to invoice |
|
||||
| `metadata` | Gateway and fulfillment details |
|
||||
|
||||
### 2.3 Credits
|
||||
| Field | Purpose |
|
||||
|---|---|
|
||||
| `Account.credits` | Current balance |
|
||||
| `CreditTransaction` | Immutable ledger of changes |
|
||||
### Credit Deduction Priority
|
||||
1. Deduct from `credits` (plan) first
|
||||
2. Only when `credits = 0`, deduct remainder from `bonus_credits`
|
||||
|
||||
---
|
||||
|
||||
## 3) Invoice Types and Fulfillment Rules
|
||||
## 3) Renewal Workflow (Simplified)
|
||||
|
||||
| Invoice Type | Fulfillment | Account Status Change |
|
||||
|---|---|---|
|
||||
| `subscription` | Reset credits to plan amount | Activate account + subscription |
|
||||
| `credit_package` | Add package credits | No status change |
|
||||
| `addon` | Provision add-on entitlement | No status change |
|
||||
| `custom` | No credits unless specified | No status change |
|
||||
### Stripe/PayPal (Auto-Pay) - Industry Standard
|
||||
- **No advance notice** (like Netflix, Spotify)
|
||||
- Day 0: Auto-charge attempt
|
||||
- If success: Receipt email + credits reset to plan amount
|
||||
- If failed: Retry notification, Stripe retries 4x over 7 days
|
||||
- Day +7: Expired if all retries fail
|
||||
|
||||
### Bank Transfer (Manual)
|
||||
- **Day -3:** Invoice created + Email sent
|
||||
- **Day 0:** Renewal day reminder (if unpaid)
|
||||
- **Day +1:** Urgent reminder + credits reset to 0
|
||||
- **Day +7:** Subscription expired
|
||||
|
||||
---
|
||||
|
||||
## 4) Flowcharts
|
||||
|
||||
### 4.1 Subscription Purchase (Stripe / PayPal / Bank Transfer)
|
||||
```mermaid
|
||||
flowchart TD
|
||||
A[User selects plan] --> B[Create subscription invoice]
|
||||
B --> C{Payment Method}
|
||||
C -->|Stripe/PayPal| D[Gateway checkout]
|
||||
D --> E[Webhook payment succeeded]
|
||||
E --> F[Invoice paid]
|
||||
F --> G[Reset credits to full plan amount]
|
||||
G --> H[Account + subscription active]
|
||||
|
||||
C -->|Bank Transfer| I[User submits confirmation]
|
||||
I --> J[Payment pending_approval]
|
||||
J --> K[Admin approves]
|
||||
K --> F
|
||||
```
|
||||
|
||||
### 4.2 Subscription Renewal (Automatic + Manual)
|
||||
```mermaid
|
||||
flowchart TD
|
||||
A[Billing cycle end] --> B[Reset credits to 0]
|
||||
B --> C[Create renewal invoice]
|
||||
C --> D{Auto method available?}
|
||||
D -->|Yes| E[Gateway charges]
|
||||
E --> F[Webhook payment succeeded]
|
||||
F --> G[Reset credits to full plan amount]
|
||||
G --> H[Subscription active]
|
||||
|
||||
D -->|No| I[Manual payment required]
|
||||
I --> J[Invoice emailed]
|
||||
J --> K[Admin approves]
|
||||
K --> G
|
||||
```
|
||||
|
||||
### 4.3 Credit Package Purchase (All Methods)
|
||||
```mermaid
|
||||
flowchart TD
|
||||
A[User selects credit package] --> B[Create credit invoice + expires_at]
|
||||
B --> C{Payment Method}
|
||||
C -->|Stripe/PayPal| D[Gateway checkout]
|
||||
D --> E[Webhook payment succeeded]
|
||||
E --> F[Add package credits]
|
||||
|
||||
C -->|Bank Transfer| G[User submits confirmation]
|
||||
G --> H[Payment pending_approval]
|
||||
H --> I[Admin approves]
|
||||
I --> F
|
||||
```
|
||||
|
||||
### 4.4 Credit Invoice Expiry
|
||||
```mermaid
|
||||
flowchart TD
|
||||
A[Scheduler checks pending credit invoices] --> B{expires_at <= now?}
|
||||
B -->|Yes| C[Void invoice + notify user]
|
||||
B -->|No| D[No action]
|
||||
```
|
||||
|
||||
### 4.5 Credit Invoice Cancellation (User)
|
||||
```mermaid
|
||||
flowchart TD
|
||||
A[User clicks cancel] --> B{Pending credit invoice?}
|
||||
B -->|Yes| C[Set status=void, void_reason=user_cancelled]
|
||||
C --> D[Notify user]
|
||||
B -->|No| E[Reject request]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 5) Notification Matrix (Required Emails)
|
||||
|
||||
| Event | Email | Timing |
|
||||
|---|---|---|
|
||||
| Manual payment submitted | Payment confirmation | Immediate |
|
||||
| Manual payment approved | Payment approved | Immediate |
|
||||
| Manual payment rejected | Payment rejected | Immediate |
|
||||
| Renewal notice | Subscription renewal notice | N days before end |
|
||||
| Renewal invoice | Invoice email | At renewal creation |
|
||||
| Renewal reminder | Invoice reminder | Every 3 days until paid |
|
||||
| Credit invoice expiring | Credit invoice expiring | 24h before expires_at |
|
||||
| Credit invoice expired | Credit invoice expired | At void |
|
||||
| Credit invoice cancelled | Credit invoice cancelled | Immediate |
|
||||
| Payment failed | Payment failed | Immediate |
|
||||
| Low credits | Low credits warning | Threshold crossing |
|
||||
| Subscription expired | Subscription expired | When grace period ends |
|
||||
|
||||
---
|
||||
|
||||
## 6) Scheduled Tasks
|
||||
## 4) Scheduled Tasks (Updated)
|
||||
|
||||
| Task | Purpose | Schedule |
|
||||
|---|---|---|
|
||||
| send_renewal_notices | Renewal reminders | Daily 09:00 |
|
||||
| process_subscription_renewals | Create renewal invoices | Daily 00:05 |
|
||||
| send_invoice_reminders | Remind pending renewals | Daily 10:00 |
|
||||
| check_expired_renewals | Expire grace period | Daily 00:15 |
|
||||
| send_credit_invoice_expiry_reminders | Credit invoice expiry reminder | Daily 09:30 |
|
||||
| void_expired_credit_invoices | Auto-void expired credit invoices | Daily 00:45 |
|
||||
| replenish_monthly_credits | Monthly credit reset (legacy) | 1st day monthly |
|
||||
|------|---------|----------|
|
||||
| `create_bank_transfer_invoices` | Invoice 3 days before (bank transfer only) | Daily 09:00 |
|
||||
| `process_subscription_renewals` | Auto-pay renewals (Stripe/PayPal) | Daily 00:05 |
|
||||
| `send_renewal_day_reminders` | Day 0 reminder (bank transfer) | Daily 10:00 |
|
||||
| `send_day_after_reminders` | Day +1 urgent reminder + credit reset | Daily 09:15 |
|
||||
| `check_expired_renewals` | Expire after 7-day grace | Daily 00:15 |
|
||||
| `send_credit_invoice_expiry_reminders` | Credit invoice reminder | Daily 09:30 |
|
||||
| `void_expired_credit_invoices` | Auto-void credit invoices (48h) | Daily 00:45 |
|
||||
|
||||
---
|
||||
|
||||
## 7) Key Implementation Rules
|
||||
## 5) Invoice Types and Fulfillment
|
||||
|
||||
1. **Invoice type drives fulfillment** (no plan/package hardcoding).
|
||||
2. **Subscription credits**: reset to **0** at cycle end, then set to **full amount** on renewal.
|
||||
3. **Credit packages**: add package credits only.
|
||||
4. **Credit invoices**: expire automatically and are cancellable by users.
|
||||
5. **Account status** only changes on **subscription invoices**.
|
||||
| Invoice Type | Credits Action | Account Status |
|
||||
|--------------|----------------|----------------|
|
||||
| `subscription` | Reset plan credits to plan amount | Activate account + subscription |
|
||||
| `credit_package` | Add to **bonus_credits** | No status change |
|
||||
| `addon` | Provision entitlement | No status change |
|
||||
| `custom` | As specified | No status change |
|
||||
|
||||
---
|
||||
|
||||
## 8) Operational Verification Checklist
|
||||
## 6) Key Implementation Rules
|
||||
|
||||
- Stripe/PayPal subscription purchase activates account and resets credits.
|
||||
- Bank transfer subscription approval resets credits (not adds).
|
||||
- Credit package approval adds package credits (not plan credits).
|
||||
- Credit invoices do not block subscription state.
|
||||
- Credit invoice expiry and cancellation work with emails.
|
||||
- Renewal resets credits to 0 at cycle end and to full on payment.
|
||||
1. **Two pools:** `credits` (plan) + `bonus_credits` (purchased)
|
||||
2. **Deduction order:** Plan credits first, then bonus credits
|
||||
3. **Subscription payment:** Reset plan credits to full amount (bonus untouched)
|
||||
4. **Credit package payment:** Add to bonus_credits only
|
||||
5. **No payment 24h:** Plan credits → 0, bonus credits unchanged
|
||||
6. **Late payment:** Plan credits restored to full amount
|
||||
|
||||
---
|
||||
|
||||
## 9) Extensibility (Future Add‑ons)
|
||||
## 7) Quick Reference
|
||||
|
||||
- Add new `Product` types without code changes to invoice fulfillment.
|
||||
- Use `invoice_type='addon'` with line items to provision entitlements.
|
||||
- No plan/package hardcoding required.
|
||||
### Payment Method by Country
|
||||
| Country | Stripe | PayPal | Bank Transfer |
|
||||
|---------|--------|--------|---------------|
|
||||
| Pakistan (PK) | ✅ | ❌ | ✅ |
|
||||
| Others | ✅ | ✅ | ❌ |
|
||||
|
||||
### Credit Reset Summary
|
||||
| Event | Plan Credits | Bonus Credits |
|
||||
|-------|--------------|---------------|
|
||||
| Payment success | Reset to plan amount | No change |
|
||||
| No payment (24h) | Reset to 0 | No change |
|
||||
| Late payment | Reset to plan amount | No change |
|
||||
|
||||
---
|
||||
|
||||
## 10) References
|
||||
## References
|
||||
|
||||
- Audit: [docs/audits/BILLING-SYSTEM-AUDIT-20260120.md](docs/audits/BILLING-SYSTEM-AUDIT-20260120.md)
|
||||
- Refactor Plan: [docs/audits/BILLING-SYSTEM-AUDIT-AND-REFACTOR-PLAN-20260120.md](docs/audits/BILLING-SYSTEM-AUDIT-AND-REFACTOR-PLAN-20260120.md)
|
||||
- Complete Documentation: [BILLING-PAYMENTS-COMPLETE.md](../10-MODULES/BILLING-PAYMENTS-COMPLETE.md)
|
||||
- Payment Gateways: [PAYMENT-SYSTEM.md](PAYMENT-SYSTEM.md)
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
# Payment System Documentation
|
||||
|
||||
> **Version:** 1.6.0
|
||||
> **Last Updated:** January 8, 2026
|
||||
> **Version:** 2.0.0
|
||||
> **Last Updated:** January 20, 2026
|
||||
> **Status:** Production Ready
|
||||
|
||||
This document provides comprehensive documentation of the IGNY8 payment system architecture, implementation, and flows.
|
||||
> **Complete Billing Reference:** For comprehensive billing documentation including the two-pool credit system and renewal workflows, see [BILLING-PAYMENTS-COMPLETE.md](../10-MODULES/BILLING-PAYMENTS-COMPLETE.md)
|
||||
|
||||
This document provides payment gateway implementation details for IGNY8.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# IGNY8 Technical Documentation
|
||||
|
||||
**Version:** 1.8.1
|
||||
**Last Updated:** January 18, 2026
|
||||
**Version:** 1.8.3
|
||||
**Last Updated:** January 20, 2026
|
||||
**Purpose:** Complete technical reference for the IGNY8 AI content platform
|
||||
|
||||
---
|
||||
@@ -23,7 +23,8 @@
|
||||
| **Manage WordPress plugin** | [60-PLUGINS/WORDPRESS-INTEGRATION.md](60-PLUGINS/WORDPRESS-INTEGRATION.md) |
|
||||
| **Release plugin update** | [60-PLUGINS/PLUGIN-UPDATE-WORKFLOW.md](60-PLUGINS/PLUGIN-UPDATE-WORKFLOW.md) |
|
||||
| Look up model fields | [90-REFERENCE/MODELS.md](90-REFERENCE/MODELS.md) |
|
||||
| **Payment system (Stripe/PayPal/Bank)** | [90-REFERENCE/PAYMENT-SYSTEM.md](90-REFERENCE/PAYMENT-SYSTEM.md) |
|
||||
| **Billing & Credits (Complete)** | [10-MODULES/BILLING-PAYMENTS-COMPLETE.md](10-MODULES/BILLING-PAYMENTS-COMPLETE.md) |
|
||||
| **Payment gateways (Stripe/PayPal/Bank)** | [90-REFERENCE/PAYMENT-SYSTEM.md](90-REFERENCE/PAYMENT-SYSTEM.md) |
|
||||
| See prelaunch checklist | [plans/LAUNCH-VERIFICATION-CHECKLIST.md](plans/LAUNCH-VERIFICATION-CHECKLIST.md) |
|
||||
| **Understand publishing flow** | [50-DEPLOYMENT/WORDPRESS-INTEGRATION-FLOW.md](50-DEPLOYMENT/WORDPRESS-INTEGRATION-FLOW.md) |
|
||||
| **AI model architecture (v1.4.0)** | [plans/4th-jan-refactor/final-model-schemas.md](plans/4th-jan-refactor/final-model-schemas.md) |
|
||||
@@ -48,7 +49,7 @@
|
||||
| **Planner** | ✅ Active | Keywords → Clusters → Ideas | [PLANNER.md](10-MODULES/PLANNER.md) |
|
||||
| **Writer** | ✅ Active | Tasks → Content → Images | [WRITER.md](10-MODULES/WRITER.md) |
|
||||
| **Automation** | ✅ Active | 7-stage automated pipeline | [AUTOMATION.md](10-MODULES/AUTOMATION.md) |
|
||||
| **Billing** | ✅ Active | Credits, plans, payments | [BILLING.md](10-MODULES/BILLING.md) |
|
||||
| **Billing** | ✅ Active | Two-pool credits, plans, payments | [BILLING-PAYMENTS-COMPLETE.md](10-MODULES/BILLING-PAYMENTS-COMPLETE.md) |
|
||||
| **Integrations** | ✅ Active | WordPress sync, webhooks | [INTEGRATIONS.md](10-MODULES/INTEGRATIONS.md) |
|
||||
| **Notifications** | ✅ Active | Real-time notifications for AI tasks | [NOTIFICATIONS.md](10-MODULES/NOTIFICATIONS.md) |
|
||||
| **System** | ✅ Active | Settings, prompts, AI config | [SYSTEM-SETTINGS.md](10-MODULES/SYSTEM-SETTINGS.md) |
|
||||
|
||||
Reference in New Issue
Block a user