Stax.js Validation

If the validate flag is passed into the tokenize or pay methods, StaxJs will attempt to validate the details with the following rules:

method – required, must be ‘bank’ or ‘card’
firstname – required if customer_id is not passed into details, max of 50 characters lastname – required if customer_id is not passed into details, max of 50 characters phone – required if customer_id is not passed into details, must be at least 10 characters email – not required, must be a valid email address_1: required if customer_id is not passed into details, max of 255 characters address_2: not required, max of 255 characters address_city: required if customer_id is not passed into details, max of 255 characters address_state: required if customer_id is not passed into details, max of 2 characters (e.g. FL) card_exp: required if method === ‘card’, bank_account: required if method === ‘bank’ bank_routing: required if method === ‘bank’ bank_type: required if method === ‘bank’, must be ‘checking’ or ‘savings’ bank_holder_type: required if method === ‘bank’, must be ‘personal’ or ‘business’ total: not required, must be a number customer_id: no _required, must be a string matching a valid customer_id whi_ch belongs to your merchant account. If supplied, a new customer will not be created or matched based on values. Instead, the supplied ID will be assigned this new payment method (and transaction if using .pay())