Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Jmrtech's avatar

Testing stripe payment form

I have a billing form on my registration page and was trying to write a test for the page. I was going to type the test values into my test when I remembered that the stripe items don't have name attributes. I can temporarily add a name attribute for the duration of the test, but wanted to see if anyone else has came across this before and has a solution. Thanks.

0 likes
3 replies
cristian9509's avatar

Why would the names help you in the test? I guess that if you get back a stripe token, then you can access the Stripe API and retrieve the information regarding the token, see if it was already used, etc. I don't think it will help you in anyway to include the names in the form.

Jmrtech's avatar

What I mean is, if I have my form input

<input size="20" type="text" data-stripe="number" class="form-control"/>

Since it doesn't have a name attribute, how can I have the unit test

->type($testCardNumber, 'nameOfCardNumberElement')

Hopefully that makes it clear what I'm trying to achieve

Please or to participate in this conversation.