#Sergio Sánchez
1 messages · Page 1 of 1 (latest)
Hello Karbi again
When you set up your PaymentElement did you specificy the client_secret up front? Or are you setting a bunch of options and creating the intent later?
const options = {
clientSecret
};
console.log('options', options);
return (
<form onSubmit={handleSubmit}>
<PaymentElement onReady={onReady} options={options} />
<button type="submit" disabled={!stripe || !clientSecret}>
Submit
</button>
{errorMessage && <div>{errorMessage}</div>}
</form>
);```
up front, I have double check that the PaymentElement is not redered until having the clientSecret ready provided by the payment Intent
which looks like pi_3NAc1dIzcid8RrBH2SPSHbZg_secret_q1MNRjIaiIu8oAz7ow3SMqY3z
let me hardcoded this just in case
still the error
after that in the submit I am doing this:
if (submitError) {
handleError(submitError);
return;
}
const { error } = await stripe.confirmPayment({
// `Elements` instance that was used to create the Payment Element
elements,
clientSecret,
confirmParams: {
return_url: 'https://example.com/order/123/complete'
}
});```
so my question mainly are, why I need to pass the clientSecret in the confirmationPayment if it has already provided to the PaymentElement
and even providing the client secret, why I get the error of "The provided capture_method (manual) does not match the expected capture_method (automatic). Try confirming with a Payment Intent that is configured to use the same parameters as Stripe Elements."
do I need to specific capture_method to the confirmPayment or to the PaymentElement
I guess I detect it , I am passign the options to the PaymentElement instead to the Root one (Element)
🫣
Aha! I was just about to write that I was surprised you saw that kind of error if you were passing in options w/ clientSecret
sorry for that! my mistake here....
Also a really quick thing I want to point out - if you're proving clientSecret up front then you don't need to re-provide it when you call confirmPayment
great! that is what I expected
thanks again karbi for your time
I will test it now propelry
👍 happy to help!