title: Catching specific error on Stripe PHP to display custom message
body: <p>I have a Stripe payment gateway with the credit card details to input.</p>
  
  <p>It is working fine but there is one error message that I don't like but I am not advanced enough in PHP to fix this.</p>
  
  <pre><code>function stripeResponseHandler(status, response) {
              if (response.error) {
                  // Enable the submit button
                  $('#payBtn').removeAttr("disabled");
                  // Display the errors on the form
  
                  $(".payment-status").html('&lt;p&gt;'+response.error.message+'&lt;/p&gt;');
  
              } else {
                  var form$ = $("#paymentFrm");
                  // Get token id
                  var token = response.id;
                  // Insert the token into the form
                  form$.append("&lt;input type='hidden' name='stripeToken' value='" + token + "' /&gt;");
  
                  // Submit form to the server
                  form$.get(0).submit();
              }
          }
  </code></pre>
  
  <p>This is catching the errors and displaying response.error.message</p>
  
  <p>These errors are great with the exception of if you write a bunch of numbers into the expiry instead of mm/yy.</p>
  
  <p>the error returned is:</p>
  
  <blockquote>
    <p>The 'exp_year' parameter should be an integer (instead, is
    20undefined).</p>
  </blockquote>
  
  <p>I don't know enough about this language but I want to catch this specific error and just say something like "The expiry date is incorrect, please enter as MM/YY"</p>
  
  <p>I tried doing an if statement to read response.error.message but I didn't know how to format well. I tried also finding an error.code instead of message to use however the code invalid_number comes up but if I use this in an IF statement it refers to all invalid numbers of all fields (including card number) so my expiry statement is obviously incorrect in this situation!</p>