Skip to Content
Docs

PayElements

Reference for the iOS SDK's card inputs, and the validation state and card brands they report.

PayElements provides the UIKit inputs that collect a card. The SDK owns what's typed into them. There's no public getter for the card number, expiration date, or CVV, and only PayCheckout reads them when it pays. Your app gets the validation state, the card brand, and the first 8 digits, through onBinChanged.

The inputs also disable copying, cutting, sharing, and dragging their contents.

PageWhat it covers
Card fieldsPayCardFields, and the field views it groups (PayCardNumberField, PayExpiryField, PayCVCField, and PayNameField).
Style the card fieldsPayFieldStyle, the look of the field views.

PayCardFieldsState

The state of a PayCardFields, from its state property and its onChange callback, for your app to drive its own labels and buttons.

PropertyTypeDescription
number, expiry, cvcPayFieldStatusThe status of each field.
namePayFieldStatus?The name field's status, or nil when there's no name field.
brandPayCardBrandThe brand detected from the first digits.
isCompleteBooltrue when every required field is valid. A name field may stay empty unless the name is required.

PayFieldStatus

The validation status of one field, from its status property and its onChange callback.

CaseMeaning
.emptyNothing is typed.
.incompleteWhat's typed could still become valid, for example a card number that's too short so far.
.invalidWhat's typed can't be valid, for example a card number that fails the Luhn check, an expiration date in the past, or a name without a letter.
.validThe field is valid.

PayCardBrand

The card brand, detected from the number's first digits. It sets the lengths the number and the CVV must have.

CaseNumber lengthCVV length
.visa13, 16, or 193
.mastercard163
.amex154
.discover16 to 193
.diners14 to 193
.jcb16 to 193
.unionpay16 to 193
.maestro12 to 193
.unknown12 to 193 or 4

PayCardBrand(apiName:) returns the brand for a name the API sends on a saved card, such as Visa, mastercard, or american_express, and .unknown for any other name. A saved method's card.cardBrand is one already, so you need it only for a brand name from somewhere else, such as your server.

Was this page helpful?