Base solution for your next web application
Open Closed

Stripe integration - Recurring billing question #12615


User avatar
0
eric_pulaski created

For recurring billing with Stripe integration, when it comes time for the user's next bill to be generated, does

  1. ASP.NET Zero generate the invoice, and then sends a payment request to Stripe, then ASP.Net Zero marks the invoice as paid when the Webhook is called by Stripe? OR
  2. Stripe initiates the recurring payment request and then call the Webhook to let ASP.NET Zero know that the invoice was paid, and then ASP.NET Zero creates the invoice, marked as paid. [I guess, in this case, if something went wrong in Stripe and the Webhook is never called, there would never be a new Invoice in ASP.Net Zero and the user's account would be made inactive (or moved to a new addition) after the grace period, with no visible "unpaid invoice"? OR
  3. something else?

Thanks in advance for your reply.

-Eric

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

2 Answer(s)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @eric_pulaski

    Your understanding is correct, and among the options you listed, the second one is how ASP.NET Zero + Stripe recurring billing actually works.

    What Really Happens in Recurring Billing

    Stripe is fully responsible for recurring billing. ASP.NET Zero is passive in this flow.

    The actual sequence is:

    1. Stripe initiates the recurring charge

      • When the subscription was first created, ASP.NET Zero created a Stripe Subscription
      • For each billing cycle, Stripe automatically generates its own invoice and charges the customer
      • ASP.NET Zero does not generate an invoice or send any payment request for renewals
    2. Stripe notifies ASP.NET Zero via webhook

      • When the payment succeeds, Stripe sends an invoice.paid webhook
      • ASP.NET Zero listens for this event (specifically billing_reason == subscription_cycle)
      • At this point, ASP.NET Zero reacts to Stripe it does not initiate anything
    3. ASP.NET Zero creates its internal record retroactively

      • Upon receiving the webhook:

        • A SubscriptionPayment record is created
        • It is immediately marked as Paid
        • The tenant’s SubscriptionEndDateUtc is extended

    So to be explicit:

    ASP.NET Zero does not create an invoice first and then wait for Stripe to pay it. Stripe creates and pays the invoice first, then ASP.NET Zero records the result.

    If the Webhook Never Arrives

    Your assumption here is also correct:

    • No SubscriptionPayment record is created in ASP.NET Zero
    • There is no unpaid invoice concept for recurring payments on the ASP.NET Zero side
    • The system relies solely on SubscriptionEndDateUtc

    Then:

    • SubscriptionExpirationCheckWorker detects expiration

    • After WaitingDayAfterExpire:

      • Tenant is deactivated or
      • Moved to ExpiringEditionId
    • Notification email is sent

    A missed webhook means the system behaves as if the payment never happened, even if Stripe actually charged the customer.

    Stripe owns the recurring billing lifecycle; ASP.NET Zero only listens to Stripe webhooks and records successful payments after the fact it never proactively generates renewal invoices or payment requests.

    If you have any questions, please do not hesitate to contact us.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    eric_pulaski created

    Thanks. I really appreciate the detailed response. Just the info I needed.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)