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

export const collectableData = "BanksCollectableData";

This method allows you get a new instance of a `PrimerHeadlessMainComponent` implementation.

```kotlin KOTLIN theme={"dark"}
@Throws(SdkUninitializedException::class, UnsupportedPaymentMethodException::class)
fun <T : PrimerHeadlessMainComponent<out PrimerCollectableData, out PrimerHeadlessStep>> provide(paymentMethodType: String): T
```

## Parameters

<Expandable title="Parameters" defaultOpen>
  <ResponseField name="paymentMethodType" type="String" required>
    A unique string identifier for the payment method. Supported payment methods for current client session are returned in [onAvailablePaymentMethodsLoaded](/sdk/android/v2.x.x/primer-headless-checkout/listeners/PrimerHeadlessUniversalCheckoutListener#onavailablepaymentmethodsloaded) callback.
  </ResponseField>
</Expandable>

## Type parameters

<Expandable title="Type parameters" defaultOpen>
  <ResponseField name="T" type="PrimerHeadlessMainComponent<out PrimerCollectableData, out PrimerHeadlessStep>" required>
    <p>
      The type of the <code>PrimerHeadlessMainComponent</code> implementation to
      return.
    </p>

    <Expandable title="Supported types" defaultOpen>
      <table style={{width: "100%", borderCollapse: "collapse", borderSpacing: "0"}}>
        <tr style={{backgroundColor: "#f1f1f1", width: "100%"}}>
          <th style={{padding: "10px", textAlign: "left", width: "100%"}}>Type</th>
          <th style={{padding: "10px", textAlign: "left", width: "100%"}}>paymentMethodType</th>
        </tr>

        <tr style={{width: "100%"}}>
          <td style={{padding: "10px"}}>
            <a style={{color: "#0070f3", fontSize: "14px", textDecoration: "none", fontWeight: "500"}} href={`/sdk/android/v2.x.x/primer-headless-checkout/component-with-redirect-manager/provide#param-banks-component`}>
              BanksComponent
            </a>
          </td>

          <td style={{padding: "10px", width: "100%"}}>
            <a style={{color: "#0070f3", fontSize: "14px", textDecoration: "none", fontWeight: "500"}} href="/connections/payment-methods/available-payment-methods">
              ADYEN\_IDEAL
            </a>
          </td>
        </tr>
      </table>
    </Expandable>
  </ResponseField>
</Expandable>

## Returns

An instance of the passed generic type `T`, which could be any of the following available components:

<Expandable title="Common API and available components" defaultOpen>
  <ResponseField name="PrimerHeadlessMainComponent" type="Implemented by all components">
    <Expandable title="Common API">
      <ResponseField name="start()">
        Initialize the component by calling the start function. This method should be called only once.
      </ResponseField>

      <ResponseField name="submit()">
        Call `submit` function in order to process collected data and move component to next state.
      </ResponseField>

      <ResponseField name="componentError: Flow<PrimerError>">
        Get a [Flow](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/)
        of [PrimerError](/sdk/android/v2.x.x/common-objects/PrimerError) objects that represent errors emitted by this component.
        Subscribers can observe and handle errors using this Flow.
      </ResponseField>
    </Expandable>
  </ResponseField>

  <Expandable title="Supported types" defaultOpen>
    <ResponseField name="BanksComponent" type="PrimerHeadlessMainComponent<BanksCollectableData, BanksStep>">
      <Expandable title="API">
        <ResponseField name="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](#component-validation-status-flow-primer-validation-status-nol-pay-link-collectable-data)
          and receive the validation status when it's updated.

          <Expandable title="sealed interface BanksCollectableData">
            <ResponseField name="Filter">
              Data class representing the collected bank list filter.

              <Expandable title="Properties" defaultOpen>
                <ResponseField name="query" type="String">
                  A string representing the query by which the bank list should be filtered.
                </ResponseField>
              </Expandable>
            </ResponseField>

            <ResponseField name="BankId">
              Data class representing the collected bank id.

              <Expandable title="Properties" defaultOpen>
                <ResponseField name="id" type="String">
                  The id of the bank to use when processing the payment.
                </ResponseField>
              </Expandable>
            </ResponseField>
          </Expandable>
        </ResponseField>

        <ResponseField name="componentStep: Flow<BanksStep>">
          <p>
            <code>BanksStep</code> is a class holding different output data for specific steps. Whenever{' '}
            <a href={`#param-start`}>start</a> or <a href={`#param-submit`}>submit</a> methods are
            called, <code>componentStep</code> will trigger the next step in case the call to the mentioned method was successful.
          </p>

          <Expandable title="sealed interface BanksStep">
            <ResponseField name="Loading">
              Object signifing that the list of available banks is in the process of being loaded.
            </ResponseField>

            <ResponseField name="BanksRetrieved">
              A data class representing the step of emitting the list of available banks.

              <Expandable title="Properties" defaultOpen>
                <ResponseField name="banks" type="List<IssuingBank>">
                  The list of available banks.

                  <Expandable title="Properties">
                    <ResponseField name="IssuingBank">
                      <Expandable title="Properties">
                        <ResponseField name="id" type="String" required>
                          String representing the bank id.
                        </ResponseField>

                        <ResponseField name="name" type="String" required>
                          String representing the bank name.
                        </ResponseField>

                        <ResponseField name="disabled" type="Boolean" required>
                          Boolean indicating whether the bank is disabled or not.
                        </ResponseField>

                        <ResponseField name="iconUrl" type="String" required>
                          A string representing the icon url.
                        </ResponseField>
                      </Expandable>
                    </ResponseField>
                  </Expandable>
                </ResponseField>
              </Expandable>
            </ResponseField>
          </Expandable>
        </ResponseField>

        <ResponseField name={`componentValidationStatus: Flow<PrimerValidationStatus<${collectableData}>>`}>
          The `PrimerValidationStatus` interface encompasses a range of validation statuses.

          <Expandable title="sealed interface PrimerValidationStatus">
            <ResponseField name={`Validating<${collectableData}>`}>
              Indicates that data is currently in the process of being validated.

              <Expandable title="Properties" defaultOpen>
                <ResponseField name="collectableData" type={`${collectableData}`}>
                  The data being validated.
                </ResponseField>
              </Expandable>
            </ResponseField>

            <ResponseField name={`Valid<${collectableData}>`}>
              Indicates that the data has successfully been validated.

              <Expandable title="Properties" defaultOpen>
                <ResponseField name="collectableData" type={`${collectableData}`}>
                  The successfully validated data.
                </ResponseField>
              </Expandable>
            </ResponseField>

            <ResponseField name={`Invalid<${collectableData}>`}>
              Indicates that the data has been considered invalid after validation.

              <Expandable title="Properties" defaultOpen>
                <ResponseField name="validationErrors" type="List<PrimerValidationError>">
                  List of `PrimerValidationError` objects that represent data validation errors emitted by this component.

                  <Expandable title="PrimerValidationError">
                    <ResponseField name="List<PrimerValidationError>">
                      <Expandable title="Type">
                        <ResponseField name="PrimerValidationError">
                          <Expandable title="Properties">
                            <ResponseField name="errorId" type="String" required>
                              A unique error identifier.
                            </ResponseField>

                            <ResponseField name="description" type="String" required>
                              A error description.
                            </ResponseField>

                            <ResponseField name="diagnosticsId" type="String" required>
                              A unique diagnostics id for the given error.
                            </ResponseField>
                          </Expandable>
                        </ResponseField>
                      </Expandable>
                    </ResponseField>
                  </Expandable>
                </ResponseField>

                <ResponseField name="collectableData" type={`${collectableData}`}>
                  The data that failed validation.
                </ResponseField>
              </Expandable>
            </ResponseField>

            <ResponseField name={`Error<${collectableData}>`}>
              Represents the status when an error occurred during the validation process.

              <Expandable title="Properties" defaultOpen>
                <ResponseField name="error" type="PrimerError">
                  The specific `PrimerError` that occurred during validation.

                  <Expandable title="PrimerValidationError">
                    <ResponseField name="errorId" type="String" required>
                      A unique error identifier.
                    </ResponseField>

                    <ResponseField name="errorCode" type="String?">
                      A unique error code.
                    </ResponseField>

                    <ResponseField name="description" type="String" required>
                      A error description.
                    </ResponseField>

                    <ResponseField name="recoverySuggestion" type="String?">
                      A recovery suggestion for the given error. In case it's present, use it to try
                      to recover from error.
                    </ResponseField>

                    <ResponseField name="diagnosticsId" type="String" required>
                      A unique diagnostics id for the given error.
                    </ResponseField>
                  </Expandable>
                </ResponseField>

                <ResponseField name="collectableData" type={`${collectableData}`}>
                  The data for which the error occurred.
                </ResponseField>
              </Expandable>
            </ResponseField>
          </Expandable>
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</Expandable>

## Throws

<Expandable title="Throws" defaultOpen>
  <ResponseField name="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](/sdk/android/v2.x.x/primer-headless-checkout/methods/start) method.
  </ResponseField>

  <ResponseField name="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](/sdk/android/v2.x.x/primer-headless-checkout/listeners/PrimerHeadlessUniversalCheckoutListener#onavailablepaymentmethodsloaded) callback. See [Supported types](/sdk/android/v2.x.x/primer-headless-checkout/component-with-redirect-manager/provide#type-parameters) for the supported combinations.
  </ResponseField>
</Expandable>

## Example

```kotlin KOTLIN theme={"dark"}
class CheckoutActivity : AppCompatActivity() {
  // 👇 Add this
  private val banksComponent by lazy {
	PrimerHeadlessUniversalCheckoutComponentWithRedirectManager(viewModelStoreOwner = this)
            .provide(paymentMethodType = "ADYEN_IDEAL")
  }
}
```
