Package com.stripe.android.ui.core.elements

Types

Link copied to clipboard
class AddressController(val fieldsFlowable: Flow<List<SectionFieldElement>>) : SectionFieldErrorController

This is the controller for a section with a changing number and set of fields. This is in contrast to the SectionController which is a section in which the fields in it do not change.

Link copied to clipboard
open class AddressElement(    _identifier: IdentifierSpec,     addressFieldRepository: AddressFieldElementRepository,     rawValuesMap: Map<IdentifierSpec, String?> = emptyMap(),     countryCodes: Set<String> = emptySet(),     countryDropdownFieldController: DropdownFieldController = DropdownFieldController( CountryConfig(countryCodes), rawValuesMap[IdentifierSpec.Country] )) : SectionMultiFieldElement
Link copied to clipboard
data class AddressSpec(val identifier: IdentifierSpec, val countryCodes: Set<String>) : SectionFieldSpec
Link copied to clipboard
data class AffirmHeaderElement(val identifier: IdentifierSpec, val controller: Controller? = null) : FormElement
Link copied to clipboard
data class AfterpayClearpayHeaderElement(    val identifier: IdentifierSpec,     amount: Amount,     val controller: Controller? = null) : FormElement
Link copied to clipboard

A text field configuration for an AU bank account number

Link copied to clipboard
Link copied to clipboard
data class AuBecsDebitMandateTextElement(    val identifier: IdentifierSpec,     val merchantName: String?,     val controller: InputController? = null) : FormElement

This is an element that has static text because it takes no user input, it is not outputted from the list of form field values. If the stringResId contains a %s, the first one will be populated in the form with the merchantName parameter.

Link copied to clipboard
data class BankDropdownSpec(    val identifier: IdentifierSpec,     @StringRes val label: Int,     val bankType: SupportedBankType) : SectionFieldSpec
Link copied to clipboard
data class BankRepository @Inject constructor(val resources: Resources?)
Link copied to clipboard
class BsbConfig(banks: List<BecsDebitBanks.Bank>) : TextFieldConfig

A text field configuration for a BSB number, or Bank State Branch Number, a six-digit number used to identify the individual branch of an Australian financial institution

Link copied to clipboard
class BsbElement(    identifierSpec: IdentifierSpec,     banks: List<BecsDebitBanks.Bank>,     initialValue: String?) : FormElement
Link copied to clipboard
data class BsbSpec(val api_path: IdentifierSpec = IdentifierSpec.Generic("au_becs_debit[bsb_number]")) : FormItemSpec, RequiredItemSpec, Parcelable
Link copied to clipboard
class CardBillingAddressElement(    val identifier: IdentifierSpec,     rawValuesMap: Map<IdentifierSpec, String?> = emptyMap(),     addressFieldRepository: AddressFieldElementRepository,     countryCodes: Set<String> = emptySet(),     countryDropdownFieldController: DropdownFieldController = DropdownFieldController( CountryConfig(countryCodes), rawValuesMap[IdentifierSpec.Country] )) : AddressElement

This is a special type of AddressElement that removes fields from the address based on the country. It is only intended to be used with the card payment method.

Link copied to clipboard
data class CardBillingSpec(val identifier: IdentifierSpec = IdentifierSpec.Generic("card_billing"), val countryCodes: Set<String>) : SectionFieldSpec
Link copied to clipboard
class CardDetailsSectionController(context: Context, initialValues: Map<IdentifierSpec, String?>) : SectionFieldErrorController
Link copied to clipboard
class CardDetailsSectionElement(    val context: Context,     initialValues: Map<IdentifierSpec, String?>,     val identifier: IdentifierSpec,     val controller: CardDetailsSectionController = CardDetailsSectionController(context, initialValues)) : FormElement
Link copied to clipboard
data class CardDetailsSectionSpec(val identifier: IdentifierSpec) : FormItemSpec

Section containing card details form

Link copied to clipboard
interface Controller

This is a generic controller

Link copied to clipboard
class CountryConfig(val onlyShowCountryCodes: Set<String> = emptySet(), val locale: Locale = Locale.getDefault()) : DropdownConfig

This is the configuration for a country dropdown.

Link copied to clipboard
data class CountryElement(val identifier: IdentifierSpec, val controller: DropdownFieldController) : SectionSingleFieldElement
Link copied to clipboard
data class CountrySpec(val onlyShowCountryCodes: Set<String> = emptySet()) : SectionFieldSpec

This is the specification for a country field.

Link copied to clipboard
interface DropdownConfig
Link copied to clipboard
class DropdownFieldController(config: DropdownConfig, initialValue: String? = null) : InputController, SectionFieldErrorController

