#nash-StripeJS-error
1 messages ยท Page 1 of 1 (latest)
Hi there ๐
Hm, I don't think I've seen this error before. When you actually try to run the code, is /* PI intents secret*/ replaced by the actual client secret value?
๐ yup
Is it possible it's because I'm creating the intents using the CLI and pasting it in there?
ie stripe payment_intents create --amount 100 --currency eur
But I don't think that should matter, because I would be creating it on the server anyway.
Yeah, I wouldn't expect that to make a difference as long as the formatting for the value is correct. How are you including the Stripe JS library on your page?
yeah
Just took the code out into its own js html to remove noise.
And it seems like it does that with const cardNumber = elements.create('cardNumber')
But not with const paymentElement = elements.create('payment');
The warning is displayed on the mount call, not on the create call cardNumber.mount("#cardnumber")
But doesn't happen when I create and mount a 'payment'. Just cardNumber.
I haven't tested this flow extensively, but I think this is happening due to the difference in the card element and payment element flows. When using the payment element you need to provide the clientSecret while initializing elements, but for the card elements you provide it during the confirmation calls.
aha
Interesting.
Why would one go the cardNumber, etc.. route vs. the 'card' route?
Is it just more control over the form?
Yup, exactly. The card element is an all-inclusive element, but sometimes users prefer to have more control over their layout so they'll use cardNumber, cardCvc , and cardExpiry elements to place the fields more separately.
Awesome. Thank you. Will work with the modified confirmPayment call.
Any time, happy to help ๐