CardTypeDetector

public final class CardTypeDetector

Detects the card type for any given card number. The card type detections are always estimations, as a card type can never be detected with 100% accuraccy on the client side.

  • The types to detect.

    Declaration

    Swift

    public var detectableTypes: [CardType]
  • Initializes the card type detector.

    Declaration

    Swift

    public init()
  • Detects the type for a given card number.

    Declaration

    Swift

    public func type(forCardNumber cardNumber: String) -> CardType?

    Parameters

    cardNumber

    The card number to retrieve the type of. The number is expected to be sanitized (digits only).

    Return Value

    The type for the given card number, or nil if it could not be found.

  • Detects all possible types for a given card number.

    Declaration

    Swift

    public func types(forCardNumber cardNumber: String) -> [CardType]

    Parameters

    cardNumber

    The card number to retrieve the types for. The number is expected to be sanitized (digits only).

    Return Value

    The possible types for the given card number.