This method allows you get a new instance of a PrimerHeadlessMainComponent
implementation.
12
@Throws(SdkUninitializedException::class, UnsupportedPaymentMethodException::class)fun <T : PrimerHeadlessMainComponent<out PrimerCollectableData, out PrimerHeadlessStep>> provide(paymentMethodType: String): T
Parameters
A unique string identifier for the payment method. Supported payment methods for current client session are returned in onAvailablePaymentMethodsLoaded callback.
Type parameters
The type of the PrimerHeadlessMainComponent
implementation to return.
Supported types
Type | paymentMethodType |
---|---|
BanksComponent | ADYEN_IDEAL |
Returns
An instance of the passed generic type T
, which could be any of the following available components:
Common API and available components
Common API
Call submit
function in order to process collected data and move component to next state.
Get a Flow of PrimerError objects that represent errors emitted by this component. Subscribers can observe and handle errors using this Flow.
Supported types
API
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.
sealed interface BanksCollectableData
Properties
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.
sealed interface BanksStep
Properties
The PrimerValidationStatus
interface encompasses a range of validation statuses.
sealed interface PrimerValidationStatus
Properties
The data being validated.
Properties
The successfully validated data.
Properties
List of PrimerValidationError
objects that represent data validation errors emitted by this component.
Properties
The data that failed validation.
Properties
The specific PrimerError
that occurred during validation.
The data for which the error occurred.
Throws
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.
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
1234567
class CheckoutActivity : AppCompatActivity() { // 👇 Add this private val banksComponent by lazy { PrimerHeadlessUniversalCheckoutComponentWithRedirectManager(viewModelStoreOwner = this) .provide(paymentMethodType = "ADYEN_IDEAL") }}