Overview

Set the PrimerHeadlessUniversalCheckoutRawDataManagerListener in order to receive different callbacks from Primer SDK.

onValidationChanged

1
fun onValidationChanged(isValid: Boolean, errors: List<PrimerInputValidationError>)
kotlin
copy

Returns whether the rawData set by setRawData is valid, and all the errors that occurred during validation.

Parameters

isValid
BooleanRequired

Returns true in case raw data is valid, otherwise false.

errors
List<PrimerInputValidationError>Required
Returns all of the validation errors for a raw data.
Properties
errorId
StringRequired
A unique error identifier.
description
StringRequired
An error description.
inputElementType
PrimerInputElementTypeRequired
A input element associated with the error returned.
diagnosticsId
StringRequired
A unique diagnostics id for the given error.

onMetadataChanged

Returns metadata for the current data set by using the setRawData. This synchronous callback provides immediate metadata updates based on internal SDK calculations. Check the section below for the metadata types that can be returned.

1
fun onMetadataChanged(metadata: PrimerPaymentMethodMetadata)
kotlin
copy

Parameters

onMetadataStateChanged

Returns metadata state for the current data set by using the setRawData.

In contrast to onMetadataChanged, this callback involves internal asynchronous operations, offering a broader and more accurate dataset that can be fetched remotely. Its dynamic nature enables you to access the current state of SDK operations, providing an opportunity to tailor the UI accordingly.

Check the section below for the metadata state types that can be returned.

1
fun onMetadataStateChanged(metadataState: PrimerPaymentMethodMetadataState)
kotlin
copy

Parameters

metadataState
PrimerPaymentMethodMetadataState
direct subclasses
Properties
cardNumberEntryState
PrimerCardNumberEntryStateRequired
The state of card number entry triggered the metadata fetch.
Properties
cardNumber
StringRequired
The entered card number.
Properties
cardNumberEntryState
PrimerCardNumberEntryStateRequired
The state of card number entry triggered the metadata fetch.
Properties
cardNumber
StringRequired
The entered card number.
cardNumberEntryMetadata
PrimerCardNumberEntryMetadataRequired
Represents metadata for PrimerCardNumberEntry, including selectable (co-badged) and detected card networks.
Properties
selectableCardNetworks
PrimerCardNetworksMetadata?
Selectable card networks for a given card number, will be null in case card network is not co-badged.
Properties
items
List<PrimerCardNetwork>
cardNetwork
PrimerCardNetwork
Represents a card network with metadata including display name, network type, and whether it is allowed.
network
CardNetwork.Type
The type of card network (e.g., VISA, MASTERCARD).
The human-readable name of the card network (e.g., Visa, Mastercard).
allowed
BooleanRequired
A boolean indicating whether this card network is allowed.
preferred
PrimerCardNetwork?
cardNetwork
PrimerCardNetwork
Represents a card network with metadata including display name, network type, and whether it is allowed.
network
CardNetwork.Type
The type of card network (e.g., VISA, MASTERCARD).
The human-readable name of the card network (e.g., Visa, Mastercard).
allowed
BooleanRequired
A boolean indicating whether this card network is allowed.
detectedCardNetworks
PrimerCardNetworksMetadataRequired
All detected card networks for a given card number.
Properties
items
List<PrimerCardNetwork>
cardNetwork
PrimerCardNetwork
Represents a card network with metadata including display name, network type, and whether it is allowed.
network
CardNetwork.Type
The type of card network (e.g., VISA, MASTERCARD).
The human-readable name of the card network (e.g., Visa, Mastercard).
allowed
BooleanRequired
A boolean indicating whether this card network is allowed.
preferred
PrimerCardNetwork?
cardNetwork
PrimerCardNetwork
Represents a card network with metadata including display name, network type, and whether it is allowed.
network
CardNetwork.Type
The type of card network (e.g., VISA, MASTERCARD).
The human-readable name of the card network (e.g., Visa, Mastercard).
allowed
BooleanRequired
A boolean indicating whether this card network is allowed.
source
enum ValidationSourceRequired
Enum class representing the source of validation for card metadata.
cases
The data comes from Primer API.
The data comes from the SDK if Primer's server fails to be reached. This works similarly to LOCAL.
The data comes from the SDK, usually by levering the first few digits.