# Enable Consumer Credentials in a Batch
source: https://developer.mastercard.com/issuer-enrollment/documentation/use-cases/auto-enrollment/enroll_api_async/index.md

This use case helps issuers enroll consumer credentials into their credential directory at scale. After the issuer submits the required consumer and credential data through the asynchronous [Batch Enroll API](https://developer.mastercard.com/issuer-enrollment/documentation/api-reference/apis/index.md#batch-enroll-api), Mastercard links eligible credentials to the credential directory so consumers can access them through the issuer's banking app or website and use them across supported digital commerce experiences, such as Click to Pay.

![Auto-enablement user flow in an issuer&rsquo;s app](https://static.developer.mastercard.com/content/issuer-enrollment/documentation/img/issuer-enablement-user-flow.png "Auto-enablement user flow")

### Prerequisites {#prerequisites}

Before implementing asynchronous credential enrollment, complete the following setup steps:

1. Complete platform onboarding.
   * Ensure your organization has been onboarded and approved to use Mastercard Credential Directory services. For more information, see the onboarding tutorials for [Sandbox](https://developer.mastercard.com/issuer-enrollment/documentation/tutorials-and-guides/issuer-onboarding-click2pay-tutorial/index.md) and [Production](https://developer.mastercard.com/issuer-enrollment/documentation/tutorials-and-guides/issuer-onboarding-click2pay-production-tutorial/index.md) environments.
   * Confirm that your application has the required credentials and access permissions. For more information, see the [Key Management](https://developer.mastercard.com/issuer-enrollment/documentation/tutorials-and-guides/key-management-click2pay-tutorial/index.md) tutorial.
2. Update the required Terms and Conditions to offer Mastercard Credential Services as a default feature in your core banking product before going into production.
3. Encrypt the `enrollmentData` object before you send it in the Batch Enroll API request. See the [Perform Encryption](https://developer.mastercard.com/issuer-enrollment/documentation/tutorials-and-guides/perform-encryption-tutorial/index.md#step-2-encrypt-an-object) tutorial for step-by-step instructions.

## Batch Enrollment Workflow {#batch-enrollment-workflow}

Use the Batch Enroll API to submit one or more consumer credentials for asynchronous processing.
Diagram batch-enroll-workflow

1. Send a POST request to the [/credentials/batch](https://developer.mastercard.com/issuer-enrollment/documentation/api-reference/apis/index.md#batchCredentialsInDirectory) endpoint.  

   See the endpoint structure:


   API Reference: `POST /client-directories/{directoryId}/credentials/batch`

   <br />

   Generate an `externalBatchID` and include it in the API request with the `directoryId` and `srcClientId`. If Mastercard accepts the request, the response returns the `batchId` and `externalBatchId`.  

   Include the following data in the `enrollmentData` object:

   <br />

   * At least one email address or mobile number with country code. You may provide both contact types, with multiple values for each type, if available.
   * Credential details, including Primary Account Number and expiry date.
   * Cardholder address.
   * Cardholder first and last name.
   * Locale, including country and language.
   * `externalCredentialId` for each credential in the batch.
   * `externalConsumerId` for each consumer in the batch.
   * `preferredFor`, if applicable.
   * Compliance settings, if applicable.   

2. Use the returned `batchId` to [get the batch status](https://developer.mastercard.com/issuer-enrollment/documentation/use-cases/auto-enrollment/batch_status/index.md).

3. After Mastercard links the eligible credentials to the issuer's credential directory, consumers can access them through the issuer's banking app or website and use them across supported digital commerce experiences, such as Click to Pay.

Note:   

* Eligible cards must tokenize successfully without declines.
* Linked credentials may take some time to appear because batch enrollment is asynchronous.
* Consumers can opt out of any digital commerce experience after enablement.   

  For more details, see [FAQs](https://developer.mastercard.com/issuer-enrollment/documentation/support/index.md#related-to-auto-enablement).

## Using Enabled Credentials for Click to Pay Checkout {#using-enabled-credentials-for-click-to-pay-checkout}

After successful enablement into the issuer's credential directory, consumers can use their enabled profile for Click to Pay checkout. Depending on the issuer implementation, first-time checkout may require cardholders to accept the Click to Pay Terms and Privacy Notice or complete additional authentication after selecting a card.

![tnc First Time User](https://static.developer.mastercard.com/content/issuer-enrollment/documentation/img/tnc_firsTimeCheckout2.png "Mastercard Click to Pay First time checkout auto enrollment")

If the issuer does not provide all required data during enablement, Mastercard may collect the missing information during checkout and, with the issuer's permission, update the cardholder's directory profile with the user-provided information. This can happen when issuers enroll cardholders using only the identifiers available in their systems.

Mastercard updates and stores the data only if:

* The issuer has delegated directory management for required fields to Mastercard under the applicable contractual Terms and Conditions.
* The consumer consents during checkout to store their profile data with the issuer.   

Otherwise, Mastercard uses the collected data only for that checkout session and does not save it.

## Error Resolution {#error-resolution}

For details on error resolution please visit our [codes and formats](https://developer.mastercard.com/issuer-enrollment/documentation/code-and-formats/index.md) section.

## Next Steps {#next-steps}

* Check the batch enrollment status. For more information, see [Check Batch Enrollment Status](https://developer.mastercard.com/issuer-enrollment/documentation/use-cases/auto-enrollment/batch_status/index.md).
* Retrieve, update, or delete a consumer's profile or associated credentials. For more information, see [Manage Consumer Profiles and Credentials](https://developer.mastercard.com/issuer-enrollment/documentation/use-cases/auto-enrollment/life_cycle/index.md).
