Skip to main content
Primer Checkout iOS SDK is currently in beta (v3.0.0-beta.1). The API is subject to change before the stable release.
PrimerCardNetwork represents a single card network (card scheme) detected from a card number, together with the display information needed to render it. It is the model used in co-badged card scenarios — when one physical card carries more than one network (for example Cartes Bancaires + Visa) and the shopper, or your UI, must choose which network to route the payment through. You read PrimerCardNetwork values from PrimerCardFormState (availableNetworks and selectedNetwork) and commit a choice with PrimerCardFormSession.selectCardNetwork(_:).

Definition

@objc
public final class PrimerCardNetwork: NSObject
You never construct PrimerCardNetwork yourself. The SDK detects networks from the entered card number and publishes them on PrimerCardFormState.availableNetworks. Use those instances directly when calling selectCardNetwork(_:).

Properties

PropertyTypeDescription
displayNameStringHuman-readable network name for display (e.g. "Visa", "Mastercard", "Cartes Bancaires").
networkCardNetworkThe underlying card network value. See CardNetwork.
allowedBooltrue when this network is enabled for the current merchant configuration.
allowsUserSelectionBooltrue when the shopper may choose this network in a co-badged selector. false for networks that auto-route (e.g. EFTPOS).
issuerCountryCodeString?ISO country code of the card issuer, when known.
issuerNameString?Name of the card issuer, when known.
accountFundingTypeString?Account funding type (e.g. credit/debit), when known.
prepaidReloadableIndicatorString?Indicator describing whether a prepaid card is reloadable, when known.
productUsageTypeString?Product usage type reported by the network, when known.
productCodeString?Network product code, when known.
productNameString?Network product name, when known.
issuerCurrencyCodeString?ISO currency code associated with the issuer, when known.
regionalRestrictionString?Regional restriction reported by the network, when known.
accountNumberTypeString?Account number type reported by the network, when known.
displayName, network, allowed, and allowsUserSelection are the properties you need for co-badge selection. The remaining String? properties carry optional issuer/BIN metadata that is populated only when the SDK resolves it remotely; treat them as supplementary display data.

CardNetwork

network is a CardNetwork — a String-backed enum identifying the scheme. Its raw value matches the network’s canonical uppercase identifier.
public enum CardNetwork: String, Codable, CaseIterable
The source declaration also conforms to an internal logging protocol that is not part of the public contract; it is omitted here.
CaseRaw valueDisplay name
.amexAMEXAmerican Express
.bancontactBANCONTACTBancontact
.cartesBancairesCARTES_BANCAIRESCartes Bancaires
.dinersDINERS_CLUBDiners
.discoverDISCOVERDiscover
.eftposEFTPOSEFTPOS
.eloELOElo
.hiperHIPERHiper
.hipercardHIPERCARDHiper
.jcbJCBJCB
.maestroMAESTROMaestro
.masterCardMASTERCARDMastercard
.mirMIRMir
.visaVISAVisa
.unionpayUNIONPAYUnionPay
.unknownOTHERUnknown
The enum exposes these public members:
MemberTypeDescription
displayNameStringHuman-readable network name.
iconUIImage?Branded network icon, or nil when none is bundled.
traitsPrimerCardNetworkTraits?PAN length, gap pattern, and CVV metadata for the network, or nil.
init(cardNumber: String)Detects the network from a card number, falling back to .unknown.
init(cardNetworkStr: String)Resolves a network from a string identifier, falling back to .unknown.

Co-badged card selection

When the entered card number resolves to more than one network, the card form publishes those options on PrimerCardFormState. Read them inside any PrimerCardForm slot through the injected PrimerCardFormSession:
State propertyTypeDescription
availableNetworks[PrimerCardNetwork]Networks detected from the card number. More than one indicates a co-badged card.
selectedNetworkPrimerCardNetwork?The currently selected network, or nil while the network is auto-detected.
To commit a choice, pass one of the availableNetworks instances to the session:
MethodDescription
selectCardNetwork(_ network: PrimerCardNetwork)Selects a network for a co-badged card. Applicable only when availableNetworks contains more than one network.
Show a selector only when there is a real choice to make — gate it on availableNetworks.count > 1. For a single detected network the SDK routes automatically and no selection is needed.

Building a custom selector

import SwiftUI
import PrimerSDK

@available(iOS 15.0, *)
struct CoBadgedNetworkPicker: View {
    @ObservedObject var session: PrimerCardFormSession

    var body: some View {
        let networks = session.state.availableNetworks
        if networks.count > 1 {
            VStack(alignment: .leading, spacing: 8) {
                Text("Choose card network")
                    .font(.subheadline)

                ForEach(networks, id: \.network) { network in
                    Button {
                        session.selectCardNetwork(network)
                    } label: {
                        HStack {
                            Text(network.displayName)
                            Spacer()
                            if session.state.selectedNetwork?.network == network.network {
                                Image(systemName: "checkmark")
                            }
                        }
                    }
                    .disabled(!network.allowed)
                }
            }
        }
    }
}
Render only networks where allowsUserSelection is true (and that are allowed). Networks that auto-route — such as EFTPOS — are resolved by the SDK and should not appear as a manual choice.

Using the built-in selector

If you don’t need a fully custom picker, the SDK ships a ready-made dropdown. The default cardDetails section renders it automatically once a co-badged card is detected. When you recompose the individual card fields yourself, add the standalone selector with CardFormDefaults.cardNetwork(_:) — it already gates on availableNetworks.count > 1 and calls selectCardNetwork(_:) for you. See Card field components.
PrimerCardForm(cardDetails: { session in
    VStack(alignment: .leading, spacing: 16) {
        CardFormDefaults.cardNumber(session)
        CardFormDefaults.cardNetwork(session)
    }
})

See also

Card Form Session

State, network selection, and submission for the card form.

Card field components

The built-in co-badge selector and other per-field building blocks.

PrimerCardForm

The card form view and its slots.