BTCard

@objcMembers
public class BTCard : NSObject

The card tokenization request represents raw credit or debit card data provided by the customer. Its main purpose is to serve as the input for tokenization.

Initializers

  • Creates a Card

    Declaration

    Swift

    public convenience init(
        number: String,
        expirationMonth: String,
        expirationYear: String,
        cvv: String,
        postalCode: String? = nil,
        cardholderName: String? = nil,
        firstName: String? = nil,
        lastName: String? = nil,
        company: String? = nil,
        streetAddress: String? = nil,
        extendedAddress: String? = nil,
        locality: String? = nil,
        region: String? = nil,
        countryName: String? = nil,
        countryCodeAlpha2: String? = nil,
        countryCodeAlpha3: String? = nil,
        countryCodeNumeric: String? = nil,
        shouldValidate: Bool = false,
        authenticationInsightRequested: Bool = false,
        merchantAccountID: String? = nil
    )

    Parameters

    number

    Required: The card number.

    expirationMonth

    Required: The expiration month as a one or two-digit number on the Gregorian calendar.

    expirationYear

    Required: The expiration year as a two or four-digit number on the Gregorian calendar.

    cvv

    Required: The card verification code (like CVV or CID).

    postalCode

    Optional: The postal code associated with the card’s billing address.

    cardholderName

    Optional: The cardholder’s name.

    firstName

    Optional: First name on the card.

    lastName

    Optional: Last name on the card.

    company

    Optional: Company name associated with the card.

    streetAddress

    Optional: The street address associated with the card’s billing address.

    extendedAddress

    Optional: The extended address associated with the card’s billing address.

    locality

    Optional: The city associated with the card’s billing address.

    region

    Optional: Either a two-letter state code (for the US), or an ISO-3166-2 country subdivision code of up to three letters.

    countryName

    Optional: The country name associated with the card’s billing address.

    countryCodeAlpha2

    Optional: The ISO 3166-1 alpha-2 country code specified in the card’s billing address.

    countryCodeAlpha3

    Optional: The ISO 3166-1 alpha-3 country code specified in the card’s billing address.

    countryCodeNumeric

    Optional: The ISO 3166-1 numeric country code specified in the card’s billing address.

    shouldValidate

    Controls whether or not to return validations and/or verification results. By default, this is not enabled.

    authenticationInsightRequested

    Optional: If authentication insight is requested. If this property is set to true, a merchantAccountID must be provided. Defaults to false.

    merchantAccountID

    Optional: The merchant account ID.

  • Creates a BTCard with only expiration date and CVV, omitting the card number entirely. Use this when updating the expiry of a card already stored in your Vault, without re-sending the card number.

    Declaration

    Swift

    public convenience init(expirationMonth: String, expirationYear: String, cvv: String)

    Parameters

    expirationMonth

    Required: The expiration month as a one or two-digit number on the Gregorian calendar.

    expirationYear

    Required: The expiration year as a two or four-digit number on the Gregorian calendar.

    cvv

    Required: The card verification code (like CVV or CID).

  • Creates a new instance of BTCard with only a CVV value, setting default values for all other parameters. This initializer should only be used if you wish to create a CVV-only payment method nonce to verify a card already stored in your Vault.

    Declaration

    Swift

    public convenience init(cvv: String)

    Parameters

    cvv

    The card verification code (like CVV or CID).

  • Creates a BTCard with only optional metadata fields, omitting card number, expiration date, and CVV. Use this when passing a BTCard to CardFields, which manages those fields internally.

    Declaration

    Swift

    public convenience init(
        cardholderName: String? = nil,
        firstName: String? = nil,
        lastName: String? = nil,
        company: String? = nil,
        postalCode: String? = nil,
        streetAddress: String? = nil,
        extendedAddress: String? = nil,
        locality: String? = nil,
        region: String? = nil,
        countryName: String? = nil,
        countryCodeAlpha2: String? = nil,
        countryCodeAlpha3: String? = nil,
        countryCodeNumeric: String? = nil,
        shouldValidate: Bool = false,
        authenticationInsightRequested: Bool = false,
        merchantAccountID: String? = nil
    )

Public Methods

  • Returns a new BTCard by merging the card number, expiration date, and CVV collected by CardFields with the metadata fields (e.g. cardholder name, billing address) from this instance.

    Warning

    This method is intended for internal use by CardFields only and is not part of the public merchant-facing API. Do not call this method directly.

    Declaration

    Swift

    public func merging(
        cardNumber: String,
        expirationMonth: String,
        expirationYear: String,
        cvv: String
    ) -> BTCard