VGSPaymentCards
@MainActor
final public class VGSPaymentCards
Class responsible for storing and managing Payment Card definitions used by the SDK.
- Provides predefined payment card models (Visa, Mastercard, Amex, etc.).
- Supports adding custom payment card models (regex & format pattern based).
- Allows configuring behaviour and validation for unknown brands through
VGSPaymentCards.unknown.
-
Supported card brands handled by the SDK.
See moreNote
.custom(brandName:)can be used to add developer-defined brands; ensurebrandNameuniqueness.Declaration
Swift
public enum CardBrand : Equatable, Sendable
-
Elo payment card model.
Declaration
Swift
@MainActor public static var elo: VGSPaymentCardModel -
Visa Electron payment card model.
Declaration
Swift
@MainActor public static var visaElectron: VGSPaymentCardModel -
Maestro payment card model.
Declaration
Swift
@MainActor public static var maestro: VGSPaymentCardModel -
Forbrugsforeningen payment card model.
Declaration
Swift
@MainActor public static var forbrugsforeningen: VGSPaymentCardModel -
Dankort payment card model.
Declaration
Swift
@MainActor public static var dankort: VGSPaymentCardModel -
Visa payment card model.
Declaration
Swift
@MainActor public static var visa: VGSPaymentCardModel -
Mastercard payment card model.
Declaration
Swift
@MainActor public static var masterCard: VGSPaymentCardModel -
American Express payment card model.
Declaration
Swift
@MainActor public static var amex: VGSPaymentCardModel -
Hipercard payment card model.
Declaration
Swift
@MainActor public static var hipercard: VGSPaymentCardModel -
Diners Club payment card model.
Declaration
Swift
@MainActor public static var dinersClub: VGSPaymentCardModel -
Discover payment card model.
Declaration
Swift
@MainActor public static var discover: VGSPaymentCardModel -
UnionPay payment card model.
Declaration
Swift
@MainActor public static var unionpay: VGSPaymentCardModel -
JCB payment card model.
Declaration
Swift
@MainActor public static var jcb: VGSPaymentCardModel
-
Unknown brand payment card model. Customize to influence validation for brands not detected by predefined or custom models.
Declaration
Swift
@MainActor public static var unknown: VGSUnknownPaymentCardModel
-
Array of custom payment card models.
Important
Order impacts brand detection priority. Earlier entries are matched first.Declaration
Swift
@MainActor public static var cutomPaymentCardModels: [VGSCustomPaymentCardModel] -
Explicit list of valid brands (predefined + custom) to be used for detection. If
nil,availableCardBrandsis used.Important
Order impacts brand detection priority.Declaration
Swift
@MainActor public static var validCardBrands: [VGSPaymentCardModelProtocol]?
-
Returns the payment card model for a specific brand from currently available models.Declaration
Swift
@MainActor static func getCardModelFromAvailableModels(brand: VGSPaymentCards.CardBrand) -> VGSPaymentCardModelProtocol?Parameters
brandBrand to look up.
Return Value
VGSPaymentCardModelProtocol?matching model ornilif not available. -
Detects card brand from raw PAN input by evaluating regex of available models in priority order.Declaration
Swift
@MainActor static func detectCardBrandFromAvailableCards(input: String) -> VGSPaymentCards.CardBrandParameters
inputRaw card number string (digits only or may include spacing which should be sanitized before detection).
View on GitHub