Lately I’ve had to integrate Stripe a few times and I keep having to visit their test card page over and over to copy and paste failed cards. Today I finally had enough and threw together a little helper that you can add to a Laravel blade file.

<script>
@if (App::environment('local'))
var $el = $("#card-number");
window.stripeData = {
valid: function() {
$el.val('4242424242424242');
},
successAddressFail: function() {
$el.val('4000000000000028');
},
successZipFail: function() {
$el.val('4000000000000036');
},
fail: function() {
$el.val('4000000000000002');
},
failNumber: function() {
$el.val('4242424242424241');
},
failCVC: function() {
$el.val('4000000000000127');
},
failExpired: function() {
$el.val('4000000000000069');
},
failProcessingError: function() {
$el.val('4000000000000119');
}
}
@endif
</script>

view raw
stripe-test.html
hosted with ❤ by GitHub

With this when you view the credit card form you can open console and type stripeData. and have autocomplete of whatever failed message you want to test for.

I know this is super simple but it helped me so I think it’s worth sharing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s