> ## Documentation Index
> Fetch the complete documentation index at: https://primer.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# provide

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

```typescript TYPESCRIPT theme={"dark"}
async provide(props: ComponentWithRedirectManagerProps): Promise<BanksComponent | any>
```

## Parameters

**Parameters**

**props** `ComponentWithRedirectManagerProps` *required*

Object that provides the payment menthod type and callback functions for
handling steps, errors and validation.

**Properties**

**paymentMethodType** `string` *required*

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

**onStep** `(data: BankStep) =\> void`

Called whenever the component emits a new step. This usually happens when calling [start](#param-start) or [submit](#param-submit) or whenever the component collects data.

**Parameters**

**BanksLoading**

A type representing the loading of the bank list.

**Properties**

**stepName** `banksLoading`

The name of this component step.

**BanksRetrieved**

A type representing the list of retrieved banks.

**Properties**

**stepName** `banksRetrieved`

The name of this component step.

**banks** `IssuingBank[]` *required*

**IssuingBank**

**Properties**

**id** `string` *required*

The bank's identifier.

**name** `string` *required*

The bank's name.

**iconUrl** `string` *required*

The bank's icon url.

**disabled** `boolean` *required*

A boolean representing the bank's state.

**onError** `(error: PrimerError) =\> void`

Called to indicate that a [PrimerError](https://primer.io/docs/sdk/react-native/v2.x.x/common-objects/PrimerError.md) occurred during the component's operation.

**Parameters**

**PrimerError**

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

**errorId** `string` *required*

A unique error identifier.

**errorCode** `string`

A unique error code.

**description** `string` *required*

A error description.

**recoverySuggestion** `string`

A recovery suggestion for the given error. In case it's present, use it to try
to recover from error.

**diagnosticsId** `string`

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.
xx

**Parameters**

**PrimerInvalidComponentData\<BanksValidatableData>**

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

**Properties**

**data** `BanksValidatableData`

The data that failed validation.

**BankId**

**Properties**

**validatableDataName**

The name of this component-validatable data.

**id** `string` *required*

The id of the selected bank.

**BankListFilter**

**Properties**

**validatableDataName**

The name of this component-validatable data.

**text** `string` *required*

The text to filter the bank list by.

**errors** `PrimerValidationError[]`

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

**PrimerValidationError\[]**

**PrimerValidationError**

**Properties**

**errorId** `string`

A unique error identifier.

**description** `string`

A error description.

**diagnosticsId** `string`

A unique diagnostics id for the given error.

**onValid** `(data: PrimerValidComponentData\<BanksValidatableData\>) =\> void`

Called to indicate that the component data was successfully validated.

**Parameters**

**PrimerValidComponentData\<BanksValidatableData>**

Interface that indicates that the data has been successfully validated.

**Properties**

**data** `BanksValidatableData`

**BankId**

**Properties**

**validatableDataName**

The name of this component-validatable data.

**id** `string` *required*

The id of the selected bank.

**BankListFilter**

**Properties**

**validatableDataName**

The name of this component-validatable data.

**text** `string` *required*

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**

**PrimerValidatingComponentData\<BanksValidatableData>**

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

**Properties**

**data** `BanksValidatableData`

The data being validated.

**BankId**

**Properties**

**validatableDataName**

The name of this component-validatable data.

**id** `string` *required*

The id of the selected bank.

**BankListFilter**

**Properties**

**validatableDataName**

The name of this component-validatable data.

**text** `string` *required*

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**

**PrimerComponentDataValidationError\<BanksValidatableData>**

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

**Properties**

**data** `BanksValidatableData`

The data for which an error ocurred during validation.

**BankId**

**Properties**

**validatableDataName**

The name of this component-validatable data.

**id** `string` *required*

The id of the selected bank.

**BankListFilter**

**Properties**

**validatableDataName**

The name of this component-validatable data.

**text** `string` *required*

The text to filter the bank list by.

**error** `PrimerError`

The `PrimerError` that ocurred during the validation attempt.

**PrimerError**

**Properties**

**errorId** `string` *required*

A unique error identifier.

**errorCode** `string`

A unique error code.

**description** `string` *required*

A error description.

**recoverySuggestion** `string`

A recovery suggestion for the given error. In case it's present, use it to try
to recover from error.

**diagnosticsId** `string`

A unique diagnostics id for the given error.

## Supported payment method types

**Supported payment method types**

<table>
  <tr>
    <th>Type</th>
    <th>paymentMethodType</th>
  </tr>

  <tr>
    <td>
      [BanksComponent](https://primer.io/docs/sdk/react-native/v2.x.x/primer-headless-checkout/component-with-redirect-manager/provide.md#param-banks-component)
    </td>

    <td>
      [ADYEN\_IDEAL](https://primer.io/docs/sdk/react-native/v2.x.x/primer-headless-checkout/component-with-redirect-manager/provide.md)
    </td>
  </tr>
</table>

## Returns

An instance of a component, depending on the `paymentMethodType`:

**Common API and available components**

**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.

**Supported types**

**BanksComponent**

**API**

**handleBankChange(bankId: string)**

Update component with the selected bank id.

To validate the collected data, you can refer to the appropriate
[ComponentWithRedirectManagerProps](#param-props)
callback functions.

**handleBankFilterChange(filter: string)**

Update component with the given bank filter. Doing so will cause a call to [onStep](#param-on-step) with the filtered bank list.

To validate the collected data, you can refer to the appropriate
[ComponentWithRedirectManagerProps](#param-props)
callback functions.

## Example

```typescript TYPESCRIPT theme={"dark"}
// 👇 Add this
const 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);
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.