@@ -88,7 +88,6 @@ def invoice_payment_succeeded(self, invoice: stripe.Invoice) -> None:
88
88
** template_vars ,
89
89
)
90
90
91
- # handler for Stripe event invoice.payment_failed
92
91
def invoice_payment_failed (self , invoice : stripe .Invoice ) -> None :
93
92
"""
94
93
Stripe invoice.payment_failed is called when an invoice is not paid. This happens
@@ -177,6 +176,10 @@ def invoice_payment_failed(self, invoice: stripe.Invoice) -> None:
177
176
178
177
# handler for Stripe event customer.subscription.deleted
179
178
def customer_subscription_deleted (self , subscription : stripe .Subscription ) -> None :
179
+ """
180
+ Stripe customer.subscription.deleted is called when a subscription is deleted.
181
+ This happens when an org goes from paid to free.
182
+ """
180
183
log .info (
181
184
"Customer Subscription Deleted - Setting free plan and deactivating repos for stripe customer" ,
182
185
extra = dict (
@@ -286,8 +289,11 @@ def subscription_schedule_released(
286
289
),
287
290
)
288
291
289
- # handler for Stripe event customer.created
290
292
def customer_created (self , customer : stripe .Customer ) -> None :
293
+ """
294
+ Stripe customer.created is called when a customer is created.
295
+ This happens when an owner completes a CheckoutSession for the first time.
296
+ """
291
297
# Based on what stripe doesn't gives us (an ownerid!)
292
298
# in this event we cannot reliably create a customer,
293
299
# so we're just logging that we created the event and
@@ -563,10 +569,10 @@ def _check_and_handle_delayed_notification_payment_methods(
563
569
owner .stripe_subscription_id , default_payment_method = payment_method
564
570
)
565
571
566
- # handler for Stripe event payment_intent.succeeded
567
572
def payment_intent_succeeded (self , payment_intent : stripe .PaymentIntent ) -> None :
568
573
"""
569
- Stripe payment intent is used for the initial checkout session
574
+ Stripe payment intent is used for the initial checkout session.
575
+ Success is emitted when the payment intent goes to a success state.
570
576
"""
571
577
log .info (
572
578
"Payment intent succeeded" ,
@@ -579,7 +585,6 @@ def payment_intent_succeeded(self, payment_intent: stripe.PaymentIntent) -> None
579
585
payment_intent .customer , payment_intent .payment_method
580
586
)
581
587
582
- # handler for Stripe event setup_intent.succeeded
583
588
def setup_intent_succeeded (self , setup_intent : stripe .SetupIntent ) -> None :
584
589
"""
585
590
Stripe setup intent is used for subsequent edits to payment methods.
0 commit comments