#krystian_api

1 messages ยท Page 1 of 1 (latest)

clear fiberBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1357068301146132680

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

lusty otter
#

invoice id is in_1QqbtDAW7n1f4M8CMetccSri

fierce trench
#

Hi there ๐Ÿ‘‹ is that the first Invoice for the Subscription?

I see this is a livemode Invoice, are you able to reproduce this behavior in testmode too?

#

Ah, looks like that's the one and only Invoice for the Subscription? Can you share the full response that is provided when you retrieve that Invoice from the API?

The associated Events are too old for me to be able to look at those to see the fields you're referring to, and otherwise when I look at it I see that the period is a month long.

fierce trench
#

@lusty otter are you still around to share context about your concern?

lusty otter
#

im here

#

sure let me get you the full response

#

yes that is livemode

fierce trench
#

Hm, I do see that period_start and period_end are the same, which I'm a little surprised by, but I also see the expected period within period hash within the line items. Would that give you the data that you need for now?

lusty otter
#

let me look

clear fiberBOT
lusty otter
#

yes seems that will work

#

so is that period going to represent the remaining amount of time in the billing cycle?

#

in the case of a customer being charged mid-billling cycle with proration?

harsh wave
#

๐Ÿ‘‹ stepping in here as toby needs to step away

#

Just to clear up any confusion, the period_start and period_end represent the period that the Invoice bills for. So this would be the previous period and is why it is the same for the initial Invoice of the Subscription.

#

If you look at the periods of the line items themselves then that is forward looking

lusty otter
#

thx. im having a hard time wrapping my head around why that makes sense, if the line items are forward looking, but the invoice is backward looking?

#

my customers pay me upfront, for access to my software for the next month

harsh wave
#

Yeah this has tended to be a point of confusion. Mostly the Invoice period_start and period_end is backward looking due to potential proration.

#

The Subscription itself is what is forward looking

#

And the line items here are derived from the Subscription

#

Thus why they are forwarding looking.

lusty otter
#

okay so will the line items represent the period through which access was provisioned, if additional seats where purchased mid billing cycle?

#

i.e. If the first invoice that starts the subscription is on April 1st, with a line item having period_start April 1st, period_end April 30th,

harsh wave
#

The Invoice is frozen so its properties won't change.

#

The Subscriptions properties would change from an update.

lusty otter
#

then will the second subscription invoice line item have period_start April 15th, period_end April 30th?

harsh wave
#

If that is the prorated period then yes it should.

lusty otter
#

in the case the user added more seats mid billing cycle, and i charged them right away for those seats

harsh wave
#

(On the new Invoice)

lusty otter
#

okay great

harsh wave
#

I'd recommend testing it just to make sure

lusty otter
#

will do

harsh wave
lusty otter
#

im calculating commission for my sales reps off of every individual invoice

#

mainly because, the first invoice might not come from their effort. But then the sales rep gets involved once they're a customer, working to upsell them on more seats

#

so they shouldn't get comp'd for the first invoice, and only the second invoice

#

since im syncing every invoice to my database, i can then create multiple 'commission records' for the same invoice - just to support things like payroll being ran on slightly different intervals. so i need to calculate how much of the invoice have i paid out to the sales rep, and base that off of the time period and the prorated amount

#

as of right now, it seems like invoice.lines.data.period is what needs to be used

harsh wave
#

Yep that is likely what you want.