CVC & Expire do not validate immediately

476 views
Skip to first unread message

Brian Park

unread,
Nov 26, 2014, 3:07:43 PM11/26/14
to api-d...@lists.stripe.com
Hello everyone,

I was wondering if I could bother you guys for a quick Stripe question that's
driving me nuts.

I implemented the custom form version of stripe and everything seems to
work fine. The fields that I have are card number, cvc, expire date and zip
code. Pretty basic. My question is I noticed that only an incorrectly typed
in card number gives the user an error message right away. The other fields
eventhough they are typed incorrectly do not give the user an immediate
error message. Obviously this is a problem because I have to contact the
user after-the-fact and tell them their card did not go through.

Can you give me any kind of direction and advice on how I can fix this? I'm
fairly a newbie and I've been pouring over api docs with no success.

Thank you for your help in the past. It is much appreciated!
Brian

Matthew Arkin

unread,
Nov 26, 2014, 3:13:09 PM11/26/14
to api-d...@lists.stripe.com
Hi Brian,

Stripe.js doesn’t actually test the card against the card networks, it just makes sure that the inputs are valid (so the cvc is 3 or 4 digits, expiration is in the future, and the card passes the luhn check).

If they typo their card number it will likely fail a luhn check hence Stripe.js will catch it.

Normally as soon as you get a card number you are gonna want to either make a charge or save it to a stripe customer. (Since tokens are only guaranteed for 5 minutes).

When you save a card to a customer, Stripe does check it against the card networks and will error if something is wrong. With this error you can then tell your customer to refill out their credit card form.

Checkout.js can be configured to actually test the card against the card network. All you have to do is set an “amount” in Checkout and it will do the checks for you. Note however that when you try to charge the full amount, the charge may still be declined. 

--
Matt Arkin
Kollective Solutions

--
You received this message because you are subscribed to the Google Groups "Stripe API Discussion" group.
To post to this group, send email to api-d...@lists.stripe.com.
Visit this group at http://groups.google.com/a/lists.stripe.com/group/api-discuss/.

To unsubscribe from this group and stop receiving emails from it, send an email to api-discuss...@lists.stripe.com.

Brian Park

unread,
Nov 26, 2014, 5:15:44 PM11/26/14
to api-d...@lists.stripe.com
Thank you Matt. 

Little confused about your last statement regarding Checkout.js  "Note however that when you try to charge the full amount, the charge may still be declined. "

Can you elaborate a little more? 

Brian

Matthew Arkin

unread,
Nov 26, 2014, 5:19:33 PM11/26/14
to api-d...@lists.stripe.com
When you pass an amount to Checkout.js, Stripe will validate the card against the card networks. Normally this is a $1 authorization that quickly falls off the credit card statement. 

If you were to then do a $10 charge, the credit card company may still decline the charge because it will go past their credit limit, they suspect a fraudulent purchase, or some other reason that the bank decided to decline the charge.

I have a client that every time they attempt to pay me they have to end up calling their bank to authorize the charge, banks can be weird.

--
Matt Arkin
Kollective Solutions

Brian Park

unread,
Nov 27, 2014, 10:55:31 PM11/27/14
to api-d...@lists.stripe.com
Matt when you're talking about Checkout.js, are you referring to Stripe's "Checkout" feature? Or are these two separate things? 

Matthew Arkin

unread,
Nov 27, 2014, 10:56:32 PM11/27/14
to api-d...@lists.stripe.com, api-d...@lists.stripe.com
Yes Stripe Checkout (I tend to refer to it as checkout.js as short hand)


Sent from Mailbox

Brian Park

unread,
Nov 27, 2014, 11:00:38 PM11/27/14
to api-d...@lists.stripe.com
Thank you for the clarification. However  what if I'm not using stripe's "Checkout" and instead building a custom form...etc. How can I then have cvc and zip code validation like we were talking about earlier? 

Matthew Arkin

unread,
Nov 27, 2014, 11:02:57 PM11/27/14
to api-d...@lists.stripe.com, api-d...@lists.stripe.com
It would happen when you attach the card to the customer or when you charge the card. The only validations you could do client side is making sure the cvc is 3 or 4 digits and ensuring the expiration is some month/year in the futurr


Sent from Mailbox

Brian Park

unread,
Nov 27, 2014, 11:09:26 PM11/27/14
to api-d...@lists.stripe.com
Yes I want cvc to validate against the network on client side. I want it to do more than just see if it's any number but I want it to match the card. So I'm guessing this cannot be done? 

I see it works for Checkout but once again I'm not using Checkiut but instead building my own form.

Am I misunderstanding something? 

Matthew Arkin

unread,
Nov 27, 2014, 11:11:27 PM11/27/14
to api-d...@lists.stripe.com, api-d...@lists.stripe.com
I believe client side validation against the card networks can happen with Stripe.js if you email support. It does not happen by default. With checkout.js it easily happens.


Sent from Mailbox

Brian Park

unread,
Nov 27, 2014, 11:13:23 PM11/27/14
to api-d...@lists.stripe.com
What do you mean by "email support"? Thank you for your patience. 

Matthew Arkin

unread,
Nov 27, 2014, 11:14:35 PM11/27/14
to api-d...@lists.stripe.com, api-d...@lists.stripe.com
Email sup...@stripe.com and ask them. By default, Stripe.js doesn't do it but I've heard whispers that it can do it


Sent from Mailbox

Brian Park

unread,
Nov 27, 2014, 11:29:43 PM11/27/14
to api-d...@lists.stripe.com
Will do. Thank you
Reply all
Reply to author
Forward
0 new messages