PrimerHeadlessMainComponent
implementation.
KOTLIN
Copy
Ask AI
@Throws(SdkUninitializedException::class, UnsupportedPaymentMethodException::class)
fun <T : PrimerHeadlessMainComponent<out PrimerCollectableData, out PrimerHeadlessStep>> provide(paymentMethodType: String): T
Parameters
Hide Parameters
Hide Parameters
A unique string identifier for the payment method. Supported payment methods for current client session are returned in onAvailablePaymentMethodsLoaded callback.
Type parameters
Hide Type parameters
Hide Type parameters
The type of the PrimerHeadlessMainComponent
implementation to
return.
Hide Supported types
Hide Supported types
Type | paymentMethodType |
---|---|
BanksComponent | ADYEN_IDEAL |
Returns
An instance of the passed generic typeT
, which could be any of the following available components:
Hide Common API and available components
Hide Common API and available components
Show Common API
Show Common API
start()
Initialize the component by calling the start function. This method should be called only once.
submit()
Call
submit
function in order to process collected data and move component to next state.componentError: Flow<PrimerError>
Get a Flow
of PrimerError objects that represent errors emitted by this component.
Subscribers can observe and handle errors using this Flow.
Hide Supported types
Hide Supported types
Show API
Show API
updateCollectedData(collectableData: BanksCollectableData)
Update component with collected data by passing implementations of sealed interface.
This method can be called at any point, even if you have only partially collected data.
To validate the partially collected data, you can refer to the
componentValidationStatus
and receive the validation status when it’s updated.
Show sealed interface BanksCollectableData
Show sealed interface BanksCollectableData
componentStep: Flow<BanksStep>
BanksStep
is a class holding different output data for specific steps. Whenever
start or submit methods are
called, componentStep
will trigger the next step in case the call to the mentioned method was successful.
Show sealed interface BanksStep
Show sealed interface BanksStep
Loading
Object signifing that the list of available banks is in the process of being loaded.
BanksRetrieved
A data class representing the step of emitting the list of available banks.
Hide Properties
Hide Properties
The list of available banks.
componentValidationStatus: Flow<PrimerValidationStatus<BanksCollectableData>>
The
PrimerValidationStatus
interface encompasses a range of validation statuses.Show sealed interface PrimerValidationStatus
Show sealed interface PrimerValidationStatus
Validating<BanksCollectableData>
Indicates that data is currently in the process of being validated.
Hide Properties
Hide Properties
The data being validated.
Valid<BanksCollectableData>
Indicates that the data has successfully been validated.
Hide Properties
Hide Properties
The successfully validated data.
Invalid<BanksCollectableData>
Indicates that the data has been considered invalid after validation.
Hide Properties
Hide Properties
List of
PrimerValidationError
objects that represent data validation errors emitted by this component.The data that failed validation.
Error<BanksCollectableData>
Represents the status when an error occurred during the validation process.
Hide Properties
Hide Properties
The specific
PrimerError
that occurred during validation.Show PrimerValidationError
Show PrimerValidationError
A unique error identifier.
A unique error code.
A error description.
A recovery suggestion for the given error. In case it’s present, use it to try
to recover from error.
A unique diagnostics id for the given error.
The data for which the error occurred.
Throws
Hide Throws
Hide Throws
SdkUninitializedException
An exception that will be thrown in case the SDK was not initialized properly.
Before calling any of the manager’s method, the SDK must be initialized using start method.
UnsupportedPaymentMethodException
An exception that will be thrown in case the initialization of the manager has been done using unsupported
paymentMethodType
- PrimerHeadlessMainComponent
combination.
Supported payment methods for current client session are returned
in onAvailablePaymentMethodsLoaded callback. See Supported types for the supported combinations.Example
KOTLIN
Copy
Ask AI
class CheckoutActivity : AppCompatActivity() {
// 👇 Add this
private val banksComponent by lazy {
PrimerHeadlessUniversalCheckoutComponentWithRedirectManager(viewModelStoreOwner = this)
.provide(paymentMethodType = "ADYEN_IDEAL")
}
}