Stripe: 'payment_intent.succeeded' is also triggered when subscription gets renewed

Viewed 552

I have two APIs for Stripe webhooks in my backend (Django).

  • "Subscription" webhook: /api/subscriptions/webhook/
  • "Add Balance to Wallet" webhook: /api/wallet/webhook/

In the subscription webhook, I listen for invoice.paid and invoice.payment_failed events and in the wallet webhook I listen for payment_intent.succeeded event. The problem is whenever the subscription webhook gets called, the payment_intent.succeeded event is also triggered for the wallet webhook. I think that's because payment intents are also created for subscription as well. I need a way to differentiate these two (one-time payment [aka add balance to wallet] and subscription) so I don't end up with extra credit in user's wallet whenever their subscription get renewed.

1 Answers
Related