Card
The card component allows you to show your customers their different cards, and allows them to manage the cards lifecycle:
- Reveal card information
- Activate card
- Set / Change PIN
- Freeze / unfreeze
- Replace a damaged card
- Report card lost/stolen
- Add card to mobile wallet from the actions menu, including on the web. To show only the wallet buttons, embed the Add to Wallet component.
Security & PCI Compliance
The Card component is designed to minimize your PCI compliance burden by isolating sensitive card data (PAN, CVV) from your application code and infrastructure.
How It Works
Web (iframe isolation):
- Sensitive card data renders inside a cross-origin iframe served from Unit's secure domain
- The browser's Same-Origin Policy creates a security boundary that prevents your JavaScript from accessing iframe contents
- Session recording tools (e.g., LogRocket, FullStory), error tracking, and analytics running in your parent page cannot capture data inside the iframe
- This is the same mechanism that prevents malicious websites from reading your Gmail or online banking sessions
Native SDK (iOS, Android, React Native):
- Sensitive data renders in secure SDK contexts using platform-specific isolation mechanisms
- Your application code never receives raw PAN/CVV values - only tokenized references
- The SDK handles all sensitive data display and user interaction internally
Scope-Based Access Control
Access to sensitive card data is controlled through customer token scopes:
| Scope | What It Allows |
|---|---|
cards | Read card metadata (last 4 digits, status, limits, expiration month/year) |
cards-write | Freeze/unfreeze, report lost/stolen, replace card |
cards-sensitive | Reveal full PAN, CVV (requires 2FA by default) |
cards-sensitive-write | Set/change PIN |
When generating a customer token, you specify which scopes to grant. Without cards-sensitive scope, the component will not render sensitive data even if a user requests it.
Upgradeable scopes: You can issue tokens with base scopes (e.g., cards) and upgrade to cards-sensitive after the user completes 2FA, avoiding pre-authorization of sensitive access.
// Example: Generate token with upgradeable scope
const response = await fetch('https://api.s.unit.sh/customers/123/token', {
method: 'POST',
headers: {
'Authorization': `Bearer ${orgToken}`,
'Content-Type': 'application/vnd.api+json'
},
body: JSON.stringify({
data: {
type: 'customerToken',
attributes: {
scope: 'cards cards-write',
upgradableScope: 'cards-sensitive' // Can upgrade after 2FA
}
}
})
});
Note: The preview is in Sandbox, meaning this is not a real card.
Implementation
Web Components
Add the card element to your app where you'd like the card to be presented.
<unit-elements-card
card-id="632197"
customer-token=""
theme=""
learn-more-url="www.google.com"
menu-items="freeze,addToWallet,managePin,replace,report,close"
></unit-elements-card>
<!-- Hide actions menu button & sensitive data button. -->
<unit-elements-card
card-id="632197"
customer-token=""
theme=""
hide-actions-menu-button="false"
hide-sensitive-data-button="false"
></unit-elements-card>
Inputs:
| Name | Type | Required | Description |
|---|---|---|---|
| card-id | string | Yes | Unit card id. |
| customer-token | string | Yes | A Unit Customer token. Required Scopes: customers cards cards-sensitive cards-sensitive-write cards-write |
| theme | string | No | A URL that specifies the UI configuration. |
| language | string | No | A URL that specifies the language configuration. |
| hide-actions-menu-button | string | No | Hide menu button in case value is 'true'. |
| hide-card-title | string | No | Hide card title in case value is 'true'. |
| hide-sensitive-data-button | string | No | Hide sensitive data button in case value is 'true'. |
| learn-more-url | string | No | A "Learn more" URL on the report lost/close card info note. |
| menu-items | string | No | A list of actions, The menu dynamically adjusts based on the provided list freeze,managePin,replace,report,close. |
| fee | string | No | Base issuing fee for each card (for the "replace card" flow). |
| show-card-type-subtitle | string | No | Show card type subtitle in case value is 'true'. When enabled, displays the card custom name (if available) in the title. |
| show-card-holder-subtitle | string | No | Show cardholder subtitle in case value is 'true'. When enabled, displays the card custom name (if available) in the title. |
| hide-card-status | string | No | Hide card status in case value is 'true'. |
| hide-sensitive-data | string | No | Hide sensitive data in case value is 'true'. |
| card-holder-name-style | string | No | Style of the card holder name. Possible values: "uppercase" / "capitalize". Default is "uppercase". |
| show-status-badge | string | No | Show status badge in case value is 'true'. |
| hide-inactive-blur | string | No | Don't blur inactive cards in case value is 'true'. |
Events:
| Event Name | Description | Detail |
|---|---|---|
| unitOnLoad | Occurs when a component is loaded | Card |
| unitCardStatusChanged | Occurs when a Card status changes, excluding first time card activation | [Promise] Card |
| unitCardActivated | Occurs when a Card is activated | [Promise] Card |
Incoming events:
In some cases, the default menu button won't fit into the design of an application. By using the unitRequestOpenActionsMenu incoming event, it's possible to open the card actions bottom sheet from a custom button

