#benjamineugenewhite

1 messages · Page 1 of 1 (latest)

simple radishBOT
hybrid scarab
#

There will be one for each individual charge on the sub

#

And the first one won't occur until the customer inputs their payment method and confirms the initial payment intent

heady pagoda
#

Thanks so much!

#

Follow up question: is there an "easy" way to tell if a payment_intent.succeeded event is the first for a given subscription? In our system, we have business logic that needs to execute after the first (and only the first) payment on a subscription.

hybrid scarab
#

You could maintain state in your db. For example have a boolean on the customer like active_subscription. Have that default to false, and change it to true on the first successful payment

#

Then if you get a subsequent payment_intent.succeeded event and active_subscription=True, you know it's not the first one

#

And you can always set active_subscription to false if the customer cancels the sub (or is cancelled due to failed payments or something) via the customer.subscription.deleted event

heady pagoda
#

that makes sense. thank you.