#stripe_connect_platform-ApplicationFee

1 messages · Page 1 of 1 (latest)

tight jasper
#

Hi, taking a look here.

tight tulip
#

ok

#

Like if an annual sub is paid on Aug 1, 2022 and I updated the application fee on Aug 2, 2022, I don't get the application fee in Aug 1, 2023 (since that invoice was created a year earlier, the day before we added the fee) and not until Aug 1, 2024!

#

So i think we need to update the Aug 2, 2022 invoice and add our calculated application fee, yes?

#

So then we just wait 1 year and not 2 years

tight jasper
#

That is correct, since it's paid prior to updating the application fee

tight tulip
#

not paid

#

made

#

the invoice is made a year prior to being paid on an annual sub.

#

the invoice is made one month prior to being paid on a monthly sub

#

I updated the application fee up to 2 years before we get paid

#

Stripe apparently does not have a callback to update an invoice when the application fee is updated so the invoice just sits there for a month/year with no application fee

#

i didn't realize this so thought after all that work, we would get the application fee on payments made after we added the fee.

#

But no

#

We only get paid on invoices that were "created" after we update the fee

#

Not on invoices "paid" after we updated the application fee (which would be what I would request and want in an ideal universe)

#

So given that, we need to now not only update an application fee, but find every invoice upcoming and calculate the application fee on those invoices, is that correct?

tight jasper
#

Looking, was digging into something

tight tulip
#

Stripe::Invoice.upcoming({
subscription: 'sub_xxxxxx',
application: 'ca_us',
application_fee: (amount_due * application_fee_percent/100)
},{account: stripe_account})

#

we have to do something like that methinks on each invoice no?

tight jasper
#

I'll need to test this on my end as well

#

to make sure that I'm providing accurate information.. this may take some time

tight tulip
#

sure

#

don't you think the upcoming invoice should be automatically updated when we update the application fee on the subscription for which that invoice was created?

distant laurel
#

👋 stepping in as pgskc had to step away

#

Yes the upcoming invoices will include the app fee if they haven't been generated yet and you update the sub

tight tulip
#

we are trying to get this fee today. not in 2 years

#

all the payments coming through are on invoices created a month or a year ago!

distant laurel
#

Then you would need to cut an invoice today, otherwise it won't occur until the next renewal

tight tulip
#

?

#

It

#

"it won't occur"

#

it means that you create the invoice correctly

#

the payment is the "it" we are talking abot

#

does us no good to have an application fee that we do not actually collect

#

So we need to what?

#

Update each invoice right?

distant laurel
#

You can't update the invoice if it is already finalized.

tight tulip
#

Update the upcoming invoices that were not updated

#

What does finalized mean

distant laurel
#

You have unpaid invoices with a future due date, correct?

#

And they have no app fee

tight tulip
#

created == finalized?

distant laurel
#

No.

#

An invoice is created in draft

#

And then finalized.

#

It is mutable in draft. Not once finalized.

tight tulip
#

what does finalized actually mean in Stripe?

#

i have no idea what you mean by finalized

distant laurel
#

We literally fire an event invoice.finalized when an invoice is... finalized.

#

When an invoice moves from draft to another status

tight tulip
#

If an annual subscrition is paid today. Aug 11, 2022, Stripe creates an invoice for the Aug 11. 2023 payment right?

distant laurel
#

It is finalized.

tight tulip
#

ugh

distant laurel
#

No?

tight tulip
#

What is the event that occurs or the time that takes place before an invoice is "finalized"

distant laurel
#

The invoice is created in draft and then finalized. It depends on the Subscription collection_method for how exactly the timing occurs here.

#

Let's pause and back up

#

Give me a specific subscription to look at for which you are concerned about.

tight tulip
#

If an annual subscrition is paid today. Aug 11, 2022, when does Stripe "create" an invoice for the Aug 11. 2023 payment? When and why does Stripe "finalize" it?

distant laurel
#

It is created at upon the new billing period

tight tulip
#

