How to get value of woocommerce stripe payment fields via jquery when I hit complete payment button?
I want to get this data and will show last 4 digits in preview page.
Remember woocommerce stripe payment gateway form is integrated in iframe. Here is the iframe code
<iframe frameborder="0" allowtransparency="true" scrolling="no" name="__privateStripeFrame5" allowpaymentrequest="true" src="https://js.stripe.com/v3/elements-inner-card-6bc25d089c2cb94ef6e5f6c7d596d25f.html#style[base][iconColor]=%23666EE8&style[base][color]=%2331325F&style[base][fontSize]=15px&style[base][::placeholder][color]=%23CFD7E0&componentName=cardNumber&wait=false&rtl=false&keyMode=test&origin=http%3A%2F%2Frizwankhan.co&referrer=http%3A%2F%2Frizwankhan.co%2Ftraining%2Fcheckout%2F&controllerId=__privateStripeController1" title="Secure payment input frame" style="border: none !important; margin: 0px !important; padding: 0px !important; width: 1px !important; min-width: 100% !important; overflow: hidden !important; display: block !important; height: 18px;"></iframe>
and here is the "Card Number" Field
<label class="Input" data-max="4242 4242 4242 4242 4240">
<input type="tel" autocomplete="cc-number" autocorrect="off" spellcheck="false" name="cardnumber" class="InputElement is-empty" aria-label="Credit or debit card number" placeholder="1234 1234 1234 1234" aria-placeholder="1234 1234 1234 1234" aria-invalid="false" value="">
</label>
I have tried this
jQuery('input.InputElement').val();
and this
jQuery('iframe[name=__privateStripeFrame5]').contents().find('input.InputElement').val();
and this
jQuery('iframe').contents().find('input.InputElement').val();