Skip to content

Commit

Permalink
Fixing end date
Browse files Browse the repository at this point in the history
  • Loading branch information
wAsnk committed Jan 15, 2025
1 parent 79c19a6 commit 2b27716
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ public async Task ReceivedStripeEventAsync(Event stripeEvent)
var subscriptionPart = new SubscriptionPart();
subscriptionPart.UserId.Text = user.UserId;
subscriptionPart.Status.Text = SubscriptionStatuses.Active;
subscriptionPart.EndDateUtc.Value = invoice.PeriodEnd;

// invoice.PeriodEnd doesn't show the current period, see Stripe docs:
// End of the usage period during which invoice items were added to this invoice. This looks back one
// period for a subscription invoice. Use the line item period to get the service period for each price.
subscriptionPart.EndDateUtc.Value = invoice.Lines.Data.Find(data => !data.Proration)?.Period.End;
subscriptionPart.PaymentProviderName.Text = StripePaymentProvider.ProviderName;
subscriptionPart.IdInPaymentProvider.Text = invoice.SubscriptionId;

Expand Down

0 comments on commit 2b27716

Please sign in to comment.