Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into issue/NEST-537
Browse files Browse the repository at this point in the history
  • Loading branch information
BenedekFarkas committed Jan 21, 2025
2 parents 06c147d + aa17a6c commit 3ce88d2
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ 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:
// https://docs.stripe.com/api/invoices/object#invoice_object-period_end
// "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 3ce88d2

Please sign in to comment.