This method allows you get a new instance of a component implementation.

1
async provide(props: ComponentWithRedirectManagerProps): Promise<BanksComponent | any>
typescript
copy

Parameters

props
ComponentWithRedirectManagerPropsRequired
Object that provides the payment menthod type and callback functions for handling steps, errors and validation.
Properties
paymentMethodType
stringRequired

A unique string identifier for the payment method. Supported payment methods for current client session are returned in onAvailablePaymentMethodLoad callback.

onStep
(data: BanksStep) => void

Called whenever the component emits a new step. This usually happens when calling start or submit or whenever the component collects data.

Parameters
A type representing the loading of the bank list.
Properties
stepName
banksLoading
The name of this component step.
A type representing the list of retrieved banks.
Properties
stepName
banksRetrieved
The name of this component step.
banks
IssuingBank[]Required
Properties
id
stringRequired
The bank's identifier.
name
stringRequired
The bank's name.
iconUrl
stringRequired
The bank's icon url.
disabled
booleanRequired
A boolean representing the bank's state.
onError
(error: PrimerError) => void

Called to indicate that a PrimerError occurred during the component's operation.

Parameters

The specific PrimerError that occurred during the component's operation.

errorId
stringRequired
A unique error identifier.
errorCode
string
A unique error code.
description
stringRequired
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.
onInvalid
(data: PrimerInvalidComponentData<BanksValidatableData>) => void
Called to indicate that the component data was considered invalid during validation.
Parameters

Interface that indicates that the data has been considered invalid after validation.

Properties
data
BanksValidatableData
The data that failed validation.
Properties
The name of this component-validatable data.
id
stringRequired
The id of the selected bank.
Properties
validatableDataName
bankListFilter
The name of this component-validatable data.
text
stringRequired
The text to filter the bank list by.
errors
PrimerValidationError[]

A list of PrimerValidationError explaining why the data is considered invalid.

Properties
errorId
string
A unique error identifier.
A error description.
A unique diagnostics id for the given error.
onValid
(data: PrimerValidComponentData<BanksValidatableData>) => void
Called to indicate that the component data was successfully validated.
Parameters

Interface that indicates that the data has been successfully validated.

Properties
data
BanksValidatableData
The successfully validated data.
Properties
The name of this component-validatable data.
id
stringRequired
The id of the selected bank.
Properties
validatableDataName
bankListFilter
The name of this component-validatable data.
text
stringRequired
The text to filter the bank list by.
onValidating
(data: PrimerValidatingComponentData<BanksValidatableData>) => void
Called to indicate that the component data is in the process of being validated.
Parameters

Interface that indicates that data is currently in the process of being validated.

Properties
data
BanksValidatableData
The data being validated.
Properties
The name of this component-validatable data.
id
stringRequired
The id of the selected bank.
Properties
validatableDataName
bankListFilter
The name of this component-validatable data.
text
stringRequired
The text to filter the bank list by.
onValidationError
(data: PrimerComponentDataValidationError<BanksValidatableData>) => void
Called to indicated an error that occurred during component data validation.
Parameters

Interface that represents an error that occurred during the validation process.

Properties
data
BanksValidatableData
The data for which an error ocurred during validation.
Properties
The name of this component-validatable data.
id
stringRequired
The id of the selected bank.
Properties
validatableDataName
bankListFilter
The name of this component-validatable data.
text
stringRequired
The text to filter the bank list by.
error
PrimerError

The PrimerError that ocurred during the validation attempt.

Properties
errorId
stringRequired
A unique error identifier.
errorCode
string
A unique error code.
description
stringRequired
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.

Supported payment method types

TypepaymentMethodType
BanksComponentADYEN_IDEAL

Returns

An instance of a component, depending on the paymentMethodType:

Common API and available components
Common API

Initialize the component by calling the start function. This method should be called only once.

Call submit function in order to process collected data and move component to next state.

Supported types
API

Update component with the selected bank id.

To validate the collected data, you can refer to the appropriate ComponentWithRedirectManagerProps callback functions.

Update component with the given bank filter. Doing so will cause a call to onStep with the filtered bank list.

To validate the collected data, you can refer to the appropriate ComponentWithRedirectManagerProps callback functions.

Example

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
// 👇 Add thisconst componentWithRedirectManagerProps: ComponentWithRedirectManagerProps = {    paymentMethodType: "ADYEN_IDEAL",    onStep: (data: BanksStep) => {        switch(data.stepName) {            case "banksLoading":              // Show loading indicator              break;            case "banksRetrieved":              // Render banks              break;          }    },    onError: (error: PrimerError) => {        // An error that occurred during the component's operation.    },    onInvalid: (data: PrimerInvalidComponentData<BanksValidatableData>) => {        // Data was considered invalid during validation.        switch(data.data.validatableDataName) {            case 'bankListFilter':                 // ...                break;            case 'bankId':                 // ...                break;        }    },    onValid: (data: PrimerValidComponentData<BanksValidatableData>) => {        // Data was successfully validated.        switch(data.data.validatableDataName) {            case 'bankListFilter':                 // ...                break;            case 'bankId':                 // ...                break;        }    },    onValidating: (data: PrimerValidatingComponentData<BanksValidatableData>) => {        // Data is in the process of being validated.        switch(data.data.validatableDataName) {            case 'bankListFilter':                 // ...                break;            case 'bankId':                 // ...                break;        }    },    onValidationError: (data: PrimerComponentDataValidationError<BanksValidatableData>) => {        // Error occurred during data validation.        switch(data.data.validatableDataName) {            case 'bankListFilter':                 // ...                break;            case 'bankId':                 // ...                break;        }    },};const componentWithRedirectManager = new ComponentWithRedirectManager();const banksComponent: BanksComponent = await componentWithRedirectManager.provide(componentWithRedirectManagerProps);
typescript
copy