preferredScheme

Allows to provide a preferred scheme that will be used for card tokenization by default. Response must be constructed from request that has been collected by subscribing to preferredSchemeRequest.

viewModelScope.launch {
with(ProcessOut.instance.dispatchers.cardTokenization) {
preferredSchemeRequest.collect { request ->
// Inspect issuer information to choose a default preferred scheme.
val preferredScheme = when (request.issuerInformation.scheme) {
"visa", "mastercard" -> request.issuerInformation.coScheme
else -> request.issuerInformation.scheme
}
// Send the response with preferred scheme which must be constructed from request.
// Note that once you've subscribed to 'preferredSchemeRequest' it's required to send response back.
// Implementation will use primary scheme if 'preferredScheme' is null.
preferredScheme(request.toResponse(preferredScheme = preferredScheme))
}
}
}