#.abishek
1 messages · Page 1 of 1 (latest)
When you say "set the price", do you mean passing an amount, currency, etc, instead of a price ID?
yes
You can pass line_items.price_data instead: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items-price_data
is it always priceId or custom amount? can I not pass both?
Right, you'll either use line_items.price or line_items.price_data, not both
well, per line item.
ok that helps. I am going to use price_data, but is there no way to add line item specific discounts there on price_data?
because we have our own coupon functionality and we want to pass the discount amount to the checkout page
Ah, I see. Not exactly. The only way to do this is to configure coupons on Stripe that apply to a given product(s), and use that product ID when passing line_items.price_data
It sounds like you'll likely want to calculate the discount prior to creating the Checkout Session
yes, the reason we do that is because we offer multiple payment options, so they can select any and we want the discount to be calculated before they come to the checkout page on stripe.