CardToken

@objc(DTCardToken)
@objcMembers
public class CardToken : PaymentMethodToken

This class contains the token information about a credit or debit card registration from a previously completed transaction. Just like any other PaymentMethodToken subclass, this class can be used to finalize a payment without user interaction or to display a selection of saved token payments to the user for fast checkouts. A token can be returned after completing a successful card payment or with a dedicated registration.

  • Expiry date

    Declaration

    Swift

    public private(set) var cardExpiryDate: CardExpiryDate? { get }
  • The masked card number you can use to display that specific card in your app. The masked card number shows the first 6 digits and the last 4 digits of the card, e.g. 432930xxxxxx6095.

    Declaration

    Swift

    public private(set) var maskedCardNumber: String? { get }
  • Cardholder’s name

    Declaration

    Swift

    public var cardholder: String?
  • Initializes a CardToken object with the given card data.

    Declaration

    Swift

    public init(type: PaymentMethodType, token: String, cardExpiryDate: CardExpiryDate?, maskedCardNumber: String?, cardholder: String?)

    Parameters

    type

    Payment method type, e.g. Visa

    token

    This is the token for the card, also known as alias. This can be used to debit the card without further customer interaction.

    cardExpiryDate

    Expiry date

    maskedCardNumber

    The masked card number you can use to display that specific card in your app. The masked card number shows the first 6 digits and the last 4 digits of the card, e.g. 432930xxxxxx6095.

    cardholder

    Cardholder’s name

  • A human readable title e.g. ‘•••• 6095’.

    Declaration

    Swift

    override public var displayTitle: String { get }
  • For VoiceOver this title is used instead of displayTitle.

    Declaration

    Swift

    override public var accessibilityTitle: String? { get }
  • Checks if the expiration date is in the future or not.

    Declaration

    Swift

    override public func isValid() -> Bool
  • Refer to the Encodable protocol

    Declaration

    Swift

    override public func encode(to encoder: Encoder) throws
  • Refer to the NSCoding protocol

    Declaration

    Swift

    public required init?(coder: NSCoder)
  • Refer to the NSObject protocol

    Declaration

    Swift

    override public var description: String { get }
  • Refer to the NSCopying protocol

    Declaration

    Swift

    override public func copy(with zone: NSZone? = nil) -> Any