#LUKE-checkout
1 messages ยท Page 1 of 1 (latest)
Hello! Starting up a thread for you
I don't believe there's a great way to do this - is there any way for you to use a one-time price with an exisiting product instead of a one-time product?
the problem is that depending on the quantity the price decreases, I don't see any way to do this using a one-time price
just using a subscription it seems to be possible
currect me if I'm wrong ๐
Basically I would need Volume Pricing I guess
Can you clarify "depending on the quantity the price decreases"
so for example if a customer wants to purchase 5 units of a product it would cost 10โฌ per unit. If he wants to buy 20 units the price decreases to 8โฌ
per unit
I guess this would be the 'Volume Pricing' option
but as far as I can see it's only possible with a subscription
Gotcha - yeah tiered pricing is only doable with recurring prices. How are you correcting for this with one-time products though?
I'm using a one-time product along with a one-time price, the price in cents per unit is declared in our database
stripe_session = stripe.checkout.Session.create(
success_url="https://example.com/thankyou",
cancel_url="https://example.com/cancel",
line_items=[
{
"price_data": {
"currency": "eur",
"product_data": {
"name": f"{amount} x {selected_variant_info['variantName']}",
},
"unit_amount": unit_amount,
"tax_behavior": "inclusive"
},
"quantity": amount,
"adjustable_quantity": {
"enabled": False
},
},
],
mode="payment",
automatic_tax={
'enabled': True,
},
billing_address_collection= 'required',
allow_promotion_codes=True,
metadata=metadata
)
this is the code for creating the session, it might be easier to understand than describing it ๐
Are you working with a set number of variants? You could create a Product for each variant and pass those in as product instead of setting product_data
that's actually an amazing idea
I will try it and let you know
but it should work I guess
๐ that'll allow you to configure coupons to only work with certain products and should get you what you want
is there a way to do this while still setting a custom product name like above?
I mean this part: "name": f"{amount} x {selected_variant_info['variantName']}",
Okay never mind it's not possible
but still this should be a good workaround for my problem thanks ๐
Yeah you lose the ability to customize the name
Okay well that's not a big deal, thank you so much for your help. You saved me a lot of work ๐