#oguzgbilir-elements
1 messages · Page 1 of 1 (latest)
When you say 'get the client ID' do you mean the Customer ID?
https://stripe.com/docs/api/customers/object#customer_object-id
Or do you mean the Client Secret?
https://stripe.com/docs/api/payment_intents/retrieve#retrieve_payment_intent-client_secret
Sorry, I meant client secret
Why can't you set the amount of the Payment Intent before creating the Customer and Payment Method?
Currently what I do with card element is , I am sending a post request and queryy to get amount that the buyer and seller agreed on, and paymentintent is created instantly. I get the client secret as response. However, when I tried to use payment elements, client secret is required by stripe before the checkout component is rendered when there is no agreement or price info. I can use get request as explained by the documents but they used fixed amount. (P.S. I am beginner level, ı might be asking something silly )
client secret is required by stripe before the checkout component is rendered when there is no agreement or price info
Which method are you using to create the payment element?
Ah, okay. Give me just a few minutes to noodle on this
I am sending the card element and payment element requirements, you will see the difference:
<Elements stripe={stripePromise} options={options}>
<CheckoutForm />
</Elements>
<Elements stripe={stripePromise}>
<CheckoutForm />
</Elements>
as you can see, latter (card element) only requires stripePromise while payment element requires option. (which has client secret in it).
Problem is I can not get client secret without customer submit the amount.
In documents, pre defined price is used in server and client secret is got by a get request.
So at the point in which you create the options hash, your customer still hasn't fully decided on the payment amount?
client secret is a result of a payment. Thus, I can not get a client secret without creating a payment intent.
Ah, so the Client Secret is the result of a Payment Intent, not an actual payment. You can create a Payment Intent without actually charging your cusomer
Payment intent needs amount. I can not create a payment intent without knowing the amount.
In docs they create payment intent with a fixed amount.
You can update the Payment Intent amount after creation as long as it is still in an open status. Just make sure you pass capture_method: 'manual' so that Stripe does not automatically attempt to charge the Payment Method on creation.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
So am I getting correct ? I will make a fake payment inten in server. by typing some ampunt. Then, I will use get request in app.js and get client secret. I will use that client secret to render checkout page. Then, when customer uses the payment element, ı will create the real payment intent by a post request to server and will get the latest client secret and use it for the payment processing ?