#JoeAdroit

1 messages · Page 1 of 1 (latest)

cedar axleBOT
frigid yoke
#

Are you getting a specific error?

silver adder
#

So I get null now when trying e.g.
const cardElement = elements.getElement('cardNumber');

#

or 'elements.getElement('card');

frigid yoke
silver adder
#

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

frigid yoke
silver adder
#

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

frigid yoke
#

You shouldn't need to create the Payment Method explicitly if you're using the Payment Element via the guide I just sent you

silver adder
#

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.

frigid yoke
#

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?

silver adder
#

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)

frigid yoke
#

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?

https://stripe.com/docs/payments/quickstart

silver adder
#

I guess I could just hack submit to run Drupal Validation via AJAX, then on success run confirmPayment :/

frigid yoke
#

What specific validation are you trying to do?

silver adder
#

Things like store credit validation, shipping , inventory, cost check

frigid yoke
#

Is it possible to do all of that before presenting the payment form?

silver adder
#

No, customers sit on checkout and or return and our inventory changes rapidly

#

Some Dropship so dependent on API checks

frigid yoke
#

Couldn't you simply do a fetch() to the server for that validation before calling confirmPayment()?

silver adder
#

Yup, thats what I'm doing now

frigid yoke
#

Is that working?