#JoeAdroit
1 messages · Page 1 of 1 (latest)
Are you getting a specific error?
So I get null now when trying e.g.
const cardElement = elements.getElement('cardNumber');
or 'elements.getElement('card');
Did you successfully create and mount the card element elsewhere in your code?
Here's a step-by-step guide on how to do that: https://stripe.com/docs/payments/card-element
Reviewing, thanks!
Looks to be matching example, but getting this error.
"Invalid value for createPaymentMethod: card was payment Element, which cannot be used to create card PaymentMethods.","name":"IntegrationError"}
I'll continue reviewing
So it sounds like you're actually using the Payment Element (not the card element). This is the guide for the Payment Element specifically: https://stripe.com/docs/payments/quickstart
Ah, example uses confirmCardPayment, I'm trying to use createPaymentMethod
Prior it worked when I was using older form with var cardNumber = elements.create('cardNumber')
Now using paymentElement = elements.create('payment')
Sorry if missing, but not seeing how to use confirmPayment in custom payment flow
It's in step #3 of the quickstart I posted under Complete the payment
You shouldn't need to create the Payment Method explicitly if you're using the Payment Element via the guide I just sent you
So it's a custom implementation on Drupal 6. It needs to run some server side validations prior to authorization, which is why I want to move to server side, but missing payment method after validations.
You said you want to move to server-side, but confirmPayment is a client-side method. So what are you hoping to do and what are you trying to use to do it?
Right, I don't want to use confirmPayment. I'd like to attach payment method to intent when user submits.
attaching payment can be either server or client side. Just not sure how to do since switching to Payment Element (client-side)
That's exactly what confirmPayment does. It will redirect the customer to authenticate via 3DS (if needed), and upon completion, it will add the newly created Payment Method to the Payment Intent that was created earlier in the process. Really this exact use-case is entirely outlined in the guide, so where are you getting hung up specifically?
I guess I could just hack submit to run Drupal Validation via AJAX, then on success run confirmPayment :/
What specific validation are you trying to do?
Things like store credit validation, shipping , inventory, cost check
Is it possible to do all of that before presenting the payment form?
No, customers sit on checkout and or return and our inventory changes rapidly
Some Dropship so dependent on API checks
Couldn't you simply do a fetch() to the server for that validation before calling confirmPayment()?
Yup, thats what I'm doing now
Is that working?