#javier-portal
1 messages · Page 1 of 1 (latest)
@trail turtle it's a good question .There isn't really a perfect answer though.
I actually don't think there's any real way to definitively know this in all cases. You could for example look at the billing_reason of the Invoice object(https://stripe.com/docs/api/invoices/object#invoice_object-billing_reason) and only send emails if it's subscription_cycle(recurring invoices) but if the customer is using the portal to re-attempt payment of a recurring invoice that failed, it would match as well, so yeah, not perfect.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
@lime tundra Ok, thanks. I'll do that for the moment, only send emails for subscription_cycle.
Another question. When an scheduled subscription is transformed in a subscription. Which is the value of the billing_reason? Because I'm also using scheduled subsriptions, which maybe a problem in case the payment fails.
as in what is the billing_reason on the first invoice of a subscription created in the future from a schedule? I think it's also subscription_cycle (it should be subscription_create but I think this is a quirk) but I'm not 100% sure without testing it specifically
Thanks, @lime tundra, I'll test it, it would be better for me if it is subscription_cycle 😅
I forgot to mention, that I found this answer, I don't understand this completely, but does it make sense for you? https://stackoverflow.com/a/69056190