#kosherslayer

1 messages · Page 1 of 1 (latest)

full lionBOT
hidden hawk
#

Hello there

thorn arch
#

const subscriptionUsageUpdated = await stripe.subscriptions.update(
subscription_usage.id,
{
cancel_at_period_end: false,
proration_behavior: "create_prorations", // prorate charge at EOM
items: [
{
id: subscription_usage.items.data[0].id,
price: subscriptionItems.report_id,
},
{
id: subscription_usage.items.data[1].id,
price: subscriptionItems.white_label_id,
},
{
id: subscription_usage.items.data[2].id,
price: subscriptionItems.invoicing_id,
},
],
}
);
How I'm updating my usage subscription

#

Hey

hidden hawk
#

So what you want to do here is create an Invoice Item for the cost of the usage on the previous Price (the $2 Price). Then you clear usage and update the Subscription. Then that Invoice Item will be picked up by the next Invoice that is created when the Subscription cycles

thorn arch
#

ohh got it. Could you link the docs for this?

hidden hawk
#

There aren't really docs per-say. You want to use https://stripe.com/docs/api/invoiceitems/create to create the Invoice Item and you can pass the subscription parameter to make sure that Invoice Item gets picked up by an Invoice related to the relevant Subscription

thorn arch
#

so i'd make that api call with the price of the usage item with the amount I retrieve for that usage item (and the subscription)

hidden hawk
#

Pretty much

#

You'll need a separate Price object here since you wouldn't use a metered-based Price for your Invoice Item in this case.

full lionBOT
thorn arch
#

oh hm. Why couldn't I used a meter based price for the invoice item? I don't want to have to create two price objects for every usage item I have

hidden hawk
desert jackal
#

👋 Also hopping in here since bismark has to head out soon - another alternative is that you can leave both subscription items (the item for the $2/usage + the item for the $1/usage) on the subscription and just stop reporting usage on the old $2 price after they upgrade