I have a form that works to take a user’s credit card information, get their billing address, verify them, and send it to the backend to store this on their customer profile.
When I use one of the square API test values for error states, such as
cvv: 911, I get an error server side when I attempt to store the card on the customer. The error is always the same, regardless of which test value I use.
Is there a way to get a more descriptive error detail than the method I am using?
At this time the Cards API doesn’t provide a more descriptive error messaged as to why it failed to create the card on file. We’re constantly working to improve our features based on feedback like this, so I’ll be sure to share your request to the API product team.
Thanks for your reply
Is there any workaround I can use for now? I run on a subscription model, so all payments are done by card on file.
At this time there isn’t a workaround for a more detailed error message.
Fair enough. Is there any way I can tell the user something is wrong with their card without specifying what?
I’m currently using
card.setError(s) for each
["cardNumber","expirationDate", ...], so each field has an error. This ends up leaving just an error message saying something is wrong with the card.
You’ll want to obfuscate the error to something like:
The card information you entered was incorrect. Please double check the card number, expiration date, CVV, and postal code are correct and submit.
Can I set a custom error message on the webpaymentssdk card element?
This error wouldn’t be at the Web Payments SDK level. It’s the server side call to
CreateCard. You definitely have access to that so you can add your customer error message.