#eugene-donations
1 messages · Page 1 of 1 (latest)
hi! It depends a little how exactly you'll be integrating(using Checkout, or PaymentIntents directly)
Easiest way is to use Checkout?
it is yes!
if you want the amount to be flexible then you could ask the customer before redirecting to Checkout what amount they want to pay, and then pass the appropriate Price object in your code to the CheckoutSession.
in
\Stripe\Checkout\Session::create() ?
now it is like this with fixed price
'line_items' => [[
# Provide the exact Price ID (e.g. pr_1234) of the product you want to sell
'price' => 'price_1KaIlnAUfA2l2EsjO9zOPjx9',
'quantity' => 1,
]],
Do i need to create list of prices for it?
Or I can use somehow amount itself?
yep, so there's two options
you could create a set of Price objects in advance, and then based on what the user picks on the frontend, pass the appropriate price_xxx to that call
or you could read user input (like a number) on the frontend directly and then create a Price ad-hoc for that amount by using https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items-price_data
Oh I see, thanks!