#nico-thsler_api

1 messages ¡ Page 1 of 1 (latest)

tawny meteorBOT
#

👋 Welcome to your new thread!

⏱️ We automatically close idle threads, which makes them read-only. Make sure you stick around to chat in realtime!

🔗 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/1211972141533106276

📝 Have more to share? You can add more detail below, including code, screenshots, videos, etc.

⏲️ 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. Thank you for your patience!

rocky waveBOT
tall summit
#

hi! not sure I follow. What "items" are they? what does your existing code look like? What Stripe API do you use to process the payment?

safe lagoon
#

with items i mean products/prices.

#

I dont think the existing code should be relevant for this question

tall summit
#

it is a little, since for example if you process the payment using a raw PaymentIntent, that does not accept Prices/Products

#

if you're using Invoices or CheckoutSessions, you'd simply pass the Prices/Products to those so I don't see where the issue would be, so I'm overall a little lost on your question

safe lagoon
#

i dont want to process the payment, i just want a calculated total for given products and quantities

#

so we have our own checkout page, where you can select an amount for some predefined products and we want a "total price preview"

tall summit
#

hmm. Can't you just do the multiplication in your code easily? Ultimately the 'shopping cart' is not part of Stripe, it's part of your own e-commerce software

otherwise, you can pass lines to https://docs.stripe.com/api/invoices/upcoming to get a preview Invoice. But to me this is all just logic I'd build in my own site really

safe lagoon
#

well that endpoint doesnt accept recurring prices.. so its not applicable for us

#

but i will discuss that with my team again, I also think its best to just calculate it by ourself

tall summit
#

really it doesn't? I'm fairly certain it does, it's for previewing subscriptions

#

but yeah I mean I don't understand why you don't just do the multiplication

safe lagoon
tall summit
#

you say you already have "[your] our own checkout page, where you can select an amount for some predefined products" so the total is just sum(each price * each quantity)

safe lagoon
tall summit
safe lagoon
#

req_kj4aRce8urIz2t

tall summit
safe lagoon
#

but its a requirement by our stakeholders to display the total amount in our own page...

tall summit
safe lagoon
#

i'll look into it

#

but looks like it could be what we need

tawny meteorBOT
safe lagoon
#

it appears that I cannot input a price that is already existing in that subscription. I need to update the amount of a given price in that subscription and need the total amount before to display it in our checkout.
Request ID: req_4iJyGuvT5HuMR0

little owl
#

I need to update the amount of a given price
What do you mean by 'update the amount'? The unit amount or the quantity?

safe lagoon
#

the quantity, sorry

little owl
# safe lagoon the quantity, sorry

OK, so the payload of this request (https://dashboard.stripe.com/test/logs/req_4iJyGuvT5HuMR0) is attempting to add a new item. You need to include the id parameter in your payload that maps to the si_xxx ID you want to update the quantity of: https://docs.stripe.com/api/invoices/upcoming#upcoming_invoice-subscription_items-id