#captainyarb - deleting items
1 messages ยท Page 1 of 1 (latest)
Hello! Just starting a thread for you -- I'll review and respond as soon as I can ๐
Yay! Thanks for your help!
Can you share this request 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.
like req_123
Sure: req_mlcHSsejZxNCHJ
This request is removing all of the items from si_Lq6PtGPSFnRs8Q and adding 8 for price price_0J5cdXF23R9jbzPTp7fSqC2a
Our use case is: addon quantities. We removed all of one quantity and added 8 of another
Hmmm can you try a workaround
Apparently setting quantity: 0 works, but leaves the subscription item... with 0 quantity.
instead of using deleted=true set the quantity=0 during the invoices proration
yea
haha great minds think alike
that's what i was going to suggest
then, once the invoice succeeds/pays, you can do a second request to delete the item
(with no payment impact)
so you can omit the pending if incomplete
uuuuugghhh
is the issue he pending if incomplete or the always invoice?
I'm not 100%, but as I undestand it we need both for our use case.
We need payment_behavior: 'pending_if_incomplete', so that the user must pay first before changes take effect.
We need proration_behavior: 'always_invoice', to ensure the user gets credit for time unused and invoiced for expenses on the change.
Is my assumption wrong here?
Also, this is 9 API requests in one userland request. We're going to run into API limits T_T
#1 get Customer (to validate user session context)
#2 get Subscription (to validate user ownership of session)
#3 get Products (to validate seleceted plan pricing_ids)
#4 update Subscription #1 (to change quantity and prorate)
#5 update Subscription #2 (to delete quantity 0)
extended: if customer has a scheduled change:
#6 get Subscription Schedule
#7 release Subscription Schedule
#8 create new Subscription Schedule
#9 update new Subscription Schedule with reflected changes
We have promotional deals where users can buy 3 months for the price of 2, where we put them back on a monthy subscription afterwards. We noticed that updating the Subscription required us to rebuild that change to reflect the new updates.
Let me review
we're going to move it to the webhook, but that's about best we have
You can consolidate 1+2+3 with expansion:
https://stripe.com/docs/api/expanding_objects
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ie, request the subscriptions included for that customer retrieval
and yes 6-9 re complex due to your use of schedules, which is a complex use cae
but that doesnt have the same invoicing proration/pending effects
so its different complexity
1 & 2, yes we plan to try to reduce this down to 1. #3 is required to get the full list of plans they are also switching to as they have limits defined on metadata for quantity and plan requirements.
#3 will be cached on our end as much as possible anyway ๐
OK then yes, this will involve a number of requests to cover those cases