This class controls the dropdown view and implements the InputController interface. Because it can never be in error the errorMessage is always null. It is also designed to always have a value selected, so isComplete is always true.

Link copied to clipboard
data class DropdownItemSpec(val value: String?, val text: String)
Link copied to clipboard
class EmailConfig : TextFieldConfig
Link copied to clipboard
data class EmailElement(val identifier: IdentifierSpec, val controller: TextFieldController) : SectionSingleFieldElement
Link copied to clipboard
object EmailSpec : SectionFieldSpec
Link copied to clipboard
data class EmbeddableImage(@DrawableRes val id: Int, @StringRes val contentDescription: Int)
Link copied to clipboard
data class EmptyFormElement(val identifier: IdentifierSpec = IdentifierSpec.Generic("empty_form"), val controller: Controller? = null) : FormElement
Link copied to clipboard
class FieldError(@StringRes val errorMessage: Int, val formatArgs: Array<out Any>? = null)

Encapsulates an error message including the string resource and the variable arguments

Link copied to clipboard
sealed class FormElement

This is used to define each section in the visual form layout. Each item in the layout has an identifier and a controller associated with it.

Link copied to clipboard
sealed class FormItemSpec : Parcelable

This is used to define each section in the visual form layout specification

Link copied to clipboard
class IbanConfig : TextFieldConfig

A text field configuration for an IBAN, or International Bank Account Number, as defined in ISO 13616-1.

Link copied to clipboard
object IbanSpec : SectionFieldSpec
Link copied to clipboard
sealed class IdentifierSpec : Parcelable

This uniquely identifies a element in the form. The objects here are for identifier specs that need to be found when pre-populating fields, or when extracting data.

Link copied to clipboard

This class provides the logic behind the fields.

Link copied to clipboard

This is the specification for a klarna country field

Link copied to clipboard
object KlarnaHelper
Link copied to clipboard
data class LayoutFormDescriptor(    val layoutSpec: LayoutSpec?,     val showCheckbox: Boolean,     val showCheckboxControlledFields: Boolean)
Link copied to clipboard
data class LayoutSpec : Parcelable

This is a data representation of the layout of UI fields on the screen.

Link copied to clipboard
data class MandateTextElement(    val identifier: IdentifierSpec,     val stringResId: Int,     val merchantName: String?,     val controller: InputController? = null) : FormElement
Link copied to clipboard
class NameConfig : TextFieldConfig
Link copied to clipboard
class OTPController(val otpLength: Int = 6) : Controller
Link copied to clipboard
data class OTPElement(val identifier: IdentifierSpec, val controller: OTPController) : FormElement
Link copied to clipboard
object OTPSpec : FormItemSpec, RequiredItemSpec
Link copied to clipboard
interface RequiredItemSpec : Parcelable

Identifies a field that can be made hidden.

Link copied to clipboard
Link copied to clipboard
class RowElement(    _identifier: IdentifierSpec,     val fields: List<SectionSingleFieldElement>,     val controller: RowController) : SectionMultiFieldElement
Link copied to clipboard
class SaveForFutureUseController(saveForFutureUseInitialValue: Boolean) : InputController
Link copied to clipboard
data class SaveForFutureUseElement(    val identifier: IdentifierSpec,     val controller: SaveForFutureUseController,     val merchantName: String?) : FormElement

This is an element that will make elements (as specified by identifier) hidden when "save for future" use is unchecked

Link copied to clipboard

This is an element that will make elements (as specified by identifier) hidden when save for future use is unchecked

Link copied to clipboard
class SectionController(@StringRes val label: Int?, val sectionFieldErrorControllers: List<SectionFieldErrorController>) : Controller

This is the controller for a section with a static number of fields.

Link copied to clipboard
data class SectionElement(    val identifier: IdentifierSpec,     val fields: List<SectionFieldElement>,     val controller: SectionController) : FormElement
Link copied to clipboard
interface SectionFieldElement
Link copied to clipboard
interface SectionFieldErrorController : Controller

Any element in a section must have a controller that provides an error and have a type. This is used for a single field in a section or a section field that has other fields in it.

Link copied to clipboard
sealed class SectionFieldSpec : Parcelable

This represents a field in a section.

Link copied to clipboard
sealed class SectionMultiFieldElement : SectionFieldElement
Link copied to clipboard
sealed class SectionSingleFieldElement : SectionFieldElement

This is an element that is in a section and accepts user input.

