#NotMe
1 messages · Page 1 of 1 (latest)
Stripe Checkout allows that out of the box. You just use:
custom_unit_amount: { enabled: true, },
Docs here: https://stripe.com/docs/payments/checkout/pay-what-you-want?dashboard-or-api=api
If you want to use something other than Checkout, then you'll need to create your own custom form for accepting input and creating an amount on the fly. This would occur before a Price object is created.
great I was able to acheive that now 1 more thing can I also change this name variable to be custom every time? Like i will know what name to put in here before I create checkout so like we configured price can we also configure string to show a specific name here?
That's the description in Checkout right?
yes
You could just do string interpolation when the Checkout Session object is created, no? The description (I believe) defaults to the Product name and description if you don't supply anything, so that's an option too
okay so I dont keep any product description and while I create checkout object I can do something to set description?
Where are you setting the description currently?
Ah, apologies. I thought it showed the description, but it only shows the name (just repro'd to confirm)
Let me try one other thing real quick. I could've sworn it defaulted to the Product description
👋 Hopping in here to help - @broken yoke If you want to customize that description for every single Checkout Session then I'd recommend using in-line prices/products with Checkout Sessions. The way to do this would be to not create Product/Prices up front and instead set line_items[][price_data][product_data][name] (https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items-price_data-product_data-name) to what you want
hmm @obtuse violet that means for every checkout there will be separate product created right?
Yeah, that's the tradeoff you would have to make - you get more flexibility ver that product name but you'd end up with a lot of one-time products because a new one is being created each time
An alternative that may fit your needs is custom text (https://stripe.com/docs/payments/checkout/customization#add-custom-text) - if you want to reuse the same product repeatedly you can leave the product.name to be pretty generic and then specify custom text near the "Submit" button to give details that you can customize per-session
Got it thanks I will check these and get back to you