# Auto-enable single or multiple cardholders in Click to Pay
source: https://developer.mastercard.com/mastercard-processing-digital/documentation/use-cases/auto-enable-cardholders-click-to-pay/index.md

## Overview {#overview}

The use case describes the process for auto enrollment of single or multiple cardholders in Click to Pay.
Tip: You can use Mastercard Processing Digital API to check if the cardholder's cards are already enabled for Click to Pay. If that is the case, the `getTokensByClient` API will return card contracts where `walletName` = `MDES for Merchants` and `tokenRequestorId` = `50123197928`.

Preconditions:

* The issuer is de-scoped from the PCI DSS regulation (you are PAN-less issuer).
* The issuer is integrated with Mastercard Digital Enablement Service (MDES).
* The issuer is onboarded to Mastercard Click to Pay and the API keys for Enroll API have been obtained.
* The card has been issued through the Mastercard Processing Core APIs and stored in the Mastercard Processing Card Management System with a corresponding `cardContractId` and `cardContractNumber` (PAN) in an active status.

## Sequence diagram {#sequence-diagram}

Diagram auto-enable-cardholders-c2p

### Explanation {#explanation}

1. The issuer server sends the `POST` request to the Mastercard Processing Digital `/cards/searches` endpoint with the following properties:
   * `Enroll-Client-Encryption-Key` header: contains the Client Encryption Key, which you generated when requesting access to the Mastercard Enroll API in the [Mastercard Connect](https://developer.mastercard.com/issuer-enrollment/tutorial/issuer-onboarding-click2pay-production/).
   * `enrollType` = `ASYNCHRONOUS`: specifies the Enroll API mode for which the encrypted object will be generated.
   * `asynchronousRequest`: object containing
     * all properties required by the Enroll API Asynchronous for the encrypted `enrollmentData` object as indicated [here](https://developer.mastercard.com/issuer-enrollment/tutorial/perform-encryption/step2/) except:
       * `primaryAccountNumber`
       * `panExpirationMonth`
       * `panExpirationYear`
     * `cardContractId`: It is the card contract's identifier stored in the Mastercard Processing CMS that is generated and returned during the Mastercard Processing Core `createCardContract` API call.
2. The Mastercard Processing Digital API fetches PAN and `cardExpiryDate` from the CMS for the `cardContractId` sent in step 1. Tip: Make sure the card is active, as Mastercard Processing does not verify its status when obtaining PAN and expiry date from the CMS.
3. The Mastercard Processing Digital API generates, encrypted with `Enroll-Client-Encryption-Key`, `enrollmentData` containing all properties provided in the request (excluding `cardContractId`), and the PAN and card expiry date obtained in step 2.
4. The Mastercard Processing Digital API responds to the issuer server with HTTP status code `200` together with the body built in step 3. Note: A single request can contain up to 250 cards.
5. The issuer server takes encrypted `enrollmentData` object from step 4 and along with other properties required as per your integration with [Enroll API Asynchronous](https://developer.mastercard.com/issuer-enrollment/documentation/api-reference/apis/#enroll-api-asynchronous) (for example, `srcClientId`, `serviceId`, `externalBatchId`) sends the `POST` request to the `/cards/batch` Enroll API endpoint to enable card(s) for Click to Pay.
6. The Enroll API returns to the issuer server HTTP status code `202` along with the response body containing:
   * echoed `externalBatchId` assigned by the issuer server in the request
   * `batchId` assigned by the Enroll API that can be used later (step 15) to retrieve the final batch enrollment status
7. The Click to Pay initiates the tokenization process.
8. The MDES sends the pre-digitization message, Tokenization Authorization Request (TAR), to Mastercard Processing for tokenization decision.
9. After internal checks (that is, card product tokenization eligibility, card status, and expiry date) done by the Mastercard Processing CMS, the Mastercard Processing sends the TAR response to the MDES with the response code = 00, meaning that the card can be tokenized without any additional authentication.
10. The Mastercard Processing concurrently sends the TAR notification to the issuer server.
11. The MDES returns Tokenization Complete Notification (TCN) to Click to Pay confirming successful tokenization.
12. The MDES concurrently to step 11 sends the Tokenization Complete Notification (TCN) to Mastercard Processing.
13. The Mastercard Processing sends the TCN acknowledgment to MDES.
14. The Mastercard Processing concurrently to step 13 sends a TCN notification to the issuer server.
15. The issuer server sends the `GET` request to the `/cards/batch/{batchId}` Enroll API endpoint to retrieve the final status for each card provided in the enrollment batch request in step 5.
16. The Enroll API returns to the issuer server HTTP status code `200` together with the response body containing masked details for each enrolled card, along with assigned `srcDigitalCardId` and `srcConsumerId` used later to [manage enrolled card and consumer's profile in the Click to Pay](https://developer.mastercard.com/issuer-enrollment/documentation/use-cases/auto-enrollment/life_cycle/) directory.
17. The issuer system notifies cardholder after the card is auto-enrolled in Click to Pay.
18. The cardholder logs into the mobile application or website and sees Click to Pay details and all cards linked to their Click to Pay profile, as visualized [here](https://developer.mastercard.com/issuer-enrollment/documentation/use-cases/auto-enrollment/enroll_api_async/#detailed-steps). Note: Optionally, Mastercard Processing may send an SMS to inform the cardholder that their card has been added to Click to Pay.

Refer to [Sandbox testing](https://developer.mastercard.com/mastercard-processing-digital/documentation/sandbox-testing/auto-enable-cardholders-c2p/index.md) for more information on how to execute the use case in the Sandbox environment.

## Endpoints {#endpoints}

##### Enroll API-Asynchronous {#enroll-api-asynchronous}

[POST /cards/batch](https://developer.mastercard.com/issuer-enrollment/documentation/api-reference/apis/#enroll-api-asynchronous)  

[GET /cards/{batchId}](https://developer.mastercard.com/issuer-enrollment/documentation/api-reference/apis/#enroll-api-asynchronous)

<br />

##### Mastercard Processing {#mastercard-processing}


API Reference: `POST /cards/searches`

