#Vinz
1 messages ยท Page 1 of 1 (latest)
Hi ๐ how can we help?
I have an existing subscrition with products prices
I want to let user to update it
I want user to know new price (of course)
So I send :
return stripe.Invoice.upcoming( # Retrieve next invoice.
customer=stripe_customer_id,
subscription=stripe_subscription_id,
subscription_items=subscription_items,
subscription_proration_date=int(datetime.datetime.timestamp(proration_date))
)
but I receive Request req_YtTmOryitdBSPh: Cannot add multiple subscription items with the same plan: price_1MWiBSIP6C7BiREF07m9
Or, if I delete the subscription argument : Request req_vqHle4AHIepx9N: Cannot specify proration date without specifying a subscription
What should I do ? I want to use proration_date to display the date of the next invoice
It sounds like you need to remove one of the duplicate Subscription Items in order for that to work. Have you tried that?
yep, there is no duplicate
in my subscription_items I have
and that's all
Any idea @brittle pond ?
Are one of those Prices already on the Subscription?
yes, that's my point
It is an update of prices existing in subscriptions
of quantities actually
I want to simulate changes
Okay, I see. let me dig a bit and circle back to you
So, a couple things. There error for the request mentioned above (req_YtTmOryitdBSPh) is "Cannot add multiple subscription items with the same plan: price_1MWiBSIP6C7BiREF07m9pizs". Since the Subscription you're attempting to update already has a Subscription Item with this price (price_1MWiBSIP6C7BiREF07m9pizs), you will need to change the quantity on the existing Subscription Item (see: https://stripe.com/docs/api/invoices/upcoming#upcoming_invoice-subscription_items-quantity).
What you're doing now seems to be attempting to add a new Subscription Item with that Price (again price_1MWiBSIP6C7BiREF07m9pizs). So rather than passing:
subscription_items: { 0: { quantity: "10", price: "price_1MWiBSIP6C7BiREF07m9pizs", },
Try passing:
subscription_items: { 0: { quantity: "10", id: "si_abc123", },
where si_abc123 is the actual Subscription Item
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
wooo f*k I don't have it in DB
Let me ask you one more question @brittle pond
Do you think this is a problem I hit the stripe API each time a client hit a plus or minus button to update quantities
I do that in order to have consistent prices
And not one price in my DB and one on stripe
that would be double maintenance if price changes