/ Published in: Rails
Supported brands
name | key
-----------------------
American Express | :amex
China UnionPay | :unionpay
Diners Club | :diners
Dinner Club US | :diners_us
Discover | :discover
JCB | :jcb
Maestro | :maestro
MasterCard | :mastercard
Solo | :solo
Visa | :visa
name | key
-----------------------
American Express | :amex
China UnionPay | :unionpay
Diners Club | :diners
Dinner Club US | :diners_us
Discover | :discover
JCB | :jcb
Maestro | :maestro
MasterCard | :mastercard
Solo | :solo
Visa | :visa
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#add gem 'credit_card_validations' to Gemfile class CreditCard < ActiveRecord::Base validates :number, presence: true, credit_card_number: {brands: [:amex, :maestro]} end
URL: https://github.com/Fivell/credit_card_validations