{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0",
    "title": "Inbound Click to Pay Card API",
    "description": "API to manage following Click to Pay use cases:\n\n- Enrol card in the Click to Pay directory.\n- Update a consumer or a card in the Click to Pay directory.\n- Opt-out a card from the Click to Pay directory.\n- get Click to Pay profiles."
  },
  "servers": [
    {
      "url": "https://api.d1.thalescloud.io/banking/v1",
      "description": "Production server"
    },
    {
      "url": "https://api.d1-stg.thalescloud.io/banking/v1",
      "description": "Staging server"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Card",
      "description": "Click to Pay operations and APIs for cards."
    },
    {
      "name": "Consumer",
      "description": "Click to Pay operations and APIs for end users (consumers)."
    }
  ],
  "paths": {
    "/issuers/{issuerId}/cards/{cardId}/operations:clickToPayEnrolment": {
      "post": {
        "summary": "Click to Pay enrol",
        "description": "This request is used by the issuer's backend to enrol the card to Click to Pay.        \n> **Note:** It cannot be used to update Click to Pay information.\n> For that, please refer to:\n> <br/> - [Click to Pay update card](https://docs.payments.thalescloud.io/click-to-pay/integrate-the-d1-api/d1-api-reference/inbound-api-to-d1/click-to-pay-api#post-issuers-issuerid-cards-cardid-operations-clicktopayupdate)\n> <br/> - [Click to Pay update consumer](https://docs.payments.thalescloud.io/click-to-pay/integrate-the-d1-api/d1-api-reference/inbound-api-to-d1/click-to-pay-api#post-issuers-issuerid-consumers-consumerid-operations-clicktopayupdate)\n\n> **Note:** If the card enrolment is not successful, D1 will end-up with a FAILED operation. But if the consumer was successfully enrolled, the [get Click to Pay profile API](d1-api-reference/inbound-api-to-d1/click-to-pay-api#get-issuers-issuerid-consumers-consumerid-clicktopayprofiles) will return a profile with the enrolled consumer and no card associated to it depending on the scheme's internal behavior. \n<!-- theme: warning -->\n> **Warning:**\n> This API does not support bulk enrolments. If you need to perform mass enrolments of cards to the Click to Pay service, it is recommended to use the [batch file registration with Click to Pay auto-enrolment](../../2.getting-started/batch/1-batch-file-overview.md). Contact your Thales representative to configure the auto-enrolment feature. ",
        "operationId": "click_to_pay_enrolment",
        "parameters": [
          {
            "$ref": "#/components/parameters/issuer-id-path"
          },
          {
            "$ref": "#/components/parameters/card-id-path"
          },
          {
            "$ref": "#/components/parameters/x-correlation-id"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "consumerInfo"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 26,
                    "example": "John Smith",
                    "pattern": "^[\\p{L}\\p{N}\\u0600-\\u06FF ,.'_#;:\\/-]{1,26}$",
                    "description": "The card holder name as present on the card. It is applicable only to Visa."
                  },
                  "billingAddress": {
                    "description": "Billing address associated to the card enrolled to Click to Pay.\n<br/>**Mandatory for Visa.**\n<br/>**Note**: When set for Mastercard, all fields inside the billingAddress must be provided, in accordance with Mastercard specification. ",
                    "type": "object",
                    "required": [
                      "countryCode"
                    ],
                    "properties": {
                      "line1": {
                        "description": "First line of the address.",
                        "type": "string",
                        "pattern": "^[\\p{L}\\p{N}\\u0600-\\u06FF ,.'_#;:\\/-]{1,64}$",
                        "minLength": 1,
                        "maxLength": 64,
                        "example": "1230 Rue de Rivoli"
                      },
                      "line2": {
                        "description": "Second line of the address.",
                        "type": "string",
                        "pattern": "^[\\p{L}\\p{N}\\u0600-\\u06FF ,.'_#;:\\/-]{1,64}$",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      "line3": {
                        "description": "Third line of the address.",
                        "type": "string",
                        "pattern": "^[\\p{L}\\p{N}\\u0600-\\u06FF ,.'_#;:\\/-]{1,64}$",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      "city": {
                        "description": "City.",
                        "type": "string",
                        "pattern": "^[\\p{L}\\p{N}\\u0600-\\u06FF ,.'_#;:\\/-]{1,32}$",
                        "minLength": 1,
                        "maxLength": 32,
                        "example": "Paris"
                      },
                      "state": {
                        "type": "string",
                        "pattern": "^[A-Z0-9]{1,3}$",
                        "minLength": 1,
                        "maxLength": 3,
                        "description": "State. Second part of ISO_3166-2 format, representing the state (country subdivision) based on the country.",
                        "example": "75"
                      },
                      "zipCode": {
                        "description": "Country zip Code.",
                        "type": "string",
                        "pattern": "^[0-9a-zA-Z ]{1,10}$",
                        "minLength": 1,
                        "maxLength": 10,
                        "example": "75000"
                      },
                      "countryCode": {
                        "type": "string",
                        "pattern": "^[A-Z]{2}$",
                        "minLength": 2,
                        "maxLength": 2,
                        "example": "FR",
                        "description": "Country code. Based on ISO 3166-1 alpha-2 format."
                      }
                    }
                  },
                  "consumerInfo": {
                    "$ref": "#/components/schemas/clickToPayConsumerInfo"
                  },
                  "reason": {
                    "$ref": "#/components/schemas/reason"
                  },
                  "reasonCode": {
                    "type": "string",
                    "enum": [
                      "ISSUER_DECISION",
                      "USER_DECISION"
                    ],
                    "description": "The reason why the action has been performed. If not provided, default reason code is ISSUER_DECISION."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Card enrolment to Click to Pay has been taken into account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/operationStatusSuccessfulPending"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request, Invalid request URI, header, paramters. The below table defines the possible 'Bad request' error:\n| errorCode      | Retryable | Comments                           |\n| -------------- | ----------| -----------------------------------|\n| -              | no        | No error details available         |\n| FIELD_INVALID_FORMAT | no  | At least one field is not in expected format as defined in this documentation |\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized request, the provided Authorization header is missing or invalid. In the table below only the field \"error\" is provided.\n| errorCode      | error       | Retryable | Comments                             |\n| -------------- | ------------| ----------| -----------------------------------|\n| AUTHORIZER_UNAUTHORIZED  | Unauthorized message | no | Access token not valid       |\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. The below table defines the possible 'Forbidden' error:\n| errorCode      | Retryable | Comments                           |\n| -------------- | ----------| -----------------------------------|\n| -              | no        | No error details available         |\n| CARD_INVALID_STATE | no    | We cannot enrol an inactive card |\n| OPERATION_NOT_ALLOWED | no | Only Visa and Mastercard cards are supported |",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          },
          "404": {
            "description": "Not Found. The below table defines the possible 'Not Found' error:\n| errorCode      | Retryable | Comments                           |\n| -------------- | ----------| -----------------------------------|\n| -              | no        | No error details available         |\n| UNKNOWN_CARD   | no        | Unknown card |\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error. The below table defines the possible 'Internal Server Error' error:\n| errorCode      | Retryable | Comments                           |\n| -------------- | ----------| -----------------------------------|\n| -              | yes       | No error details available         |\n| WRONG_CONFIGURATION | no   | At least one configuration is missing |\n| INTERNAL_ERROR      | no   | - |\n| SCHEME_ERROR        | no   | An error occured while trying to contact the scheme |\n| SCHEME_CARD_INELIGIBLE | no | Reason could be that the card is not eligible to tokenization, not configured on scheme side, or that it is expired, or inactive or... |\n| SCHEME_AMBIGUOUS_PROFILE   | no | A profile already exist but email or phonenumber does not match with already existing record |\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          }
        },
        "tags": [
          "Card"
        ]
      }
    },
    "/issuers/{issuerId}/cards/{cardId}/operations:clickToPayUpdate": {
      "post": {
        "summary": "Click to Pay update card",
        "description": "This request is used by the issuer's backend to update the card information that was pushed to Click to Pay.",
        "operationId": "click_to_pay_update_card",
        "parameters": [
          {
            "$ref": "#/components/parameters/issuer-id-path"
          },
          {
            "$ref": "#/components/parameters/card-id-path"
          },
          {
            "$ref": "#/components/parameters/x-correlation-id"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "billingAddress"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 26,
                    "example": "John Smith",
                    "pattern": "^[\\p{L}\\p{N}\\u0600-\\u06FF ,.'_#;:\\/-]{1,26}$",
                    "description": "The card holder name as present on the card. It is applicable only to Visa."
                  },
                  "billingAddress": {
                    "type": "object",
                    "description": "Billing address associated to the card enrolled to Click to Pay.                    \n<br/>**Note**: For Mastercard, all fields inside the billingAddress must be provided, in accordance with Mastercard specification.",
                    "required": [
                      "countryCode"
                    ],
                    "properties": {
                      "line1": {
                        "description": "First line of the address.",
                        "type": "string",
                        "pattern": "^[\\p{L}\\p{N}\\u0600-\\u06FF ,.'_#;:\\/-]{1,64}$",
                        "minLength": 1,
                        "maxLength": 64,
                        "example": "1230 Rue de Rivoli"
                      },
                      "line2": {
                        "description": "Second line of the address.",
                        "type": "string",
                        "pattern": "^[\\p{L}\\p{N}\\u0600-\\u06FF ,.'_#;:\\/-]{1,64}$",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      "line3": {
                        "description": "Third line of the address.",
                        "type": "string",
                        "pattern": "^[\\p{L}\\p{N}\\u0600-\\u06FF ,.'_#;:\\/-]{1,64}$",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      "city": {
                        "description": "City.",
                        "type": "string",
                        "pattern": "^[\\p{L}\\p{N}\\u0600-\\u06FF ,.'_#;:\\/-]{1,32}$",
                        "minLength": 1,
                        "maxLength": 32,
                        "example": "Paris"
                      },
                      "state": {
                        "type": "string",
                        "pattern": "^[A-Z0-9]{1,3}$",
                        "minLength": 1,
                        "maxLength": 3,
                        "description": "State. Second part of ISO_3166-2 format, representing the state (country subdivision) based on the country.",
                        "example": "75"
                      },
                      "zipCode": {
                        "description": "Country zip Code.",
                        "type": "string",
                        "pattern": "^[0-9a-zA-Z ]{1,10}$",
                        "minLength": 1,
                        "maxLength": 10,
                        "example": "75000"
                      },
                      "countryCode": {
                        "type": "string",
                        "pattern": "^[A-Z]{2}$",
                        "minLength": 2,
                        "maxLength": 2,
                        "example": "FR",
                        "description": "Country code. Based on ISO 3166-1 alpha-2 format."
                      }
                    }
                  },
                  "reason": {
                    "$ref": "#/components/schemas/reason"
                  },
                  "reasonCode": {
                    "type": "string",
                    "enum": [
                      "ISSUER_DECISION",
                      "USER_DECISION"
                    ],
                    "description": "The reason why the action has been performed. If not provided, default reason code is ISSUER_DECISION."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Card information update has been taken into account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/operationStatusSuccessfulPending"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request, Invalid request URI, header, paramters. The below table defines the possible 'Bad request' error:\n| errorCode      | Retryable | Comments                             |\n| -------------- | ----------| -----------------------------------|\n| -              | no        | No error details available         |\n| FIELD_INVALID_FORMAT |  no | At least one field is not in expected format as defined in this documentation |\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized request, the provided Authorization header is missing or invalid. In the table below only the field \"error\" is provided.\n| errorCode      | error       | Retryable | Comments                             |\n| -------------- | ------------| ----------| -----------------------------------|\n| AUTHORIZER_UNAUTHORIZED  | Unauthorized message | no | Access token not valid       |\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. The below table defines the possible 'Forbidden' error:\n| errorCode      | Retryable | Comments                             |\n| -------------- | ----------| -----------------------------------|\n| -              | no        | No error details available         |\n| OPERATION_NOT_ALLOWED | no | Only Visa and Mastercard cards are supported|",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          },
          "404": {
            "description": "Not found. The below table defines the possible 'Not found' error:\n| errorCode      | Retryable | Comments                             |\n| -------------- | ----------| -----------------------------------|\n| -              | no        | No error details available         |\n| UNKNOWN_CARD | no | The card does not exist in D1 |\n| SCHEME_ERROR        | no   | The card does not exist in Click to Pay |\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error. The below table defines the possible 'Internal Server Error' error:\n| errorCode      | Retryable | Comments                             |\n| -------------- | ----------| -----------------------------------|\n| -              | yes       | No error details available         |\n| WRONG_CONFIGURATION | no   | At least one configuration is missing |\n| INTERNAL_ERROR      | no   | - |\n| SCHEME_ERROR        | no   | An error occured while trying to contact the scheme |\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          }
        },
        "tags": [
          "Card"
        ]
      }
    },
    "/issuers/{issuerId}/cards/{cardId}/operations:clickToPayOptout": {
      "post": {
        "summary": "Click to Pay opt-out card",
        "description": "This request is used by the issuer's backend to opt-out a card that was enrolled to Click to Pay.",
        "operationId": "click_to_pay_optout_card",
        "parameters": [
          {
            "$ref": "#/components/parameters/issuer-id-path"
          },
          {
            "$ref": "#/components/parameters/card-id-path"
          },
          {
            "$ref": "#/components/parameters/x-correlation-id"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "$ref": "#/components/schemas/reason"
                  },
                  "reasonCode": {
                    "type": "string",
                    "enum": [
                      "ISSUER_DECISION",
                      "USER_DECISION"
                    ],
                    "description": "The reason why the action has been performed. If not provided, default reason code is ISSUER_DECISION."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Card opt-out from Click to Pay has been taken into account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/operationStatusSuccessfulPending"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request, Invalid request URI, header, paramters. The below table defines the possible 'Bad request' error:\n| errorCode      | Retryable | Comments                           |\n| -------------- | ----------| -----------------------------------|\n| -              | no        | No error details available         |\n| FIELD_INVALID_FORMAT | no  | At least one field is not in expected format as defined in this documentation |\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized request, the provided Authorization header is missing or invalid. In the table below only the field \"error\" is provided.\n| errorCode      | error       | Retryable | Comments                             |\n| -------------- | ------------| ----------| -----------------------------------|\n| AUTHORIZER_UNAUTHORIZED  | Unauthorized message | no | Access token not valid       |\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. The below table defines the possible 'Forbidden' error:\n| errorCode      | Retryable | Comments                           |\n| -------------- | ----------| -----------------------------------|\n| -              | no        | No error details available         |\n| OPERATION_NOT_ALLOWED | no | Only Visa and Mastercard cards are supported |",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          },
          "404": {
            "description": "Not Found. The below table defines the possible 'Not Found' error:\n| errorCode      | Retryable | Comments                           |\n| -------------- | ----------| -----------------------------------|\n| -              | no        | No error details available         |\n| UNKNOWN_CARD   | no        | Unknown card |\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error. The below table defines the possible 'Internal Server Error' error:\n| errorCode      | Retryable | Comments                           |\n| -------------- | ----------| -----------------------------------|\n| -              | yes       | No error details available         |\n| WRONG_CONFIGURATION | no   | At least one configuration is missing |\n| INTERNAL_ERROR      | no   | - |\n| SCHEME_ERROR        | no   | An error occured while trying to contact the scheme |\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          }
        },
        "tags": [
          "Card"
        ]
      }
    },
    "/issuers/{issuerId}/consumers/{consumerId}/clickToPayProfiles": {
      "get": {
        "summary": "Click to Pay get consumer profiles",
        "responses": {
          "200": {
            "description": "Profile retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "clickToPayProfiles": {
                      "type": "array",
                      "description": "The complete profile of a consumer pushed into a Click to Pay directory.",
                      "items": {
                        "type": "object",
                        "description": "The complete profile of a consumer pushed into a Click to Pay directory.",
                        "properties": {
                          "scheme": {
                            "description": "The Click to Pay directory.\r\nIt can be one of the following:\r\n- VISA\r\n- MASTERCARD",
                            "enum": [
                              "MASTERCARD",
                              "VISA"
                            ]
                          },
                          "consumerId": {
                            "$ref": "#/components/schemas/consumerId"
                          },
                          "consumerInfo": {
                            "$ref": "#/components/schemas/clickToPayConsumerInfo"
                          },
                          "cards": {
                            "description": "List of cards pushed to Click to Pay directory.",
                            "type": "array",
                            "items": {
                              "$ref": "#/components/schemas/clickToPayCard"
                            }
                          }
                        }
                      }
                    },
                    "message": {
                      "type": "string",
                      "description": "Optional string message. In case issuer is using both schemes and one of the two is returning an error, we will send back partial answer in the clickToPayProfiles array, and in this message we will giving more details on the received error. This field is for troubleshooting purposes only, it can change at any time so MUST NOT be parsed, and is not supposed to be human readable so CANNOT be displayed to end users."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request, Invalid request URI, header, paramters. The below table defines the possible 'Bad request' error:\r\n| errorCode      | Retryable | Comments                           |\r\n| -------------- | ----------| -----------------------------------|\r\n| -              | no        | No error details available         |\r\n| FIELD_INVALID_FORMAT | no  | At least one field is not in expected format as defined in this documentation |\r\n",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized request, the provided Authorization header is missing or invalid. In the table below only the field \"error\" is provided.\r\n| errorCode      | error       | Retryable | Comments                             |\r\n| -------------- | ------------| ----------| -----------------------------------|\r\n| AUTHORIZER_UNAUTHORIZED  | Unauthorized message | no | Access token not valid       |\r\n",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          },
          "404": {
            "description": "Not Found. The below table defines the possible 'Not Found' error:\n| errorCode      | Retryable | Comments                           |\n| -------------- | ----------| -----------------------------------|\n| -              | no        | No error details available         |\n| UNKNOWN_CONSUMER | no      | Unknown end user (consumer) |",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error. The below table defines the possible 'Internal Server Error' error:\n| errorCode      | Retryable | Comments                           |\n| -------------- | ----------| -----------------------------------|\n| -              | yes       | No error details available         |\n| WRONG_CONFIGURATION | no   | At least one configuration is missing |\n| INTERNAL_ERROR      | no   | - |\n| SCHEME_ERROR        | no   | An error occured while trying to contact the scheme |",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          }
        },
        "operationId": "click_to_pay_get_profiles",
        "description": "Retrieve the Click to Pay profiles for the given consumerId.\n\nThere can be one profile per scheme, at maximum.\n\nIf the end-user (consumer) exists in D1 solution but was never enrolled to Click to Pay then an empty list will be returned by the API.",
        "parameters": [
          {
            "$ref": "#/components/parameters/x-correlation-id"
          },
          {
            "$ref": "#/components/parameters/issuer-id-path"
          },
          {
            "$ref": "#/components/parameters/consumer-id-path"
          }
        ],
        "tags": [
          "Consumer"
        ]
      }
    },
    "/issuers/{issuerId}/consumers/{consumerId}/operations:clickToPayUpdate": {
      "post": {
        "summary": "Click to Pay update consumer",
        "description": "This request is used by the issuer's backend to update the end user (consumer) information that was pushed to Click to Pay.",
        "operationId": "click_to_pay_update_consumer",
        "parameters": [
          {
            "$ref": "#/components/parameters/issuer-id-path"
          },
          {
            "$ref": "#/components/parameters/consumer-id-path"
          },
          {
            "$ref": "#/components/parameters/x-correlation-id"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "consumerInfo"
                ],
                "properties": {
                  "consumerInfo": {
                    "$ref": "#/components/schemas/clickToPayConsumerInfo"
                  },
                  "billingAddress": {
                    "description": "This is an **optional** parameter, if the billing address is provided, D1 will also update the billing address for **each** cards.\n<br/>**Note**: When set for Mastercard, all fields inside the billingAddress must be provided, in accordance with Mastercard specification.",
                    "type": "object",
                    "required": [
                      "countryCode"
                    ],
                    "properties": {
                      "line1": {
                        "description": "First line of the address.",
                        "type": "string",
                        "pattern": "^[\\p{L}\\p{N}\\u0600-\\u06FF ,.'_#;:\\/-]{1,64}$",
                        "minLength": 1,
                        "maxLength": 64,
                        "example": "1230 Rue de Rivoli"
                      },
                      "line2": {
                        "description": "Second line of the address.",
                        "type": "string",
                        "pattern": "^[\\p{L}\\p{N}\\u0600-\\u06FF ,.'_#;:\\/-]{1,64}$",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      "line3": {
                        "description": "Third line of the address.",
                        "type": "string",
                        "pattern": "^[\\p{L}\\p{N}\\u0600-\\u06FF ,.'_#;:\\/-]{1,64}$",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      "city": {
                        "description": "City.",
                        "type": "string",
                        "pattern": "^[\\p{L}\\p{N}\\u0600-\\u06FF ,.'_#;:\\/-]{1,32}$",
                        "minLength": 1,
                        "maxLength": 32,
                        "example": "Paris"
                      },
                      "state": {
                        "type": "string",
                        "pattern": "^[A-Z0-9]{1,3}$",
                        "minLength": 1,
                        "maxLength": 3,
                        "description": "State. Second part of ISO_3166-2 format, representing the state (country subdivision) based on the country.",
                        "example": "75"
                      },
                      "zipCode": {
                        "description": "Country zip Code.",
                        "type": "string",
                        "pattern": "^[0-9a-zA-Z ]{1,10}$",
                        "minLength": 1,
                        "maxLength": 10,
                        "example": "75000"
                      },
                      "countryCode": {
                        "type": "string",
                        "pattern": "^[A-Z]{2}$",
                        "minLength": 2,
                        "maxLength": 2,
                        "example": "FR",
                        "description": "Country code. Based on ISO 3166-1 alpha-2 format."
                      }
                    }
                  },
                  "reason": {
                    "$ref": "#/components/schemas/reason"
                  },
                  "reasonCode": {
                    "type": "string",
                    "enum": [
                      "ISSUER_DECISION",
                      "USER_DECISION"
                    ],
                    "description": "The reason why the action has been performed. If not provided, default reason code is ISSUER_DECISION."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "End user (consumer) information update has been taken into account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/operationStatusSuccessfulPending"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request, Invalid request URI, header, paramters. The below table defines the possible 'Bad request' error:\n| errorCode      | Retryable | Comments                           |\n| -------------- | ----------| -----------------------------------|\n| -              | no        | No error details available         |\n| FIELD_INVALID_FORMAT | no  | At least one field is not in expected format as defined in this documentation |\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized request, the provided Authorization header is missing or invalid. In the table below only the field \"error\" is provided.\n| errorCode      | error       | Retryable | Comments                             |\n| -------------- | ------------| ----------| -----------------------------------|\n| AUTHORIZER_UNAUTHORIZED  | Unauthorized message | no | Access token not valid       |\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. The below table defines the possible 'Forbidden' error:\n| errorCode      | Retryable | Comments                           |\n| -------------- | ----------| -----------------------------------|\n| -              | no        | No error details available         |\n| OPERATION_NOT_ALLOWED | no | Only Visa and Mastercard cards are supported |",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          },
          "404": {
            "description": "Not Found. The below table defines the possible 'Not Found' error:\n| errorCode      | Retryable | Comments                           |\n| -------------- | ----------| -----------------------------------|\n| -              | no        | No error details available         |\n| UNKNOWN_CONSUMER | no      | The end user (consumer) does not exist in D1 |\n| SCHEME_ERROR   | no   | The end user (consumer) does not exist in Click to Pay |",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error. The below table defines the possible 'Internal Server Error' error:\n| errorCode      | Retryable | Comments                           |\n| -------------- | ----------| -----------------------------------|\n| -              | yes       | No error details available         |\n| WRONG_CONFIGURATION | no   | At least one configuration is missing |\n| INTERNAL_ERROR      | no   | - |\n| SCHEME_ERROR        | no   | An error occured while trying to contact the scheme |",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          }
        },
        "tags": [
          "Consumer"
        ]
      },
      "parameters": []
    },
    "/issuers/{issuerId}/consumers/{consumerId}/operations:clickToPayOptout": {
      "post": {
        "summary": "Click to Pay opt-out consumer",
        "description": "This request is used by the issuer's backend to opt-out a consumer that was enrolled to Click to Pay.\n\nThe consumer opt-out will opt-out the consumer and all its associated cards from  Click to Pay in one single operation. ",
        "operationId": "click_to_pay_optout_consumer",
        "parameters": [
          {
            "$ref": "#/components/parameters/issuer-id-path"
          },
          {
            "$ref": "#/components/parameters/consumer-id-path"
          },
          {
            "$ref": "#/components/parameters/x-correlation-id"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "$ref": "#/components/schemas/reason"
                  },
                  "reasonCode": {
                    "type": "string",
                    "enum": [
                      "ISSUER_DECISION",
                      "USER_DECISION"
                    ],
                    "description": "The reason why the action has been performed. If not provided, default reason code is ISSUER_DECISION."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Consumer opt-out from Click to Pay has been taken into account. \nThe opt-out can be PENDING or SUCCESSFUL. \n\nIn Case of SUCCESSFUL it can mean that:\n  - the operation is already finished and success,  \n  - the operation was already done, the consumer was already opted-out,\n  - the operation was not needed as the consumer was never enrolled to Click to Pay. ",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/operationStatusSuccessfulPending"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request, Invalid request URI, header, paramters. The below table defines the possible 'Bad request' error:\n| errorCode      | Retryable | Comments                           |\n| -------------- | ----------| -----------------------------------|\n| -              | no        | No error details available         |\n| FIELD_INVALID_FORMAT | no  | At least one field is not in expected format as defined in this documentation |\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized request, the provided Authorization header is missing or invalid. In the table below only the field \"error\" is provided.\n| errorCode      | error       | Retryable | Comments                             |\n| -------------- | ------------| ----------| -----------------------------------|\n| AUTHORIZER_UNAUTHORIZED  | Unauthorized message | no | Access token not valid       |\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          },
          "404": {
            "description": "Not Found. The below table defines the possible 'Not Found' error:\n| errorCode      | Retryable | Comments                           |\n| -------------- | ----------| -----------------------------------|\n| -              | no        | No error details available         |\n| UNKNOWN_CONSUMER   | no        | Unknown consumer, when the consumer does not exist in D1 solution |\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error. The below table defines the possible 'Internal Server Error' error:\n| errorCode      | Retryable | Comments                           |\n| -------------- | ----------| -----------------------------------|\n| -              | yes       | No error details available         |\n| WRONG_CONFIGURATION | no   | At least one configuration is missing |\n| INTERNAL_ERROR      | no   | - |\n| SCHEME_ERROR        | no   | An error occured while trying to contact the scheme |\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorGeneric"
                }
              }
            }
          }
        },
        "tags": [
          "Consumer"
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "description": "A JWT generated by the [Get Authorization Token API](oauth2-api).<br/>The server checks the validity of the provided token to control access to this protected resource. Please refer to [Get OAuth 2.0 access token](../../../integrate-the-d1-api/get-oauth-2.0-access-token) for more details on the flow and on how to get this JWT.",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    },
    "responses": {},
    "schemas": {
      "issuerId": {
        "maxLength": 10,
        "minLength": 10,
        "type": "string"
      },
      "cardId": {
        "type": "string",
        "description": "Unique identifier of the card.",
        "minLength": 1,
        "maxLength": 48,
        "pattern": "^[A-Za-z0-9_-]{1,48}$"
      },
      "clickToPayConsumerInfo": {
        "type": "object",
        "description": "The consumer details associated to the Click to Pay profile.\n",
        "required": [
          "firstName",
          "lastName",
          "language",
          "mobilePhoneNumber"
        ],
        "properties": {
          "firstName": {
            "description": "First name of the end user (consumer).",
            "type": "string",
            "pattern": "^[\\p{L}\\p{N}\\u0600-\\u06FF ,.'_#;:\\/-]{1,35}$",
            "minLength": 1,
            "maxLength": 35,
            "example": "Alexandre"
          },
          "middleName": {
            "description": "Middle name of the end user (consumer).<br/>Only applicable to Visa.",
            "type": "string",
            "pattern": "^[\\p{L}\\p{N}\\u0600-\\u06FF ,.'_#;:\\/-]{1,35}$",
            "minLength": 1,
            "maxLength": 35,
            "example": "Andrew"
          },
          "lastName": {
            "description": "Last name of the end user (consumer).",
            "type": "string",
            "pattern": "^[\\p{L}\\p{N}\\u0600-\\u06FF ,.'_#;:\\/-]{1,35}$",
            "minLength": 1,
            "maxLength": 35,
            "example": "Doe"
          },
          "language": {
            "description": "Language of the end user (consumer). Based on ISO format for language (ISO 639–1) and an alpha-2 country code (ISO 3166–1 alpha-2). The language must be lowercase, and the country must be uppercase ideally. The language and country should be separated using a minus character \"-\"",
            "type": "string",
            "pattern": "^[a-z]{2}-[a-zA-Z]{2}$",
            "minLength": 5,
            "maxLength": 5,
            "example": "en-US"
          },
          "mobilePhoneNumber": {
            "description": "Phonenumber of the end user (consumer). Shall respect the E-164 format.",
            "type": "object",
            "required": [
              "countryCode",
              "phoneNumber"
            ],
            "properties": {
              "countryCode": {
                "description": "Internantional country code of the end user's phonenumber. Shall start with the '+' sign.",
                "type": "string",
                "pattern": "^\\+[0-9]{1,10}$",
                "minLength": 2,
                "maxLength": 10,
                "example": "+33"
              },
              "phoneNumber": {
                "description": "National phonenumber of the end user. Shall not contain the first '0' of the national phonenumber. If present as input parameter, D1 will ignore it, so it will not be present in API response.",
                "type": "string",
                "pattern": "^[0-9]{1,14}$",
                "minLength": 1,
                "maxLength": 14,
                "example": "624302941"
              }
            }
          },
          "email": {
            "description": "Email of the end user (consumer).<br/>**Mandatory for Mastercard.**",
            "type": "string",
            "minLength": 6,
            "maxLength": 255,
            "pattern": "^[a-zA-Z0-9_+&*-]+(?:\\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,15}$",
            "example": "john.smith@myhostmaill.com"
          }
        }
      },
      "reason": {
        "type": "string",
        "title": "reason",
        "example": "customer was contacted on June 28",
        "pattern": "^[a-zA-Z0-9 ]{1,64}$",
        "description": "The reason why the action is performed. \n\nThis a free text field in case the bank wants to send details, that will be returned in the operations list. "
      },
      "operationId": {
        "type": "string",
        "description": "Unique identifier of the operation",
        "minLength": 1,
        "maxLength": 64,
        "pattern": "^[A-Za-z0-9_-]{1,64}$"
      },
      "operationStatusSuccessfulPending": {
        "title": "operation",
        "additionalProperties": false,
        "type": "object",
        "description": "Operation result information.",
        "properties": {
          "operationId": {
            "$ref": "#/components/schemas/operationId"
          },
          "status": {
            "type": "string",
            "description": "Status of the operation",
            "enum": [
              "PENDING",
              "SUCCESSFUL"
            ]
          }
        }
      },
      "errorGeneric": {
        "additionalProperties": false,
        "type": "object",
        "description": "Generic error returned by the APIs.",
        "properties": {
          "errorCode": {
            "type": "string",
            "description": "The type of the error",
            "example": "FIELD_INVALID_FORMAT"
          },
          "error": {
            "type": "string",
            "description": "Provide more error details if possible.<br/>For example name of the field with invalid format.<br/>This field is for troubleshooting purposes only, it can change at any time so MUST NOT be parsed, and is not supposed to be human readable so CANNOT be displayed to end users.",
            "example": "consumerId"
          }
        }
      },
      "consumerId": {
        "type": "string",
        "description": "Unique identifier of the consumer. ",
        "minLength": 1,
        "maxLength": 64,
        "pattern": "^[A-Za-z0-9_-]{1,64}$"
      },
      "clickToPayBillingAddress": {
        "type": "object",
        "description": "Billing address associated to the card enrolled to Click to Pay.",
        "required": [
          "countryCode"
        ],
        "properties": {
          "line1": {
            "description": "First line of the address.",
            "type": "string",
            "pattern": "^[\\p{L}\\p{N}\\u0600-\\u06FF ,.'_#;:\\/-]{1,64}$",
            "minLength": 1,
            "maxLength": 64,
            "example": "1230 Rue de Rivoli"
          },
          "line2": {
            "description": "Second line of the address.",
            "type": "string",
            "pattern": "^[\\p{L}\\p{N}\\u0600-\\u06FF ,.'_#;:\\/-]{1,64}$",
            "minLength": 1,
            "maxLength": 64
          },
          "line3": {
            "description": "Third line of the address.",
            "type": "string",
            "pattern": "^[\\p{L}\\p{N}\\u0600-\\u06FF ,.'_#;:\\/-]{1,64}$",
            "minLength": 1,
            "maxLength": 64
          },
          "city": {
            "description": "City.",
            "type": "string",
            "pattern": "^[\\p{L}\\p{N}\\u0600-\\u06FF ,.'_#;:\\/-]{1,32}$",
            "minLength": 1,
            "maxLength": 32,
            "example": "Paris"
          },
          "state": {
            "type": "string",
            "pattern": "^[A-Z0-9]{1,3}$",
            "minLength": 1,
            "maxLength": 3,
            "description": "State. Second part of ISO_3166-2 format, representing the state (country subdivision) based on the country.",
            "example": "75"
          },
          "zipCode": {
            "description": "Country zip Code.",
            "type": "string",
            "pattern": "^[0-9a-zA-Z ]{1,10}$",
            "minLength": 1,
            "maxLength": 10,
            "example": "75000"
          },
          "countryCode": {
            "type": "string",
            "pattern": "^[A-Z]{2}$",
            "minLength": 2,
            "maxLength": 2,
            "example": "FR",
            "description": "Country code. Based on ISO 3166-1 alpha-2 format."
          }
        }
      },
      "clickToPayCard": {
        "type": "object",
        "description": "A card that is pushed into Click to Pay.",
        "required": [
          "cardId",
          "panSuffix"
        ],
        "properties": {
          "cardId": {
            "type": "string",
            "description": "Unique identifier of the card.",
            "pattern": "[A-Za-z0-9_-]{1,48}",
            "minLength": 1,
            "maxLength": 48,
            "example": "1111-2222-3333"
          },
          "panSuffix": {
            "type": "string",
            "description": "The last four digits of the PAN.",
            "pattern": "\\d{4}",
            "example": "1254",
            "minLength": 4,
            "maxLength": 4
          },
          "exp": {
            "type": "string",
            "description": "Expiration date of the card in the format MMYY.",
            "pattern": "(0[1-9]|1[0-2])\\d{2}",
            "minLength": 4,
            "maxLength": 4,
            "example": "1240"
          },
          "digitalCardId": {
            "type": "string",
            "pattern": "[A-Za-z0-9_-]{1,64}",
            "minLength": 1,
            "maxLength": 64,
            "description": "The unique digital card ID generated by the TSP at the Click to Pay token creation.",
            "example": "FWSPMC000000000159f71f703d2141efaf04dd26803f922b"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 26,
            "example": "John Smith",
            "pattern": "^[\\p{L}\\p{N}\\u0600-\\u06FF ,.'_#;:\\/-]{1,26}$",
            "description": "The card holder name as present on the card. It is applicable only to Visa."
          },
          "billingAddress": {
            "$ref": "#/components/schemas/clickToPayBillingAddress"
          }
        }
      }
    },
    "parameters": {
      "issuer-id-path": {
        "description": "The id of the issuer",
        "in": "path",
        "name": "issuerId",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/issuerId"
        }
      },
      "card-id-path": {
        "description": "The id of the card",
        "in": "path",
        "name": "cardId",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/cardId"
        }
      },
      "x-correlation-id": {
        "description": "Random identifier which can be used to correlate the different API calls done as part of a single use-case. This identifier will be the one primarily used for troubleshooting.\n\n**Warning:** This identifier should not be derived from sensitive personal data, as its value will be logged in clear.\n\nThere is no strong guarantee of the uniqueness of this identifier, so please refrain from using it for other purpose than logging and troubleshooting.",
        "in": "header",
        "name": "x-correlation-id",
        "schema": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{1,64}$"
        }
      },
      "consumer-id-path": {
        "description": "The id of the consumer",
        "in": "path",
        "name": "consumerId",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/consumerId"
        }
      }
    }
  }
}