My app takes Stripe card payments and can operate in test mode where you are always inserting the same card number.
Is there any way in Javascript or dmx to auto-insert that number into the card number field? The HTML doesn’t have an id so I’m not sure how you can uniquely recognise it!
Hi.
Isn’t the card number field generated in run time? When Stripe renders the checkout form on your page?
I don’t have much experience with this, I just use Stripe Checkout page, so could be wrong here.
But if the inputs are being rendered, you will have to use JS to set the value in the dynamically created field.
I would be able to give you a code snippet if you can share the HTML rendered for checkout.
But the concept is to identify the input field based on its id or classes, and set the value then.
Based on the code in your question, a jQuery JS code could be like:
Another part would be to figure out, when to call this. I am not sure if there are any events when checkout form gets rendered. But if its there, you can set this JS there.
If not, you can use a set timeout function to delay running the above JS code for few milliseconds while checkout form renders.