StackPay

StackPay

new StackPay()

Source:

Classes

StackPay

Members

amexRegex :RegExp

Source:

Regex that validates Amex cards

Type:
  • RegExp

apiKey :string

Source:

the API Public Key furnished by Stack Pay

Type:
  • string

apiUrl :string

Source:

URL for Stack Pay API

Type:
  • string

appendCardHtml

Source:

cardIsValid :boolean

Source:

Boolean that receives the card validation result

Type:
  • boolean

cardType :string

Source:

Variable containing Card Type String containing type of card being passed into the form

Type:
  • string

ccHtml :string

Source:

Contains the HTML for the card template

Type:
  • string

create

Source:

Create Element

createAchElement

Source:

Create ACH Element and fetch required HTML

createCardElement

Source:

Create Card Element and fetch Required HTML

cvvAmex :RegExp

Source:

Regex that validates CVV for Amex cards

Type:
  • RegExp

cvvRegex :RegExp

Source:

Regex that validates CVV

Type:
  • RegExp

cvvValid :boolean

Source:

Boolean that receives the CVV validation result

Type:
  • boolean

determineFormValidity

Source:

Method to use within the Payment Method Token Form This determines whether we can submit the form. If all inputs are invalid, then the form must not be submitted

dinersRegex :RegExp

Source:

Regex that validates Diners cards

Type:
  • RegExp

discoverRegex :RegExp

Source:

Regex that validates Discover cards

Type:
  • RegExp

env :string

Source:

The environment local, sandbox, or production

Type:
  • string

expirationValid :boolean

Source:

Boolean that receives the card expiration validation result

Type:
  • boolean

expirationValidDigits

Source:

Expiration Date must be 4 numerical digits

fetchHtml

Source:

Fetch HTML from designated template files in order to inject them within the payment form

getApiKey

Source:

Returns the API Public Key that was passed into the verifyKey()

getApiUrl

Source:

Returns the Stack Pay API URL

getCardType

Source:

Returns credit card type

getCardValidity

Source:

Returns boolean representing whether card is valid or not

getCCHtml

Source:

Returns the Credit Card HTML inputs

getCvvValidity

Source:

Returns boolean representing CVV validity

getExpirationValidity

Source:

Returns boolean result representing expiration date validity

getNameValidity

Source:

Returns boolean result of name validity

getPaymentMethodToken

Source:

Return Payment Method Token from Stack Pay API

getS3Url

Source:

Gets the S3 Bucket URL

getZipCodeValidity

Source:

Returns boolean value representing zip code validity

jcbRegex :RegExp

Source:

Regex that validates JCB cards

Type:
  • RegExp

masterCardRegex :RegExp

Source:

Regex that validates Mastercard

Type:
  • RegExp

monthYearRegex :RegExp

Source:

Regex that validates expiry date Further validation exists in validateCardExpiration()

Type:
  • RegExp

nameRegex :RegExp

Source:

Regex that validates user first and last name

Type:
  • RegExp

nameValid :boolean

Source:

Boolean that receives the name validation result

Type:
  • boolean

readENVTextFile

Source:

Reads the env file that is designated by the mode parameter in validateKey() method. Resolves an object containing key & value of each line in the ENV file.

s3Url :string

Source:

S3 bucket URL

Type:
  • string

serializeFormData

Source:

Takes the serialized form data and returns a json object so that it can be consumed by getPaymentMethodToken()

setApiKey

Source:

Evaluates entered public key, and returns a promise with API Key String

setAPIUrl

Source:

Set Stack Pay API URL

setCardType

Source:

Sets the credit card type being entered into the form

setCardValidity

Source:

Sets boolean result of credit card validation

setCCHtml

Source:

Set the Credit Card Template HTML in order to load the CC inputs into the card-element

setCvvValidity

Source:

Set boolean value representing CVV validity

setEnv

Source:

Sets ENV variable, and assigns the proper value to the StackPay.apiUrl

setExpirationValidity

Source:

Sets boolean result of expiration validity

setNameValidity

Source:

Set boolean result of name after validation

setS3Url

Source:

Set the S3 Bucket URL

setZipCodeValidity

Source:

Set boolean value representing zip code validity

validateAmex

Source:

Validates Amex cards and returns boolean

validateCardExpiration

Source:

Expiration date validation month must be between 1 & 12 inclusive year must be greater than current year Month must be greater than current month if entered year === current year Entered Month can be less than current month as long as Entered Year is greater than Current Year *

validateCardNumber

Source:

Using Regex strings to validate designated card numbers

validateCVV

Source:

CVV Must be either 3 or 4 (if AMEX ) numerical digits

validateDinersCard

Source:

Validates Diners cards and returns boolean

validateDiscover

Source:

Validates Discover cards and returns boolean

validateJCB

Source:

Validates JCB cards and returns boolean

validateMasterCard

Source:

Validates MasterCard cards and returns boolean

validateName

Source:

Name can have letters, spaces, dashes, comma, and period, with no numbers, and no special characters. At least 3 letters.

validateVisa

Source:

Validates Visa cards and returns boolean

validateZipCode

Source:

Determine validity of zip code using regex string Sets also zipCodeValid variable.

verifyKey

Source:

Verifies public key and delegates environment

visaRegex :RegExp

Source:

Regex that validates Visa cards

Type:
  • RegExp

zipCodeRegex :RegExp

Source:

Regex that validates Zip Codes

Type:
  • RegExp

zipCodeValid :boolean

Source:

Boolean that receives the Zip Code validation result

Type:
  • boolean