Payment Entities
Entities for Stripe payment processing, subscriptions, disputes, and payment retries.
Subscription
Purpose: User subscription linked to Stripe subscription.
Key Fields:
Id(int): Unique identifierUserId: Subscribed userStripeSubscriptionId: Stripe subscription IDStripeCustomerId: Stripe customer IDStripePriceId: Stripe price IDTier: Free, Basic, Pro subscription tierStatus: Incomplete, Active, PastDue, Cancelled, UnpaidAmount: Subscription amountCurrency: Currency codeInterval: month, year, etc.IntervalCount: 1, 3, 6, 12, etc.TrialStart,TrialEnd: Trial periodCurrentPeriodStart,CurrentPeriodEnd: Current billing periodCanceledAt,CancelAt,EndedAt: Cancellation datesCancelAtPeriodEnd: Whether cancels at period endCancellationReason: Cancellation reason
Relationships:
- Many-to-one: User
Usage Patterns:
// Get active subscriptions
var subscriptions = context.Subscriptions
.Where(s => s.Status == SubscriptionStatus.Active)
.Include(s => s.User)
.ToList();
// Get user's subscription
var subscription = context.Subscriptions
.FirstOrDefault(s => s.UserId == userId && s.Status == SubscriptionStatus.Active);
Dispute
Purpose: Payment disputes from Stripe.
Key Fields:
Id(int): Unique identifierStripeDisputeId: Stripe dispute IDChargeId: Associated chargeAmount: Disputed amountCurrency: Currency codeReason: Dispute reasonStatus: WarningNeedsResponse, WarningUnderReview, WarningClosed, NeedsResponse, UnderReview, ChargeRefunded, Won, LostCreatedAt: Dispute creation dateResolvedAt: Resolution date
Relationships:
- Many-to-one: Payment (optional)
Usage Patterns:
// Get active disputes
var disputes = context.Disputes
.Where(d => d.Status == DisputeStatus.NeedsResponse || d.Status == DisputeStatus.UnderReview)
.ToList();
PaymentRetry
Purpose: Failed payment retry tracking.
Key Fields:
Id(int): Unique identifierPaymentIntentId: Stripe payment intent IDUserId: User with failed paymentAmount: Payment amountCurrency: Currency codeRetryCount: Number of retry attemptsLastRetryAt: Last retry timestampNextRetryAt: Next scheduled retryStatus: Pending, Success, Failed, CancelledFailureReason: Payment failure reason
Relationships:
- Many-to-one: User
Usage Patterns:
// Get payments needing retry
var retries = context.PaymentRetries
.Where(pr => pr.Status == PaymentRetryStatus.Pending && pr.NextRetryAt <= DateTime.UtcNow)
.Include(pr => pr.User)
.ToList();
Related Documentation
- Stripe Integration - Complete Stripe setup
- Stripe Service - See
FishingLog.API/Services/StripeService.csfor payment service implementation