#geimsdin
1 messages · Page 1 of 1 (latest)
Stripe provides change event in Payment Element and it contains complete field. You can check the complete field to determine if all required data has been filled with potentially valid input: https://stripe.com/docs/js/element/events/on_change?type=paymentElement#element_on_change-handler-complete
Thanks, that is useful
No problem! Happy to help 😄
If "complete" is true it means it is ready to be submitted? Seems the only data I should care about, is that correct?
Yup, complete=true means the required data has been collected
Can I submit the form by the payment element? Somthing like paymentElement.submit... ?
Stripe doesn't provide payment button, so you'll need to use your own button to submit and call stripe.confirmPayment method
I do that but I have some issues
I try to explain: I have to wrap the iframe in a form and then submit that form
It is tricky to access the iframe DOM to place a button inside the payment form
What would you suggest me to do in this case?
How to target the payment form and submit it in js?
where did you place the payment element then? is it in the iframe or in the form?
The payment element is in a form attached to the document, stripe then loads inside it his iframe
Stripe iframe contains another document with the real payment form
i don't quite understand your issue
Let me try to be more specific
I'm creating an integration on woocommerce, woocommerce first submits the order through ajax to check for fields validation and gives me back an event of "checkout success" or "checkout failure", in case of success I check if the payment data is "complete" and if true then I need to submit only the payment form, after the payment form is processed I know if it is succesful and I can proceed validating the order.
If I trigger the submit of the form containing the Stripe Iframe then I trigger also the woocommerce form.
I think I need to submit only the payment form in the iframe
It sounds like you're using nested form. One form in another form. I'm afraid that nested form is not supported by HTML: https://stackoverflow.com/questions/379610/can-you-nest-html-forms
Then I have to move the payment in a modal outside the checkout form
in any case if I cannot submit the payment form in js I need to wrap it in another form
You probably can try it out to test if it works
Nested form is exactly what is suggested in Stripe docs: https://stripe.com/docs/billing/subscriptions/build-subscriptions
Hi @plain holly I'm taking over this thread
Hi Jack
What's your most recent question?
I think I'm lost too but it should start here
Hmm, OK, so what the question?
I have to clear my mind, don't want to waste your time now, I will try some DOM manipulation and if it fails I will write again.
Sure, no problem