#invisible-poles_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ 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.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ 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/1295438087098466355
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- invisible-poles_connect-funds-flows, 12 minutes ago, 70 messages
Because Products don't have an amount associated with them, Price objects are what tell us how much to charge and in what currency
If you use SessionCreateParams.LineItem.Price instead of PriceData you can just pass the price ID that you created before.
Oh whoops I may have misread that and you may not be creating Price object
Correct, no worries.
basically I created a product
and I want my checkout to use that product
and the issue isn't setting the product (that seems to work fine)
the issue is that after calling .setProduct(), I have to also call .setCurrency() and .setUnitAmount() for the PriceData builder. But I already provided both of these thigns when I made the product
Can you send me the product ID from a product that you set that on? Products don't have amounts or currencies, so you may have used some parameter that automatically creates a Price object
is there any way to just use the Product's Price information as ground truth?
prod_R1vo1sgnl99Q6L
I see it has a price associated with it
and it's probably because of that 2nd screenshot -- I used the DefaultPriceData builder
Ah there we go, I see you created a default price in your creation request
https://dashboard.stripe.com/test/logs/req_yfuP0xxIFZP9Ep
So what your code will want to do is get the price_ ID from default_price.id in the object that is returned by that call when you make it, you can then pass that ID to the SessionCreateParams.LineItem.Price field that I mentioned earlier
I am not as familiar with our java syntax but can help figure more out about what that would look like if you are having trouble translating
so basically, I should just save the price id as well as the product id
while that's fine, that seems like unexpected behavior
I forget how exactly default prices work but this is definitely how manually passing price IDs is expected to work. Looking in to that and will get back to you.
seems like I'll have to do another API call then (or I save the created price object's id)
but then it makes me wonder, what's the point of specifying the default price?
Yep, that is what I am trying to figure out. I didn't find a mention in our docs about what the default does so I have reached out to colleagues
will get back with what we can find
it also seems easier to just manually respecify the price as I did in my screenshot above (since our systems also store the intended price).
any reason to not do that?
It looks like that default field is only used by our dashboard to prioritize the price when doing things like creating PaymentLinks
If you are making charges at the same amount it is typically reccommended to use the actual price object. The reason mostly being that it makes certain things easier like searching for Checkout Sessions that used the price or running certain reports
I see. wish there was a way to just directly reference that price without needing to also save the price object id
but fair enough
that answers my questions
thanks
actually
wait one more question
how do I set the product when I directly use the price?
You don't need to, Prices can only be assosciated with one product so we know to use the product ID that is assosciated with the price
oh I see -- so if I make a promo code for a specific product only, it should only work for checkouts with that product?
even if I don't pass in the product id?
Correct, we check if the price is for that product and that is what determines if the coupon can be applied