#Nick - convert invoice

1 messages ยท Page 1 of 1 (latest)

uneven mauve
#

Hello. One moment here

gray galleon
#

Thanks!

uneven mauve
#

So you just want to put the invoices in a draft state to give the customers time to update their payment methods?

#

Just want to know why you want to do this exactly

gray galleon
#

Let me provide a bit of context

#

On Feb 10, I migrated all of our subscriptions from licensed pricing to metered pricing. That forced the billing_cycle_anchor to be Feb 10 -> March 10 (because the price is monthly).

We continued to report usage, but a requirement from our finance team is to have the billing period be the 1st to the 1st - so yesterday at 12AM UTC I tried to run billing_cycle_anchor=now to convert the balances up to that point into an invoice, and have the billing_cycle_anchor be reset back to the first

It worked fine for most of the subscriptions, but a few with bad payment methods (or lack thereof) received an error from Stripe, so now I'm not sure what to do

uneven mauve
#

Got it

#

So, for the failed payments, what's your end-goal?

gray galleon
#

We've got our own retention mechanisms and such internally that will trigger

#

Just seems weird that Stripe's automated period change has no problem converting upcoming to draft/finalized regardless of credit card but API actions have different requirements?

uneven mauve
#

Paying the invoices with the bad payment methods failed, so you want to mark an invoice that's past due back to draft?

gray galleon
#

Well that's the thing. The payment failed but it didn't generate an invoice

uneven mauve
#

Can you share a sample subscription id?

gray galleon
#

So the billing_cycle_anchor didn't change and an invoice wasn't created, but a charge was

#

Almost seems like a chicken and an egg? How does the payment happen without an invoice?

uneven mauve
#

Sorry for the delay here. Juggling some things

#

But if you retrieve the subscription, I believe the latest invoice object refers to the one generated on the 10th

#

When you did the update

gray galleon
#

That upcoming invoice total is what Stripe tried to charge for. But when the charge failed, it just left the invoice in upcoming

foggy spruce
#

HI ๐Ÿ‘‹ I'm stepping in for @uneven mauve . Gimme a second to get caught up

#

So in this case I'm pretty sure you'd want to reach out to the customer for each invoice and have them update their payment method.

gray galleon
#

But how would I do that if there is no invoice?

#

Like when the invoice.payment_failed webhook comes in, we send emails to the customer to do so

#

(update their payment method)

foggy spruce
#

Can you share the most recent event ID?

gray galleon
#

The last event in the dashboard is from Feb 11, the day I did the migration from licensed to metered

foggy spruce
#

The invoice.payment_failed event did not trigger?

gray galleon
#

Correct

#

There was no invoice created. So I'd imagine that's why it didn't send the event

foggy spruce
#

Okay...and that's due to the billing cycle anchor change attempting to trigger an automatic invoice, for which these customers did not have a valid payment method... ๐Ÿค”

gray galleon
#

So the only thing I can do is write off these invoices by clearing the usage and then resetting the billing cycle anchor

foggy spruce
#

I think there should be other options. Let me keep digging

foggy spruce
#

I'm trying to understand why the latest_invoice on that subscription had $0 as the amount

gray galleon
#

Because the latest_invoice is the one from Feb 10

#

Like if you look at the actual ID, that's what it points to, the invoice from when I changed price ID's from licensed to metered

#

(I believe it's from metered-migration > whatever actual price)

foggy spruce
#

Okay, so there's currently no PI for these subs. You need the PI to request the customer update their payment method.

foggy spruce