#chiefwhitecloud

1 messages · Page 1 of 1 (latest)

vernal otterBOT
hard karma
#

Hi there!

floral berry
#

Hey!

hard karma
#

The invoice object has a billing_reason field https://stripe.com/docs/api/invoices/object#invoice_object-billing_reason but it won't tell you if the subscription just finished its trial period.
Instead you could listen to the webhook event customer.subscription.updated to check when the subscription moves from trialing to active, and with the subscription object you can easily find the invoice in the latest_invoice field https://stripe.com/docs/api/subscriptions/object#subscription_object-latest_invoice

floral berry
#

Thank you!

#

Oh wait

#

The subscription update happens an hour before the invoice is finalized. I guess that is why we are listening to invoice.payment_succeeded.

#

I could update the invoice with some meta data… if it is coming out of trial and then check for it in the invoice.payment_succeeded?

hard karma
#

I could update the invoice with some meta data… if it is coming out of trial and then check for it in the invoice.payment_succeeded?
Yes that should work!