---
title: "Encrypt the provided cardholder details with a provided encryption key."
method: POST
path: "/click-to-pay/encrypt"
tags: ["Click to Pay"]
---

# Encrypt the provided cardholder details with a provided encryption key.

`POST /click-to-pay/encrypt`

## Request

- Base URL: `https://sandbox.comcarde.com/v1`
- URL: `https://sandbox.comcarde.com/v1/click-to-pay/encrypt`
- Auth: HTTP bearer

## Request body

- ClickToPayPanEncryptionRequest
  - `card` SimpleCardData: Bare-minimum repesentation of credit/debit cards.
    - `nameOnCard` string, required: Name on the credit or debit card.
    - `pan` string, required: PAN of the credit or debit card.
    - `expiryDate` string, required: Card expiry date in MM-YY format.
    - `cv2` string
  - `billingAddress` BillingAddress
    - `firstName` string: First name of the customer. Please use only letters, spaces and these symbols: `-'.`
    - `lastName` string: Last name of the customer. Please use only letters, spaces and these symbols: `-'.`
    - `address1` string: First line of the address. Please use only letters, numbers, spaces and these symbols: `'[]()@?!\-/.,_&*:;+=`
    - `address2` string: Second line of the address. Please use only letters, numbers, spaces and these symbols: `'[]()@?!\-/.,_&*:;+=`
    - `address3` string: Third line of the address. Please use only letters, numbers, spaces and these symbols: `'[]()@?!\-/.,_&*:;+=`
    - `town` string: Town of the address. Please use only letters, numbers, spaces and these symbols: `'[]()@?!\-/.,_&*:;+=`
    - `county` string: County of the address. Please use only letters, numbers, spaces and these symbols: `'[]()@?!\-/.,_&*:;+=`
    - `postcode` string: Postcode of the address. Please use at least one and no more than 9 alphanumeric characters (excl. spaces).
    - `country` string: ISO 3166 Alpha-2 Country code
  - `session` string: Unified Click-to-Pay session JWT

## Response `200`

The card information was successfully encrypted.

- ClickToPayPanEncryptionResponse: A successful encryption response, containing the encrypted card details as well as the brand chosen to encrypt with.
  - `code` string: [Response Code](https://docs.br-dge.io/docs/response-codes) signifying the outcome of the request.
  - `message` string: A description of the outcome of the request.
  - `id` string: The ID of this request. If you can include these when querying the outcome of individual requests, we can track down the root cause faster.
  - `encryptedCard` string: A JWE containing the encrypted card details.
  - `brand` string: The card brand whose key was used to encrypted the card details.

## Other responses

- `400`: The content of the request was invalid. The provided error response object will contain infomation regarding the invalid request.
- `401`: Unauthorized request.
- `500`: An internal server error occurred upstream while processing the request. If you have any questions about why you are receiving these responses, please raise a ticket with support on the BR-DGE Support Portal at <https://comcarde.atlassian.net/servicedesk/customer/portals> with the `id` from the response so we track down the individual requests on our end.

---

[API](https://skmtc.dev/br-dge/apis/br-dge-payment-instrument-rest-api.md) - [All operations](https://skmtc.dev/br-dge/apis/br-dge-payment-instrument-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/br-dge/apis/br-dge-payment-instrument-rest-api/revisions/700277cae488?raw)
