#edutomesco

1 messages · Page 1 of 1 (latest)

signal topazBOT
mystic shale
#

Hi
Can you give a concrete example please of this ?

warm needle
#

yes

#

I have a product that have 5 prices of yearly recurrence. This 5 prices represent 5 services on my company that are metered prices with layers. The first layer is the quantity is included on your subscription and it costs 0€. The second layer is all the overage that the user consumes that is not included on the subscription and so it would be charge the next billing cycle that extra amount. But with the annual plans what happens is that I don't want to wait one year to charge this extra amount I want to control that monthly, and so I would like to every month passed on an annual subscription to emit an invoice to the customer to liquidate this overage used.

#

The reason the interval is anual is because one of the price is a licensed that is a fixed price the user should pay in the case of annual subscriptions annually

#

More clear?

signal topazBOT
warm needle
#

I'm thinking on create a worker on my service to control when the subscription change of month and emit an invoice manually for all the overage the user did.

#

Hi?

mystic shale
#

Otherwise, you can create multiple subscription for the same customer, each Subscription represent a Layer, (one annual subscription, one monthly...)

warm needle
slim tundra
#

I'm struggling to understand the use case you describe. Can you share an existing sub_xxx that demonstrates the behaviour?

warm needle
#

sub_1MnzULG1fQyuUuzXngkGkfTV

slim tundra
#

But with the annual plans what happens is that I don't want to wait one year to charge this extra amount I want to control that monthly
That's just not possible unfortunately

#

and so I would like to every month passed on an annual subscription to emit an invoice to the customer to liquidate this overage used.
Why not just use a monthly price?

#

The reason the interval is anual is because one of the price is a licensed that is a fixed price the user should pay in the case of annual subscriptions annually
Then this is something you'd need to account for in your integration. Perhaps you prevent cancellations until after annual period is over

warm needle
#

exactly if user cancels you have access since the finalitzation of your subscription because you already paid

#

can you propose me a better design?

#

or how people manage this use case?

warm needle
#

Business model don't allow me to emit two different invoices with different prices

slim tundra
warm needle
#

because I need to charge the licensed prices just ones per year

slim tundra
#

Well then have 2 Subscriptions: one with the annual price, and the other with the recurring monthly prices

#

If you need them on one Invoice, then you'll need to use your own Invoicing service

warm needle
#

but I'm using the checkout of stripe I think I can't achieve that

slim tundra
#

There's no way to do what you're describing with a single Subscription

warm needle
slim tundra
warm needle
#

Use pending_invoice_item_interval to specify an interval for how often to bill for any pending invoice items. This is equivalent to having Stripe create a one-off invoice for the subscription on a recurring basis.

#

this could handle it?

slim tundra
#

Maybe that will work, have you tried it? Your use case is very specific, it's hard for me to fully recommend something as I don't have all the context you do

warm needle
#

I didn't try it

#

But this is to put prices to execute on different interval isn't it?

slim tundra
#

No, you'd need to manually add the invoice items to each Invoice not the Subscription

warm needle
#

I mean what is considered a pending invoice item?

warm needle
slim tundra
# warm needle don't understand

Read the documentation:

These one-off items are added to the next invoice created for this customer. To make sure this is added to a specific subscription, use the optional subscription parameter to apply it to that subscription.

#

So you'd need to add them ~every month I imagine if your Subscription is annual

slim tundra
warm needle
#

but how this invoice is trigger?

#

I mean I need to do something apart from specify this when I create the subscription?

slim tundra
#

The best option is you to just try this out, and use billing clocks to see if this works as you need

warm needle
#

Okey, but I dont need to manually create any invoice no?

slim tundra
#

No, you'd need to manually create the Invoice Item every month though to reflect the monthly charge you want

warm needle
#

but how I know when I need to create this invoice?

#

I mean I need a webhook or something like this no?

#

because its tottally async

slim tundra
#

You'd create it via a job or a queue I guess, at whatever timestamp you want to generate the monthly invoice

warm needle
#

In general, when a customer incurs overage charges for a metered price during the middle of a subscription period, a pending invoice item is created for the overage amount, and this item is added to the next invoice that is generated for the subscription, according to the specified pending_invoice_item_interval. The exact amount of the pending invoice item will depend on the pricing and metered usage for the specific price in question.

#

but reading this it suggests I do not need to create any invoice

#

I mean

#

how I know when it's the next month if I put an interval of "month"

slim tundra
#

You don't create an Invoice no, you'd create an Invoice Item every month (if that's the interval you want), which would be invoiced according to the pending_invoice_item_interval field on the Subscription

slim tundra
warm needle
#

and how I can do that?

#

I don't exactly understand

#

So then why it's used ending_invoice_item_interval

slim tundra
warm needle
#

if I need to control myself the first of each month

signal topazBOT
slim tundra
#

This is what that parameter exists, so you can charge for one-off items related to the Subscription of a different interval

#

But you need to create the Invoice Items yourself

warm needle
#

Okey so then I need to put all the prices that I want to charge on this invoiceitem object?

#

But for me the difficult thing is to know when I should put this? I need to know the change of month and that is sync with the stripe

slim tundra
warm needle
#

I can execute this in a cron for example every two hours

slim tundra
#

Honestly, my original recommendation would be to just try this out and see how it works, and whether it's a good fit for you

warm needle
slim tundra
#

Create your Subscription with your annual Price, set pending_invoice_item_interval: 'monthly'

warm needle
#

monthly it's month isn't it?

slim tundra
#

Then try adding Invoice Items, passing the subscription parameter and see what happens

#

You'll need to do this with a test clock so you can jump forward to the billing intervals as needed

warm needle
#

but how can I specified this customer and subscirption on test clock

#

if I can put code to create it?

slim tundra
warm needle
#

but from the dashboard I can't put the attribute I want

#

when I create the subscription