#ironbeard-subs
1 messages ยท Page 1 of 1 (latest)
Heyo ๐
With our webhook events we don't guarantee order - see https://stripe.com/docs/webhooks/best-practices#event-ordering
Gotcha gotcha, that makes sense. Thanks ๐
Kind of different, but could you explain the meaning of this error? req_ole2cpeVn0WVDB
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
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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?
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
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
Adding the subscription item ID should also fix the error
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.
Can you show me a screenshot of what the upcomig invoice looks like?
sure one sec
I assume it means my SubscriptionSchedule was incorrectly formed.
It should have been
- get
sub_schedusingfrom_subscription. - send
stripe.SubscriptionSchedule.modifywherephases[0]is justphase[0]from thesub_schedin step 1, and andphases[1]is only the initial price, with no start/stop date and setiterations=1.
Which items from the above screenshot are you not expecting to be there? All the proration ones?
I thought the upcoming invoice would just be "Perryman Economic Forecast: Major Texas Metros"
only the $950 price
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?
yeah
Or, that's what my intention is
Trying to kind of implement a "cancel_at_period_end" type behavior for individual SubscriptionItems
Just to try something out - what response do you get when you call the upcoming Invoice API with the schedule ID (https://stripe.com/docs/api/invoices/upcoming#upcoming_invoice-schedule)?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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.
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
Ha, sorry to worry you! The invoice is a bit more verbose than I'd like, but it's correct now