Link copied to clipboard
data class SectionSpec(    val api_path: IdentifierSpec,     val fields: List<SectionFieldSpec>,     @StringRes val title: Int? = null) : FormItemSpec, RequiredItemSpec, Parcelable

This represents a section in a form that contains other elements

Link copied to clipboard
class SimpleDropdownConfig(@StringRes val label: Int, items: List<DropdownItemSpec>) : DropdownConfig
Link copied to clipboard
data class SimpleDropdownElement(val identifier: IdentifierSpec, val controller: DropdownFieldController) : SectionSingleFieldElement
Link copied to clipboard
class SimpleTextFieldConfig(    @StringRes val label: Int,     val capitalization: KeyboardCapitalization = KeyboardCapitalization.Words,     val keyboard: KeyboardType = KeyboardType.Text) : TextFieldConfig
Link copied to clipboard
class SimpleTextFieldController(    textFieldConfig: TextFieldConfig,     val showOptionalLabel: Boolean = false,     initialValue: String? = null) : TextFieldController, SectionFieldErrorController

This class will provide the onValueChanged and onFocusChanged functionality to the field's composable. These functions will update the observables as needed. It is responsible for exposing immutable observers for its data

Link copied to clipboard
data class SimpleTextSpec(    val identifier: IdentifierSpec,     @StringRes val label: Int,     val capitalization: KeyboardCapitalization,     val keyboardType: KeyboardType,     val showOptionalLabel: Boolean = false) : SectionFieldSpec
Link copied to clipboard
data class StaticTextElement(    val identifier: IdentifierSpec,     val stringResId: Int,     val controller: InputController? = null) : FormElement

This is an element that has static text because it takes no user input, it is not outputted from the list of form field values. If the stringResId contains a %s, the first one will be populated in the form with the merchantName parameter.

Link copied to clipboard
Link copied to clipboard
interface TextFieldConfig
Link copied to clipboard
Link copied to clipboard
data class TextFieldIcon(    @DrawableRes val idRes: Int,     @StringRes val contentDescription: Int? = null,     val isIcon: Boolean)
Link copied to clipboard
interface TextFieldState

This represents the different states a field can be in, in each of these cases there might be a reason to show the error in a different way. This interface separates how the state is implemented from what information is required by clients of the interface. This will allow the implementation to change without impacting the clients.

Functions

Link copied to clipboard
fun AffirmElementUI()
Link copied to clipboard
fun AfterpayClearpayElementUI(enabled: Boolean, element: AfterpayClearpayHeaderElement)
Link copied to clipboard
fun AuBecsDebitMandateElementUI(element: AuBecsDebitMandateTextElement)
Link copied to clipboard
fun BsbElementUI(    enabled: Boolean,     element: BsbElement,     lastTextFieldIdentifier: IdentifierSpec?)
Link copied to clipboard
fun CardDetailsSectionElementUI(    enabled: Boolean,     controller: CardDetailsSectionController,     hiddenIdentifiers: List<IdentifierSpec>?)
Link copied to clipboard
fun H4Text(text: String, modifier: Modifier = Modifier)
Link copied to clipboard
fun H6Text(text: String, modifier: Modifier = Modifier)
Link copied to clipboard
fun Html(    html: String,     imageGetter: Map<String, EmbeddableImage>,     modifier: Modifier = Modifier,     color: Color,     style: TextStyle)
Link copied to clipboard
fun MandateTextUI(element: MandateTextElement)
Link copied to clipboard
fun OTPElementUI(    enabled: Boolean,     element: OTPElement,     modifier: Modifier = Modifier,     colors: TextFieldColors = TextFieldColors())
Link copied to clipboard
fun SaveForFutureUseElementUI(enabled: Boolean, element: SaveForFutureUseElement)
Link copied to clipboard
fun SectionCard(    modifier: Modifier = Modifier,     isSelected: Boolean = false,     content: @Composable () -> Unit)

This is the layout for the section card.

Link copied to clipboard
fun SectionElementUI(    enabled: Boolean,     element: SectionElement,     hiddenIdentifiers: List<IdentifierSpec>,     lastTextFieldIdentifier: IdentifierSpec?)
Link copied to clipboard
fun SimpleDialogElementUI(    openDialog: MutableState<Boolean>,     titleText: String,     messageText: String,     confirmText: String,     dismissText: String,     onConfirmListener: () -> Unit = {},     onDismissListener: () -> Unit = {})
Link copied to clipboard
fun StaticElementUI(element: StaticTextElement)

Properties

Link copied to clipboard
const val SAVE_FOR_FUTURE_CHECKBOX_TEST_TAG: String