CardDetailsUI
public struct CardDetailsUI
This represents the UI component required to display the card details securely.
Since
2.1.0-
Initializer to construct a CardDetailsUI.
Declaration
Swift
public init(panTextField pan: D1DisplayTextField?, expiryDateTextField expiryDate: D1DisplayTextField?, cvvTextField cvv: D1DisplayTextField?, cardHolderNameTextField cardHolderName: D1DisplayTextField?)
Parameters
panTextField
The text field to display the PAN securely.
expiryDateTextField
The text field to display the expiry date securely.
cvvTextField
The text field to display the CVV securely.
cardHolderNameTextField
The text field to display the cardholder name securely.
-
Initializer to construct a CardDetailsUI.
Declaration
Swift
public init()
-
The text field to display the PAN of the card.
Declaration
Swift
public var panTextField: D1DisplayTextField? { get set }
-
The text field to display the expiry date of the card.
Declaration
Swift
public var expiryDateTextField: D1DisplayTextField? { get set }
-
The text field to display the CVV of the card.
Declaration
Swift
public var cvvTextField: D1DisplayTextField? { get set }
-
The text field to display the cardholder name of the card.
Declaration
Swift
public var cardHolderNameTextField: D1DisplayTextField? { get set }
-
To set a separator character for every 4 characters in the PAN. For example, when the separator character is ‘ ’, PAN is displayed as 1234 5678 1234 5678. By default, it is set to ‘ ’.
Declaration
Swift
public var panSeparatorCharacter: String { get set }
-
To set a character to mask the PAN. This is used in
maskCardDetails()
. By default, it is set to ‘*’.Declaration
Swift
public var panMaskCharacter: String { get set }
-
To set the date format used in the expiry date. By default, it is set to “MM/yy”.
See
See Date Formatters for the allowed date format.Declaration
Swift
public var expiryDateFormat: String { get set }
-
To show the card details securely.
When
D1Task.displayCardDetails(_:cardDetailsUI:completion:)
is called, the card details will be shown, thus it is not necessary to call this API.This API should only be called after
D1Task.displayCardDetails(_:cardDetailsUI:completion:)
has completed successfully. This is a convenient method to show the card details again aftermaskCardDetails()
is called.Declaration
Swift
public func showCardDetails(completion: @escaping (D1Error?) -> Void)
Parameters
completion
The callback is invoked when the operation is completed. When the callback is successful, no error will be returned. Otherwise, the error details will be returned. Possible errors:
-
To mask the card details.
This API updates the UI so that only last 4 digits and expiry date are visible. The CVV and cardholder namewill not be displayed.
To show the card details, call
showCardDetails(completion:)
.Declaration
Swift
public func maskCardDetails()
-
Wipe the contents of the displayed card details.
Declaration
Swift
public func wipe()