#polar_subscription-item-updates

1 messages ยท Page 1 of 1 (latest)

weak kindleBOT
#

๐Ÿ‘‹ 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/1226906152898658375

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

prime duneBOT
#

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.

azure marten
#

Hello

#

Let me take a look

fossil blade
#

Thanks!

azure marten
#

Do you have a request ID you can share where you tested that?

fossil blade
#

We're using the python library, and the docs said that endpoint is not supported, but I was using stripe.InvoiceItem.modify (which seems like it may not do the same thing)

#

req_8YsOzNzjS3GOr0 and req_jS6fquIPs0GbBu are two request IDs

#

I noticed I can't see those requests in my stripe dashboard for some reason though, but the error message is: InvalidRequestError: Request req_8YsOzNzjS3GOr0: When passing an invoice's line item id, you may only update tax_ratesordiscounts`.

azure marten
#

You wouldn't modify the Invoice Item if it is already associated to the Invoice

#

What version of the SDK are you using?

#

You should be modifying the actual invoice line item afaik -- what error do you see that indicates that isn't supported?

fossil blade
#

Put the error message above: InvalidRequestError: Request req_8YsOzNzjS3GOr0: When passing an invoice's line item id, you may only update tax_rates or discounts.

#

And for the line item, we're using the python library and the docs said it's not supported in python: We show the cURL request because this method is currently unsupported in the Python client. To see it in the library, let us know about your use case. https://docs.stripe.com/api/invoices/update_line

#

Let me grab our version

#

We're currently on 2.55.0

#

API version is 2022-08-01

azure marten
#

Ah right right

#

Okay one min

#

So you are going to need to upgrade to utilize that

fossil blade
#

We are currently in the process of upgrading, however it'll likely be a bit before we can catch all the way up to 8.4.0. Do you know if there's another way we'd be able to do this in the meantime?

azure marten
#

Not that I'm aware of, no. I tihnk you could not pass an Invoice ID for the Invoice Item and then you should be able to update the Price using the Invocie Item update API and then it would be picked up by the next finalized Invoice. This would work as long as you aren't having multiple Invocies created/finalized at the same time so that the wrong one picks it up.

fossil blade
#

Sorry not sure I understand, I am passing the invoice item ID - are you suggesting I need to pass the invoice ID instead?

azure marten
#

You are creating a one-off Invoice item to be picked up by a Subscription Invoice here, right?

#

Or am I misunderstanding and you are trying to upgrade the Line Item that is generated from a recurring Subscription's Subscription Item?

#

If so, you can't do that. You would need to actually update the Subscription itself to cut a new Invoice

#

And void the current one.

fossil blade
#

There's an existing invoice and item, and we want to update the item to point to a different plan and price

#

So essentially upgrade the line item like in your second message

azure marten
#

That Invoice and item was generated via a Subscription renewal?

fossil blade
#

Correct

#

I suppose we could create a new invoice item and delete the old one

azure marten
#

Correct for which one ๐Ÿ˜…

#

You can't mess with the Subsciption-generated Line Item here

fossil blade
#

Correct the invoice and item are generated via the subscription renewal

azure marten
#

Okay yeah then you can't update that Item in terms of changing the Price

#

That item is tied to the Subscription Item -- the Price on the Subscription itself

#

So you need to update the Subscription in this case, not that Invoice

#

So ideally you make this update before the renewal occurs.

weak kindleBOT
fossil blade
#

Sorry, had to jump to another meeting

#

Thanks for the options

#

We're looking at the last option there, but probably wouldn't go with that as we want to continue relying on the recurring invoice for some internal handling on recurring invoices

#

We may just need to look at the version upgrade to get access to modifying invoice items

knotty jasper
#

Hi ๐Ÿ‘‹

My colleague had to step away so I've taken over.

#

As I understand your situation, and as my colleague explained, you cannot modify the price the line item is associated with on the Invoice. You must modify the Subscription Item before the invoice is generated

fossil blade
#

Will that still be true after we've upgraded to version 8 when InvoiceItem.modify is available?

knotty jasper
#

Yes

#

Your invoices are being generated by a Subscription. So you need to update the Subscription.

#

The ability to update InoivceItems would only be relevant if you were attempting to update one-off invoices

#

It's not only technically not possible, it also doesn't make sense to attempt to update the Invoice Item when it's being created by a Subscripton.

Can you describe your larger business case here?

fossil blade
#

Thanks for the information. Yes, let me take a step back and describe the larger business case so we can see if another approach makes sense

#

We're looking to implement scheduled automatic upgrades for customers based off the last usage in a billing cycle. So say a customer was on a plan that supported 10 widgets, if they had 11 widgets when their billing cycle rolled around, we'd like to update their subscription and their recurring invoice to have a plan that supports at least 11 widgets

#

Originally we looked at implementing this via Subscription Schedules, however that would require a larger time commitment that there was some hesitation on.

One alternative idea might be to listen for invoice.payment_succeeded events from recurring invoices, and then do an upgrade off of that immediately after the recurring invoice goes through

knotty jasper
#

Yes that's a change you would need to make on the Subscription prior to when the recurring Invoice is generated.

#

You can customize how many days in advance that webhook event fires in your Dashboard

fossil blade
#

Yeah bismarck pointed out that event, the only concern there was keeping the subscription change in sync with the many changes the customer can make throughout the rest of their billing cycle

knotty jasper
#

You could then trigger your determination and update the Susbcription

#

I'm not sure I follow. Can you be more concrete, maybe provide an example, of the situation you are concerned about?

fossil blade
#

Sure, we don't want to upgrade them until the recurring invoice (or afterwards in the next billing cycle) so if we were to use the invoice.upcoming event we'd be using Subscription Schedule to schedule a change just for their widget subscription item. Our subscriptions tend to have between 3-7 subscription items, and customers regulaly update other subscription items, so we'd need to propagate those immediate subscription item updates to the subscription schedule. Definitely possible, just was more of a concern with the time crunch we have

knotty jasper
#
  1. I thought we were still talking about Subscriptions only, not schedules
  2. If you update after the recurring Invoice has been generated, you can use prorations to append the new item to the next Invoice, or you can generate an additional invoice. But you cannot update the Invoice already generated.
fossil blade
#
  1. Yeah just wanted to clarify why we wouldn't use just subscriptions in the invoice.upcoming case
  2. Gotcha, thanks for the explanation. We'll likely plan to generate a new invoice associated with a subscription update after the recurring invoice goes through

I appreciate the explanations and patience

knotty jasper
fossil blade
#

Thanks!

knotty jasper
#

Sure thing! Happy to shed what ๐Ÿ’ก I can ๐Ÿ™‚