lost

#

totally lost

#

hold on

distant laurel
#

That's fine. Like I said let's look at an actual sub

#

Then we can walk through it.

tight tulip
#

OK, now I am looking and I am totally confused

#

We looked at upcoming invoices and saw no application fee

#

So I thought we were going to have to wait on not the next invoice but the one after that to get the fee

#

But now I am seeing the fee

#

I can give you one sure

distant laurel
#

I mean what you just stated is the expected behavior.

#

Any invoice created after the sub is updated will contain the app fee

tight tulip
#

That is not the issue

#

The issue is with any invoice "PAID" after the sub is updated with the app fee

#

NOT

#

Any invoice "CREATED" after the sub is updated with the app fee

#

sub_1L9bpAARO6wJn972Njkybhuh

#

I am now surprised and confused but happy.

#

On that sub, it was "paid" on Aug 11th, today. and we got the application fee which is great

#

So when was that invoice:
1.) Created
2.) Updated with an application fee (I think on Tuesday Aug 9th(ish) by mee
3.) Finalized
4.) Paid - today

distant laurel
#

I don't understand why you are surprised. The Sub update happened on August 9th. The Invoice was created on August 11th.

tight tulip
#

1 and 3

#

hmmmmm

distant laurel
tight tulip
#

On August 9th, I ran the update.

distant laurel
#

That is the event where you can see the invoice is created

tight tulip
#

Then I looked at the upcoming invoice and koopajah seemed to be explaining to me why the upcoming invoice had an application fee of null since the upcoming invoice was created at the time of the last billing

#

So you are now saying that an invoice is created immediately before it is paid and not at the time one month (monthly subs) or one year (annual subs) prior?????

distant laurel
#

Yes. An invoice is created at the time of the new billing cycle.

tight tulip
#

So you are saying that the Stripe::Invoice.upcoming will show the application_fee as null but when it actually is paid, we get the fee???

#

I still don't understand why the upcoming invoice after an API call to update the subscription does not reflect the actual fee to be paid. ? But I am also really happy it is paid. I didn't want to update all those invoices.

#

Sorry, how do you show an upcoming invoice if it was not created (yet). That is just what the invoice you imagine will be created in the future but it does not yet exist as an invoice?

#

The big issue is that we start getting paid and don't have to wait >=2 years (annual sub)

#

Or >=2 months (monthly)

#

So it is now looking correct but i am confuzled

#

If a Stripe subscription is created today (new sub) on August 11th, 2022.

distant laurel
#

You type fast lol

#

Slow down

tight tulip
#

When is the invoice for Aug 11, 2023 created? You are saying that future invoice is created on Aug 11, 2023?

#

ok

distant laurel
#

When you preview and invoice you are previewing the upcoming draft

tight tulip
#

got it

distant laurel
#

That draft invoice will not have the application fee assessed yet

tight tulip
#

draft

distant laurel
#

That is why it is null

tight tulip
#

right

distant laurel
#

The application fee is actually applied on invoice finalization

tight tulip
#

shouldn't it be reflected on the draft?

distant laurel
#

No

tight tulip
#

ok

distant laurel
#

Because the invoice is mutable in draft

tight tulip
#

fair enough

distant laurel
#

You could add items

#

Or change things

tight tulip
#

OK, i was trying to look at the draft invoice to confirm we were going to get paid and saw a :null for application_fee. So that is a feature not a bug

#

So even though the application_fee was null on the draft, you do check the application_fee prior to finalizing the invoice, and you checked the application_fee and applied it correctly. OK! I am understanding now!!!!!!

distant laurel
#

Yes you got it

tight tulip
#

OK!!!!!! Yes. Thank you. I am so glad I do not have to calculate the application fee on 10,000 subscriptions and update them all!!!!!!!!!!!!!!!!!!!! Thank you!

#

i am good and now understand draft vs. finalized invoices and the application fee and what is shown on upcoming invoices vs what we are paid upon payment. I'm good and have to run. Thank you!