#Osiris

1 messages · Page 1 of 1 (latest)

buoyant rootBOT
hushed stone
thick trench
#

If I create invoice on subscription, the amount is zero. Docs say 'pending' items would be included. Its not including the outstanding usage

hushed stone
#

What doc are you reading?

thick trench
#

I tried to create invoice on this subscription and amount is 0.

hushed stone
#

The quantity is 48, and I saw the amount is 2,205, I believe you are using volume tiers_mode

thick trench
#

no no, above is screenshot of upcoming invoice from subscriptions dashboard. The invoice I created just 1 minute back is this.

hushed stone
#

Did you report any usage yet?

thick trench
#

I wanted to show even though it shows 2205 outstanding, when I create invoice using

stripe.invoices.create({
    customer: 'cus_xxx',
   subscription: 'sub_yyy'
})

amount is 0.

#

Did you report any usage yet?
First screenshot is recorded usage.

#

Basically , stripe isn't considering that 2205 as pending because its due date is 28th April. And hence its not being included in off-cycle invoice I am creating

hushed stone
#

Did you create any pending invoice items? or you just report usage without creating any pending invoice items?

thick trench
#

No I didn't create any 'pending' items. The series of events were:

  • 28th Mar Morning: subscription bought (1 month interval)
  • 28th Mar evening: usage recorded as 48 (on subscription)
  • 29th Mar (NOW): I am creating an off-cycle invoice
hushed stone
#

OK, the Stripe will create a pending invoice item based on the usage at the end of the billing cycle (i.e., 28th April), since it's is 29th Mar, that pending invoice item is not yet created and therefore not included in the invoice that you explicitly create.

thick trench
#

Yes then it doesn't help with my usecase ? The off-cycle invoice I create will never include the outstanding usage ?

hushed stone
#

Not directly, you'll need to calculate the amount create your own pending invoice item

thick trench
#

You mean a new flat one-time price for every such case ?

hushed stone
#

It depends on your business requirement. You said "I want to charge the customer if usage increases certain threshold. ", what's the amount that you wish to charge?

thick trench
#

Right I was too fixated on 'price varies' thing of volume based pricing. Didn't realise I can charge the threshold itself. Like after usage amount increases 2k charge equivalent money.

#

So i need to create a invoice, then add a new invoice_item with calculated price. Correct ? Also is it even possible to create invoice item with volume pricing (priceId = that of user-seats) and then set usage ?

#

Will figure that out from docs. Thanks for help !

hushed stone
#

I think that's possible, here's my suggestion.

thick trench
#

cool, got it. supplying priceId didn't work but explicitly setting amount and quantity is working. I will consider this best possible supported solution. Thanks again for help

hushed stone