Skip to content

Commit 0a0af81

Browse files
authored
Subscriptions: log subscription id when canceling (#9340)
* Subscriptions: log subscription id when canceling * Log when deleting customer
1 parent 97ee9ba commit 0a0af81

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

readthedocs/payments/utils.py

+8
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
def delete_customer(customer_id):
1818
"""Delete customer from Stripe, cancelling subscriptions."""
1919
try:
20+
log.info(
21+
"Deleting stripe customer.",
22+
stripe_customer=customer_id,
23+
)
2024
customer = stripe.Customer.retrieve(customer_id)
2125
return customer.delete()
2226
except stripe.error.InvalidRequestError:
@@ -29,6 +33,10 @@ def delete_customer(customer_id):
2933
def cancel_subscription(subscription_id):
3034
"""Cancel Stripe subscription, if it exists."""
3135
try:
36+
log.info(
37+
"Canceling stripe subscription.",
38+
stripe_subscription=subscription_id,
39+
)
3240
return stripe.Subscription.delete(subscription_id)
3341
except stripe.error.StripeError:
3442
log.exception(

0 commit comments

Comments
 (0)