Skip to content

Commit

Permalink
#1256 comment plan metadata by retrieving process for failed payments
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsimpson committed Oct 11, 2023
1 parent e0a6355 commit d44043d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions subscribie/blueprints/checkout/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,12 @@ def stripe_webhook():
log.info("Stripe webhook event: payment_intent.payment_failed")
plan_title = None
try:
# Get plan metadata by retrieving the stripe invoice id
# and then the metadata (stripe ultimatly puts plan metadata
# on the invoice->lines->data[0] object. Metadata is not available
# directly on the payment_intent.payment_failed event, hence the need
# to extract and fetch the stripe invoice id -> invoice and work backwards
# to identify the associated Subscribie plan.
eventObj = event["data"]["object"]
stripe_invoice_id = eventObj["invoice"]
try:
Expand Down

0 comments on commit d44043d

Please sign in to comment.