#javier-portal

1 messages · Page 1 of 1 (latest)

lime tundra
#

@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.

trail turtle
#

@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.

lime tundra
#

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

trail turtle
#

Thanks, @lime tundra, I'll test it, it would be better for me if it is subscription_cycle 😅

lime tundra
#

that feels a little brittle to me(basing it on the attempt counts)

#

as I said I don't think there's any good overall perfect solution unfortunately