Since subscriptions are handled asynchronously by our system, we keep your servers up-to-date with a variety of events.
If a subscription is on a trial, we’ll first let you know that the trial is ending with the
customer.subscription.trial_will_end event; this can give your customers an opportunity to update their payment information, choose a specific plan, and so on.
We’ll then generate an
invoice.created event. The invoice will be open for modification if your customer’s subscription is active, so you’ll have an hour to make any adjustments before we attempt to pay it.
Since the billing periods have changed, there will be a
customer.subscription.updated event to update the
current_period_end values. The events you see from here depend on whether or not the invoice was successfully paid:
Invoice payment was successful
If the invoice was successfully paid, we’ll let you know that the invoice was paid with an
invoice.payment_succeeded event. If the invoice total was for more than our minimum charge, we’ll create an actual charge, so you’ll also see a
There will be a
customer.updated event to reset the
delinquent flag if your customer previously had a failed invoice.
Invoice payment failed
We’ll let you know about this case with an
invoice.payment_failed event. The payment could have failed either because your customer did not have a card on file or because the charge was declined; if it was due to a decline, we’ll also emit a
You’ll also see a
customer.updated event to set the
delinquent flag, an
invoice.updated event to track the payment attempts, and
customer.subscription.deleted depending on your retry settings.
Copied from ( for reference/note )