<unit-elements-card
hide-actions-menu-button="false"
hide-card-title="false"
hide-sensitive-data-button="false"
card-id="632197"
>
</unit-elements-card>
<button id="#custom-button">Manage Card</button>
<script>
document.querySelector('#custom-button').addEventListener('click', () => {
document
.querySelector('unit-elements-card')
.dispatchEvent(new CustomEvent('unitRequestOpenActionsMenu'));
});
</script>
It's also possible to create your own menu and call card actions from it. Use unitRequestCardAction event and send inside an action you want to perform.
Possible actions: Activate, Freeze, Unfreeze, Report (for report lost / stolen), Close, Replace, ManagePin, ChangePin, SetPin, AddToWallet
Use API Docs in order to understand which actions could be applied for any particular card statuses.

<unit-elements-card
hide-actions-menu-button="false"
hide-card-title="false"
hide-sensitive-data-button="false"
card-id="632197"
>
</unit-elements-card>
<button id="#custom-button">Freeze card</button>
<script>
document.querySelector('#custom-button').addEventListener('click', () => {
document.querySelector('unit-elements-card').dispatchEvent(
new CustomEvent('unitRequestCardAction', {
detail: { action: 'Freeze' },
})
);
});
</script>
React Native SDK
UNCardComponent props:
| Name | Type | Required | Description |
|---|---|---|---|
| cardId | string | YES | Unit card id. |
| theme | string | NO | A URL that specifies the UI configuration. |
| language | string | NO | A URL that specifies the language configuration. |
| menuItems | UNCardMenuItem[] | NO | A list of actions, The menu dynamically adjusts based on the provided list. The keys for UNCardMenuItem are: freeze, addToWallet, managePin, replace, report, and close. |
| hideActionsMenuButton | boolean | NO | Hide menu button in case value is true |
| hideCardTitle | boolean | NO | Hide card title in case value is true |
| hideSensitiveDataButton | boolean | NO | Hide sensitive data button in case value is true |
| showCardTypeSubtitle | Boolean | No | Enabling will display the custom card type in the title. |
| showCardHolderSubtitle | Boolean | No | Enabling will display the custom card name in the title. |
| learnMoreUrl | string | NO | A “Learn more” URL on the report lost/close card info note. |
| fee | number | NO | Fee for the card |
| onStatusChanged | (card: UNCard) => void | NO | Callback for card status changes. |
| onLoad | (response: UNComponentsOnLoadResponse<UNCard>) => void | NO | Callback for a loaded component |
| onCardActivated | (card: UNCard) => void | NO | Callback for card activated. |
| pushProvisioningModule | typeof NativeModules | NO | A Native Module that implements Visa's push provisioning |
Example:
import React from 'react';
import { UNCardComponent, UNCard } from 'react-native-unit-components';
import { NativeModules } from 'react-native';
const { PushProvisioningModule } = NativeModules;
export default function YourComponent() {
return (
<UNCardComponent
cardId={'632197'}
onStatusChanged={(card: UNCard) => { console.log(card) }}
onCardActivated={(card: UNCard) => { console.log(card) }}
pushProvisioningModule={PushProvisioningModule}
onLoad={(response: UNComponentsOnLoadResponse<UNCard>) => { console.log(response) }}
/>
);
}
Incoming Events:
-
In some cases, the default menu button won't fit into the design of an application. By using the
openActionsMenu()method, it's possible to open the card actions bottom sheet from a custom button.Important Note: one can use the
openActionsMenu()only after UNCardComponent is loaded. (can be verified by onLoad callback)
Example:
import { UNCardComponent, CardRef } from 'react-native-unit-components';
...
const cardRef = useRef<CardRef>(null);
...
const openActionsMenu = () => {
cardRef.current?.openActionsMenu();
};
...
<UNCardComponent
ref={cardRef}
cardId={"4242"}
/>
-
It's also possible to create your own menu and call card actions from it. Use
openAction(action: UNCardMenuAction)method and send inside an action you want to perform. Use API Docs in order to understand which actions could be applied for any particular card statuses.Example:
import { UNCardMenuAction } from 'react-native-unit-components';
// .......
const openAction = (action: UNCardMenuAction) => {
cardRef.current?.openAction(action);
};
// .......
- You can choose to implement your own show / hide card sensitive data button. In this case use 'showSensitiveData()' method to show sensitive data and 'hideSensitiveData()' method to hide it.
Example:
// .......
const showSensitiveData = () => {
cardRef.current?.showSensitiveData();
};
const hideSensitiveData = () => {
cardRef.current?.hideSensitiveData();
};
// .......
Add card to wallet
This capability can be used with the Card Component, or without it, as a separate flow. Complete the React Native Visa SDK Integration in the Add to Mobile Wallet guide to use this capability.
Adding a card to Wallet with the Card Component
After completing the instructions to use this capability, pass the PushProvisioningModule as a prop to Unit's Card Component. This will let the SDK get wallets and start card provisioning for you once the native Add to Wallet button was pressed.
Then, you can add a card to the wallet using the "Manage Apple Wallet" or "Manage Google Wallet" tab in the Card Components's native menu or using an AddToWallet as the Incoming event action.
Add card to wallet as a separate flow
After completing the instructions to use this flow, call UnitComponentsSDK.setPushProvisioningModule(PushProvisioningModule) with your PushProvisioningModule Native Module.
After that, you can add a card to Apple or Google Wallet by calling the Unit SDK's startPushProvisioning(cardId: string, customerToken: string).
Example:
UnitComponentsSDK.ui.flows.startPushProvisioning(YOUR_CARD_ID, YOUR_CUSTOMER_TOKEN);
Android SDK
Component name: UNCardComponent
getCardComponent parameters:
| Name | Type | Required | Description |
|---|---|---|---|
| cardId | String | YES | Unit card id. |
| additionalSettings | UNCardViewSettingsInterface | NO | Additional settings unique for this component |
| theme | String | NO | A URL that specifies the UI configuration. |
| language | String | NO | A URL that specifies the language configuration. |
| callbacks | UNCardComponentCallbacks | NO | Component's Callbacks sealed class |
UNCardComponentCallbacks
The callbacks parameter for UNCardComponent is of the following type:
typealias UNCardComponentCallbacks = (callback: UNCardComponentCallback) -> Unit
The UNCardComponentCallback is sealed class that has the following callbacks that you can receive from a Card component:
sealed class UNCardComponentCallback {
data class OnLoad(val onLoadResponse: Result<UNCard>): UNCardComponentCallback()
data class CardStatusChanged(val card: UNCard): UNCardComponentCallback()
data class CardActivated(val card: UNCard): UNCardComponentCallback()
}
To get the Card Component fragment, call the getCardComponent method of UnitComponentsSdk.manager.ui.views.
Example:
- Fragment
- Compose
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import co.unit.un_components.api.UnitComponentsSdk
import co.unit.un_components.common.builders.UNCardViewSettingsBuilder
import co.unit.un_components.common.enums.UNCardComponentCallback
import co.unit.un_components.components.UNCardComponent
import co.unit.un_components.common.models.UNCard
import co.unit.un_components.common.models.UNCardMenuAction
class CardFragment : Fragment() {
private var unCardComponent: UNCardComponent? = null
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val fragmentLayout = inflater.inflate(R.layout.FILE_NAME, container, false)
// Define your callbacks
val callbacks: (UNCardComponentCallback) -> Unit = { callback ->
when (callback) {
is UNCardComponentCallback.CardActivated -> handleCardActivated(callback.card)
is UNCardComponentCallback.CardStatusChanged -> handleCardStatusChanged(callback.card)
is UNCardComponentCallback.OnLoad -> handleOnLoad(callback.onLoadResponse)
}
}
// Check if this is a fresh creation or restoration after process death
unCardComponent = if (savedInstanceState == null) {
// Fresh creation - create new component and add to fragment manager
UnitComponentsSdk.manager.ui.views.getCardComponent(
cardId = YOUR_CARD_ID,
theme = YOUR_THEME_URL,
language = YOUR_LANGUAGE_URL
).also {
childFragmentManager.beginTransaction()
.replace(R.id.CONTAINER_NAME, it as Fragment, FRAGMENT_TAG)
.commitNow()
}
} else {
// Restoration after process death - find existing fragment by tag
childFragmentManager.findFragmentByTag(FRAGMENT_TAG) as? UNCardComponent
}
// Set callbacks after obtaining the component (required for both fresh and restored)
unCardComponent?.callbacks = callbacks
return fragmentLayout
}
// ...
// Event handlers
// ...
companion object {
private const val FRAGMENT_TAG = "card_component"
}
}
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.foundation.layout.fillMaxSize
import co.unit.un_components.common.enums.UNCardComponentCallback
import co.unit.un_components.compose.UNCardComponent
@Composable
fun CardScreen() {
UNCardComponent(
modifier = Modifier.fillMaxSize(),
cardId = YOUR_CARD_ID,
callbacks = { callback ->
when (callback) {
is UNCardComponentCallback.CardActivated -> handleCardActivated(callback.card)
is UNCardComponentCallback.CardStatusChanged -> handleCardStatusChanged(callback.card)
is UNCardComponentCallback.OnLoad -> handleOnLoad(callback.onLoadResponse)
}
}
)
}
Incoming Events:
In some cases, the default menu button won't fit into the design of an application.
By using the openActionsMenu() method, it's possible to open the card actions bottom sheet from a custom button.
Important Note: one can use the openActionsMenu() only after UNCardComponent is loaded. (can be verified by onLoad callback)
Example:
- Fragment
- Compose
unCardComponent.openActionsMenu()
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.ui.node.Ref
import androidx.compose.material.Button
import androidx.compose.material.Text
import co.unit.un_components.components.UNCardComponent
import co.unit.un_components.compose.UNCardComponent as UNCardComposable
val cardRef = remember { Ref<UNCardComponent>() }
UNCardComposable(
modifier = Modifier.fillMaxSize(),
cardViewRef = cardRef,
cardId = YOUR_CARD_ID,
callbacks = { /* ... */ }
)
Button(onClick = { cardRef.value?.openActionsMenu() }) {
Text("Open Menu")
}
It's also possible to create your own menu and call card actions from it.
Use openAction(action: UNCardMenuAction) method and send inside an action you want to perform.
Use API Docs in order to understand which actions could be applied for any particular card statuses.
Example:
- Fragment
- Compose
import co.unit.un_components.common.models.UNCardMenuAction
// .......
unCardComponent.openAction(UNCardMenuAction.Freeze)
import co.unit.un_components.common.models.UNCardMenuAction
// cardRef obtained as shown above
cardRef.value?.openAction(UNCardMenuAction.Freeze)
You can choose to implement your own show / hide card sensitive data button. In this case use 'showSensitiveData()' method to show sensitive data and 'hideSensitiveData()' method to hide it.
Example:
- Fragment
- Compose
unCardComponent.showSensitiveData()
unCardComponent.hideSensitiveData()
// cardRef obtained as shown above
cardRef.value?.showSensitiveData()
cardRef.value?.hideSensitiveData()
The additionalSettings parameter for UNCardComponent has this attribute:
UNCardViewSettingsInterface
| Name | Type | Default Value | Description |
|---|---|---|---|
| hideActionsMenuButton | Boolean | false | Hide menu button in case value is true. |
| hideCardTitle | Boolean | false | Hide card title in case value is true. |
| hideSensitiveDataButton | Boolean | false | Hide sensitive data button in case value is true. |
| showCardTypeSubtitle | Boolean | false | Enabling will display the custom card type in the title. |
| showCardHolderSubtitle | Boolean | false | Enabling will display the custom card name in the title. |
| enablePushProvisioning | Boolean | false | Enables Push Provisioning in case value is true. |
| learnMoreUrl | String | "" | A “Learn more” URL on the report lost/close card info note. |
| fee | Double | null | Fee for the card |
| menuItems | List<UNCardMenuItem> | null | A list of actions, The menu dynamically adjusts based on the provided list [.Freeze, .AddToWallet, .ManagePin, .Replace, .Report, .Close]. |
You can use UNCardViewSettingsBuilder() to create an instance of the interface and define your additional settings.
val additionalSettings = UNCardViewSettingsBuilder()
.fee(...)
.learnMoreUrl(...)
.hideCardTitle(...)
.hideActionsMenuButton(...)
.hideSensitiveDataButton(...)
.showCardTypeSubtitle(...)
.showCardHolderSubtitle(...)
.enablePushProvisioning(...)
.menuItems(...)
unCardComponent = UnitComponentsSdk.manager.ui.views.getCardComponent(
cardId = YOUR_CARD_ID,
additionalSettings = additionalSettings,
theme = YOUR_THEME_URL,
language = YOUR_LANGUAGE_URL
)
Add card to wallet
This capability can be used with the Card Component or without it, as a separate flow. see below.
Prerequirements
Complete Part 1: Requirements in the Add to Mobile Wallet guide, and start once Unit confirms that setup with Visa is complete.
Add the Unit Push Provisioning SDK
From version 4.0.0, the Components SDK adds cards to Google Wallet through the Unit Push Provisioning SDK. Add it to your app by following its Installation section:
- Add
co.unit:unit-push-provisioning5.12.0 to your app'sbuild.gradle. - Add the Visa Digital Enablement 5.12.0 libraries and their dependencies.
Push provisioning requires Android 9 (API 28) or later.
Configure push provisioning
Call configureVisa(visaAppId) once, for example in the onCreate method of your main activity. It uses the environment the SDK was initialized with. Push provisioning is set up and tested in production only, so initialize the UnitComponentsSdk with UNComponentsEnvironment.Production to add real cards:
import co.unit.un_components.api.UnitComponentsSdk
UnitComponentsSdk.manager.services.configureVisa("YOUR_VISA_APP_ID")
Visa keeps the first environment it is configured with until the app restarts. Configure it with the environment you provision in.
Handling errors
Add to Wallet errors are delivered to the Push Provisioning SDK's error callback (UnitPushProvisioningSDK.manager.addErrorCallback).
Migrating from 3.x
- Delete your
UNVisaProviderclass. - Remove the
setVisaProvider(...)call. - Add
co.unit:unit-push-provisioning5.12.0, and update the Visa libraries to 5.12.0 withplay-services-tapandpay18.8.0, as listed in Installation. - Call
configureVisa(visaAppId). - If you added the Visa SDK's R8 rules to your app, you can remove them.
After app development remaining steps
When you are done with the integration, complete Part 3: Test and Launch.
Adding a card to Wallet with the Card Component
After completing the instructions to use this capability, set the enablePushProvisioning with the value of true in the Card component additionalSettings parameter. Then, you can add a card to Apple Wallet using the "Manage Apple Wallet" tab in the Card Components's native menu or using an UNCardMenuAction.AddToWallet Incoming event.
val additionalSettings = UNCardViewSettingsBuilder()
...
.enablePushProvisioning(true)
...
Add card to wallet as a separate flow
After completing the instructions to use this flow, you can add a card to Google Wallet by calling the Unit SDK's startPushProvisioningFlow(context: Context, cardId: String) method.
Example:
UnitComponentsSdk.manager.ui.flows.startPushProvisioning(context, YOUR_CARD_ID)
IOS SDK
Component name: UNCardComponent
Configuration parameters:
| Name | Type | Required | Description |
|---|---|---|---|
| id | String | YES | A Unit card id. |
| additionalSettings | UNCardViewSettingsProtocol | NO | Advanced optional settings. |
| callbacks | UNCardComponentCallbacks | NO | Callbacks to interact with the Card component. |
| theme | String | NO | A URL that specifies the UI configuration. |
| language | String | NO | A URL that specifies the language configuration. |
The callbacks parameter for UNCardComponent is of the following type:
public typealias UNCardComponentCallbacks = (_ callback: UNCardComponentCallback) -> Void
The UNCardComponentCallback is an enum that has the following callbacks that you can receive from a Card component:
public enum UNCardComponentCallback {
case cardStatusChanged(card: UNCard)
case cardActivated(card: UNCard)
case unitOnLoad(result: Result<UNCard, UNComponentsError>)
}
To get the Card Component view, call the getCardComponent method of UnitComponentsSDK.manager.ui.views.
Example:
- UIKit
- SwiftUI
import UIKit
import UNComponents
import SnapKit
class CardScreen: UIViewController {
fileprivate lazy var cardComponent: UNCardView = {
let unViews = UnitComponentsSDK.manager.ui.views
let cardComponent = unViews.getCardComponent(id: "609414"){ callback in
switch callback {
case .cardStatusChanged(let card):
print("Card status changed \(card)")
case .cardActivated(let card):
print("Card activated -> \(card)")
case .unitOnLoad(let result):
switch result {
case .success(let card):
print("Successfully loaded card. Card data: \(card)")
case .failure(let error):
print("Failed to load Card component. Error details: \(error)")
}
}
}
return cardComponent
}()
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white
// add the card component as a subview - using SnapKit for example
view.addSubview(cardComponent)
cardComponent.snp.makeConstraints { make in
make.top.equalTo(view.safeAreaLayoutGuide.snp.top)
make.leading.trailing.equalToSuperview()
}
}
}
import SwiftUI
import UNComponents
struct CardScreen: View {
var body: some View {
UNCardComponentView(cardId: "609414")
.callbacks { callback in
switch callback {
case .cardStatusChanged(let card):
print("Status changed: \(card)")
case .cardActivated(let card):
print("Activated: \(card)")
case .unitOnLoad(let result):
print("Loaded: \(result)")
@unknown default:
break
}
}
}
}
Incoming Events:
In some cases, the default menu button won't fit into the design of an application.
By using the openActionsMenu() method, it's possible to open the card actions bottom sheet from a custom button.
Important Note: one can use the openActionsMenu() only after UNCardComponent is loaded. (can be verified by onLoad callback)
Example:
- UIKit
- SwiftUI
cardComponent.openActionsMenu()
import SwiftUI
import UNComponents
struct CardScreen: View {
@StateObject private var cardRef = UNComponentRef<UNCardView>()
var body: some View {
VStack {
UNCardComponentView(cardId: "609414")
.ref(cardRef)
Button("Open menu") {
cardRef.component?.openActionsMenu()
}
}
}
}
It's also possible to create your own menu and call card actions from it. Use openAction(action: UNCardMenuAction) method and send inside an action you want to perform. Use Unit's API Docs in order to understand which actions could be applied.
Example:
- UIKit
- SwiftUI
cardComponent.open(action: UNCardMenuAction.addToWallet)
cardRef.component?.open(action: UNCardMenuAction.addToWallet)
You can choose to implement your own show / hide card sensitive data button. In this case use 'showSensitiveData()' method to show sensitive data and 'hideSensitiveData()' method to hide it.
Example:
- UIKit
- SwiftUI
cardComponent.showSensitiveData()
cardComponent.hideSensitiveData()
cardRef.component?.showSensitiveData()
cardRef.component?.hideSensitiveData()
The additionalSettings parameter for UNCardComponent is of the following type:
UNCardViewSettingsProtocol:
| Name | Type | Default Value | Description |
|---|---|---|---|
| hideActionsMenuButton | Bool | false | Hide the actions menu buttons. |
| hideCardTitle | Bool | false | Hide the Card title |
| hideSensitiveDataButton | Bool | false | Hide the Sensitive data ("Show details") button |
| enablePushProvisioning | Bool | false | Enables Push Provisioning in case value is set to true. |
| learnMoreUrl | String | "" | A “Learn more” URL on the report lost/close card info note. |
| menuItems | [UNCardComponentMenuItems] | A list of actions, The menu dynamically adjusts based on the provided list [.freeze, .addToWallet, .managePin, .replace, .report, .close]. | |
| fee | Double? | null | Base issuing fee for each card (for the "replace card" flow). |
| showCardTypeSubtitle | Bool | false | Show card type subtitle in case value is 'true'. When enabled, displays the card custom name (if available) in the title. |
| showCardHolderSubtitle | Bool | false | Show cardholder subtitle in case value is 'true'. When enabled, displays the card custom name (if available) in the title. |
You can use UNCardViewSettingsBuilder to create an instance of the protocol and define your additional settings.
Example:
- UIKit
- SwiftUI
let additionalSettings = UNCardViewSettingsBuilder()
.hideCardTitle(true)
.hideSensitiveDataButton(true)
.enablePushProvisioning(true)
.menuItems([.freeze])
let unViews = UnitComponentsSDK.manager.ui.views
let cardComponent = unViews.getCardComponent(id: "609414", additionalSettings: additionalSettings)
let additionalSettings = UNCardViewSettingsBuilder()
.hideCardTitle(true)
.hideSensitiveDataButton(true)
.enablePushProvisioning(true)
.menuItems([.freeze])
UNCardComponentView(cardId: "609414")
.additionalSettings(additionalSettings)
Add card to wallet
This capability can be used with the Card Component or without it, as a separate flow.
Prerequirements
Complete Set Up Apple Developer in the Add to Mobile Wallet guide:
- Request the Apple Pay In-App Provisioning entitlement.
- Set up your app once Apple grants the entitlement.
Add the Unit Push Provisioning SDK
The Components SDK adds cards to Apple Wallet through the Unit Push Provisioning SDK. Add it to your app:
- Add the
UnitPushProvisioning5.12.0 Swift Package (Exact Version) and set it to Embed & Sign. - Add the Visa Digital Enablement 5.12.0 frameworks (Embed & Sign).
VisaAnalyticsis versioned separately, as 2.1.0. - Turn on the Wallet capability and the In-App Provisioning entitlement in Xcode.
Configure push provisioning
Call configureVisa(visaAppId:) once, after initializing the SDK. It uses the environment the SDK was initialized with:
UnitComponentsSDK.manager.services.configureVisa(visaAppId: "YOUR_VISA_APP_ID")
Visa keeps the first environment it is configured with until the app restarts. Configure it with the environment you provision in.
Handling errors
Add to Wallet errors are delivered to the Push Provisioning SDK's error callback (UnitPushProvisioningSDK.manager.addErrorCallback).
Migrating from 3.x
- Delete your
UNVisaProviderclass. - Remove the
setVisaProvider(...)call. - Add the
UnitPushProvisioning5.12.0 package (Exact Version) and update the Visa frameworks to 5.12.0. - Call
configureVisa(visaAppId:).
Adding a card to Apple Wallet with the Card Component
After completing the instructions to use this capability, set the enablePushProvisioning with the value of true in the Card component additionalSettings parameter.
Then, you can add a card to Apple Wallet using the "Manage Apple Wallet" tab in the Card Components's native menu or using an UNCardMenuAction.AddToWallet Incoming event.
Add card to Apple Wallet as a separate flow
After completing the instructions to use this flow, you can add a card to Apple Wallet by calling the Unit SDK's func startPushProvisioning(for cardId: String, theme: UNComponentsTheme?, language: UNComponentsLanguage?) method.
Example:
UnitComponentsSDK.manager.ui.flows.startPushProvisioning(for: YOUR_CARD_ID)