#ironbeard - Subscription

1 messages ยท Page 1 of 1 (latest)

tacit quartz
#

HI ๐Ÿ‘‹

fervent elm
#

heyo, hope you're doing well ๐Ÿ™‚

#

Trying to distinguish between the invoice.payment_failed happening when first signing up (no need to email the user since they see the Card Element error) and later in their subscription (so I can email them to update their payment method).

Any suggestions for how to do that?

tacit quartz
#

Hmmmm.... do you have any example events?

fervent elm
#

So I think "evt_1L87c0CoTIfwbn28pUtgzfl5" is when I tested using a declined card

#

I suppose billing_reason would be "subscription_create" in this instance, so I can check for that. Is there a list of the possible values of billing_reason somewhere?

tacit quartz
#

Aha! Thanks for this. It has just what I was hoping to see. Here's what you check:
billing_reason: "subscription_create",. which you see too

#

There are the options listed (in a paragraph so not the best formatting IMO)

fervent elm
#

Great!

#

So, just to clarify, what would the billing reason be for e.g., the auto-renewing of an annual subscription one year after purchase date?

tacit quartz
#

subscription_cycle indicates an invoice created by a subscription advancing into a new period.

fervent elm
#

doh, I am blind

#

thanks ๐Ÿ™‚

tacit quartz
#

No worries. I really wish we had these in a table format anyway. It'd be much more clear

fervent elm
#

yeah, most def

#

If an invoice payment fails due to, say, the default payment method expiring. Does Stripe automatically retry to pay it in the near future (assuming the user has updated their payment info), or do I need to somehow allow the user to trigger a retry once they've input their new info?

tacit quartz
#

If the payment method fails you should prompt the user to update the payment info. The most direct way is to use the same invoice.payment_intent.client_secret approach you used to collect the first PM so it gets set on the Subscription.

fervent elm
#

I have a way for users to update/add payment methods in their user profile. So my thought was that if I get an invoice.payment_failed webhook with billing_reason == 'subscription_cycle' then I need to email them to log in and update/add a payment method (which updates/adds it on Stripe's servers too)

I'm not sure if I need to somehow trigger a re-collection of the invoice, though

waxen haven
#

Taking over for @tacit quartz here. As long as the mechanism you use for collection sets the customer's new Payment Method as the default for the Subscription, you shouldn't have to worry about re-triggering. It will also depend on when that happens, as Stripe has Smart Retries that progressively back-off over time: https://stripe.com/docs/invoicing/automatic-collection#smart-retries