# Integrate with Mastercard Virtual Card Tokens source: https://developer.mastercard.com/mastercard-checkout-solutions/documentation/tutorials-and-guides/integrate-apis-mvct-tutorial/index.md Use this tutorial to learn about the required steps to integrate with Mastercard Virtual Card Tokens. ## 1. Onboard to Mastercard Checkout Solutions {#1-onboard-to-mastercard-checkout-solutions} You should work with your [Mastercard representative](https://developer.mastercard.com/mastercard-checkout-solutions/documentation/support/index.md#get-help) to complete all the onboarding activities. ## 2. Integrate the APIs {#2-integrate-the-apis} * To get started with the API integration, you can generate an API client using an [OpenAPI Generator](https://openapi-generator.tech/), which provides generators and library templates for supporting multiple languages and frameworks. * To help you sign requests and perform payload encryption/decryption, Mastercard provides [client authentication libraries](https://github.com/Mastercard?q=oauth1-signer) and [encryption libraries](https://github.com/Mastercard?&q=client-encryption). * Follow the steps in [Generating and Configuring a Mastercard API Client](https://developer.mastercard.com/platform/documentation/security-and-authentication/generating-and-configuring-a-mastercard-api-client/) tutorial to enable authentication and perform encryption/decryption. * Mastercard supports two protocols for authenticating client applications to integrate with Mastercard APIs. Learn more on \[API Basics\]/documentation/api-basics/ page. Note: **In case of OAuth Authentication:** * Site identifier `X-Src-Cx-Flow-Id` is added as a part of all inbound API response headers for resolving site affinity issues on subsequent calls. * When making back-to-back API calls, the client must include the `X-Src-Cx-Flow-Id` of the initial API response in the header of the subsequent API request. This ensures that the consecutive API calls will be sent to the same Mastercard server that returned the initial response. ## 3. Call the APIs {#3-call-the-apis} The general API execution flow is explained below: 1. Call the [Enroll Card](https://developer.mastercard.com/mastercard-checkout-solutions/documentation/api-reference/apis/index.md#card) API and retrieve the `srcDigitalCardId` associated with the consumer's profile, `maskedCard` and `maskedConsumer` details. 2. Next, call the [Checkout](https://developer.mastercard.com/mastercard-checkout-solutions/documentation/api-reference/apis/index.md#checkout) API using `srcDigitalCardId` retrieved from [Enroll Card](https://developer.mastercard.com/mastercard-checkout-solutions/documentation/api-reference/apis/index.md#card) API with `dynamicDataType` = `DYNAMIC_CARD_SECURITY_CODE` to retrieve the transaction credentials from Mastercard Checkout Solutions. The checkout response will include the static token, token expiry and Dynamic Token Verification Code (DTVC) in the `dynamicData` within the `encryptedPayload` object. 3. Configure your notification URL in the [Card Notifications](https://developer.mastercard.com/mastercard-checkout-solutions/documentation/api-reference/apis/index.md#notifications) API to receive lifecycle management notifications relating to a token or the underlying payment account, such as updates on card details and PAN expiration. 4. Mastercard Checkout Solutions sends transaction notifications to the Integrator via [Push Transaction Details](https://developer.mastercard.com/mastercard-checkout-solutions/documentation/api-reference/index.md#push-transaction-details) API if the transaction includes a valid DTVC, provided the Issuer of the card used to make payment supports Transaction Detail Service (TDS). ## 4. Decrypt the Payload {#4-decrypt-the-payload} Decrypt the `encryptedPayload` using your private key from the Payload Encryption public / private key pair. Mastercard uses the public key of this key-pair to encrypt response payloads containing payment card credentials. See [Key Management](https://developer.mastercard.com/mastercard-checkout-solutions/documentation/tutorials-and-guides/key-management-tutorial/index.md) to understand more about which keys to use to decrypt the payload. The payload will be returned in the most secure format possible and in accordance with the `dynamicData.dynamicDataType` parameter passed as `DYNAMIC_CARD_SECURITY_CODE` in the [Checkout](https://developer.mastercard.com/mastercard-checkout-solutions/documentation/api-reference/apis/index.md#checkout) API. | dynamicDataType | Description | Payload format | |----------------------------|---------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | DYNAMIC_CARD_SECURITY_CODE | Payment authorization using token \& DTVC passed in **token** and **dynamicData** objects respectively. | **DTVC** : Dynamic Token Verification Code (DTVC) is a one-time dynamic verification code. The code is 3-digits in length. Integrators should pass this value in the CVC2 field during payment authorization. This field is received in the [Checkout](https://developer.mastercard.com/mastercard-checkout-solutions/documentation/api-reference/apis/index.md#checkout) API. |