#ironbeard-subs

1 messages ยท Page 1 of 1 (latest)

hollow birch
#

Hello!

civic nest
#

Heyo ๐Ÿ™‚

hollow birch
civic nest
#

Gotcha gotcha, that makes sense. Thanks ๐Ÿ™‚

civic nest
#

Kind of different, but could you explain the meaning of this error? req_ole2cpeVn0WVDB

hollow birch
#

That subscription already is subscribed to price price_1L84IlCoTIfwbn28JgsLcwyz, so it's unable to add it to the subscription again. Are you trying to add an additional subscription item with the same price, or are you trying to update the existing one? If you're trying to update the existing one, you need to be sure to also pass in the sub item ID in your update request - https://stripe.com/docs/api/subscriptions/update#update_subscription-items-id

civic nest
#

I was trying to add a Price/SubscriptionItem to an existing subscription. The price I was trying to add was price_1L84J2CoTIfwbn28T7ZemEQM, the price that was already on the Subscription is price_1L84IlCoTIfwbn28JgsLcwyz

#

oh, but I guess in my request to modify the Subscription, it also included the initial price again?

hollow birch
#

Do you need to make any changes to the price_1L84IlCoTIfwbn28JgsLcwyz price? If it's staying the same I don't think you need to include it in the update request

civic nest
#

No changes to that initial price. It's really just included in the update request because it's stored in my db. I wonder if including the SubscriptionItem ID would fix the error (the quantity doesn't change or anything), or if I need to find a way to filter out the already existing SubscriptionItems in my update request

hollow birch
#

Adding the subscription item ID should also fix the error

civic nest
#

Seems like including the SubscriptionItemID fixed it, yeah. The SubscriptionItem ID never got set on my DB because I do that in the customer.subscription.updated webhook, which failed previously.

#

Final question:

So I successfully added the second price to the subscription referenced below.

I then triggered some "cancel_at_period_end" logic I coded for SubscriptionItems, which uses SubscriptionSchedules and aught to keep the second item ("Victoria MSA" price) until the next billing cycle, and then the subscription will go back to just being the initial price ("Major Texas Metros").

The Subscription ID is: sub_1L84OSCoTIfwbn28DFi1mfBB

I see the "Upcoming Invoice," but it's a bit more complicated that I expected. I thought it would only have "Major Texas Metros" on it.

hollow birch
#

Can you show me a screenshot of what the upcomig invoice looks like?

civic nest
#

sure one sec

#

I assume it means my SubscriptionSchedule was incorrectly formed.

It should have been

  1. get sub_sched using from_subscription.
  2. send stripe.SubscriptionSchedule.modify where phases[0] is just phase[0] from the sub_sched in step 1, and and phases[1] is only the initial price, with no start/stop date and set iterations=1.
hollow birch
#

Which items from the above screenshot are you not expecting to be there? All the proration ones?

civic nest
#

I thought the upcoming invoice would just be "Perryman Economic Forecast: Major Texas Metros"

#

only the $950 price

hollow birch
#

Ahhh, so you're saying because the schedule should be removing the $250 price in the next phase it shouldn't be in the upcoming invoice, right?

civic nest
#

yeah

#

Or, that's what my intention is

#

Trying to kind of implement a "cancel_at_period_end" type behavior for individual SubscriptionItems

hollow birch
civic nest
#

one sec

#

The amount due is still 1,200 (two Prices)

#

Yeah, it lines up with the screenshot it seems

#

I think I might have created an incorrect SubscriptionSchedule

#

Yeah, that was it.

hollow birch
#

phew - that's good to hear

#

i know in the past there were some rough edges with schedules + upcoming invoice so I was worried that it was a bug

civic nest
#

Ha, sorry to worry you! The invoice is a bit more verbose than I'd like, but it's correct now