# 2. Payments & Billing

User Type: **Student**
Source: *Mi Digital Academy - Education CRM Features Document*

---

## 2. Payments & Billing

### 2.1 Payment Processing
**What it does:** Processes the Student's payments for subscriptions and course purchases. The Student selects a payment method, completes the payment securely, and receives a receipt. The platform supports the configured payment methods and handles success, failure, and pending states.

**Sub-features:**
- Select a payment method (as configured by the platform)
- Complete a payment securely
- Payment states: success, failure, pending
- Receipt issued on successful payment
- Payment amount and description shown before confirming
- Retry a failed payment
- Payment security (encrypted transaction)
- Payment event logging (initiated, succeeded, failed)
- Audit logging of the payment processing

**Student User Journey:**
1. Student reviews the order and selects a payment method.
2. Student confirms the amount and description, then completes the payment.
3. The payment succeeds; a receipt is issued.
4. For a failed payment, Student sees the failure and can retry.
5. A pending payment is shown until it is confirmed.
6. The transaction is encrypted end to end.
7. Student opens Profile → "Activity" and confirms the payment events are recorded.

**Rules & Edge Cases:**
- The payment amount and description are shown before confirming.
- A payment is in one of the states: success, failure, pending.
- A receipt is issued only on a successful payment.
- A failed payment can be retried.
- The transaction is encrypted.
- Payment events (initiated, succeeded, failed) are logged with the order and the timestamp.
- The payment processing is audit-logged with the account, the order, and the timestamp.

### 2.2 Payment History
**What it does:** Shows the Student their full payment history: every payment with its date, amount, description, method, and status. The Student can filter by date and status, and download a receipt for any payment. The history is the Student's record of all transactions.

**Sub-features:**
- Full payment history (date, amount, description, method, status)
- Filter by date range and status
- Download a receipt for a payment
- Search the payment history
- Payment history available on web and mobile
- History is read-only to the Student
- History event logging (viewed, receipt downloaded)
- Audit logging of the payment history

**Student User Journey:**
1. Student opens "Subscription" → "Payment history" and sees all payments.
2. Each entry shows the date, amount, description, method, and status.
3. Student filters to the last 3 months and to "Successful" payments.
4. Student downloads a receipt for a payment.
5. Student searches for a specific payment.
6. Student views the history on the mobile app.
7. Student opens Profile → "Activity" and confirms the history events are recorded.

**Rules & Edge Cases:**
- The payment history is read-only to the Student.
- Filters operate on date range and status.
- A receipt can be downloaded for any payment.
- The history is available on web and mobile.
- History events (viewed, receipt downloaded) are logged with the payment and the timestamp.
- The payment history is audit-logged with the account, the payment, and the timestamp.

### 2.3 Invoices and Receipts
**What it does:** Provides the Student with invoices and receipts for their payments. Each invoice shows the breakdown (plan, subjects, taxes, total) and can be downloaded. The Student can view and download invoices from the billing section.

**Sub-features:**
- Invoice per payment (plan, subjects, taxes, total)
- View an invoice detail
- Download an invoice
- Invoice list by date
- Invoice available on web and mobile
- Invoice is read-only to the Student
- Invoice event logging (viewed, downloaded)
- Audit logging of the invoices and receipts

**Student User Journey:**
1. Student opens "Billing" → "Invoices" and sees the invoice list.
2. Student opens an invoice and sees the breakdown (plan, subjects, taxes, total).
3. Student downloads the invoice.
4. Student filters the invoice list by date.
5. Student views an invoice on the mobile app.
6. Student opens Profile → "Activity" and confirms the invoice events are recorded.

**Rules & Edge Cases:**
- An invoice is issued per payment.
- The invoice shows the breakdown (plan, subjects, taxes, total).
- An invoice can be downloaded.
- The invoice is read-only to the Student.
- Invoice events (viewed, downloaded) are logged with the invoice and the timestamp.
- The invoices and receipts is audit-logged with the account, the invoice, and the timestamp.
