# Generate Cryptogram

**POST** `/dpm/tsp/v1/tokenization/crypt`

Base URL: `https://api.pre.globalgetnet.com`

__Generate Cryptogram__<br><br>This endpoint requests a cryptogram from the card brand's Token Service Provider (TSP) for a previously generated network token. Send the cryptogram in the `tokenization` object of the payment request.<br><br>**Usage Scenarios:**<br>- Obtaining the cryptogram required to authorize a payment made with a network token.<br><br>**Notes:**<br>- The `network_token_id` sent here must come from [Generate Network Token](#tag/network-token/post/dpm/tsp/v1/tokenization/token).<br>- The token and cryptogram must come from the same TSP; Getnet cannot process a token and cryptogram issued by different providers.

## Authorization

- PROD (oauth2)
- PRE (oauth2)
- SBX (oauth2)

## Body

Content type: `application/json`

- `network_token_id` (string, required)
  Value of the `network_token_id` returned by Generate Network Token.
- `transaction_type` (string, required)
  Indicates whether the transaction was initiated by the customer or by the merchant.
- `cryptogram_type` (string, required)
  Brand-specific cryptogram type requested from the TSP.
- `amount` (integer, required)
  Transaction amount, in cents, that the cryptogram is generated for.
- `customer_id` (string)
  Buyer identifier. Application-defined information that consumes the Digital Platform API.
- `email` (string)
  Buyer's email address.
- `card_brand` (string, required)
  Card brand of the network token the cryptogram is generated for.
- `currency_code` (string, required)
  ISO 4217 numeric currency code for the transaction the cryptogram is generated for.

Example:

```json
{
  "network_token_id": "e2f8d96768a84a02b82f7ba1d079b05c",
  "transaction_type": "CIT",
  "cryptogram_type": "VISA_TAVV",
  "amount": 9000,
  "customer_id": "088442880012",
  "email": "user@email.com",
  "card_brand": "visa",
  "currency_code": "968"
}
```

## Responses

### 200

Cryptogram generated successfully.

- `cryptogram` (string, required)
  Cryptogram value generated by the TSP for the given network token and transaction. Send it in the payment request's `tokenization.cryptogram` field.
- `token_pan_card` (string, required)
  Network token PAN issued by the card brand's Token Service Provider (TSP). Use it in the payment request's `card.number` field in place of the raw PAN.
- `token_expiration_month` (string, required)
  Two-digit expiration month of the network token.
- `token_expiration_year` (string, required)
  Four-digit expiration year of the network token.
- `token_status` (string, required)
  Status of the network token.

Example:

```json
{
  "cryptogram": "MF5GJksAAJU1ASH4Eo7gAAADFAM=",
  "token_pan_card": "5204731618934544",
  "token_expiration_month": "12",
  "token_expiration_year": "2030",
  "token_status": "ACTIVE"
}
```

### 400

Invalid request.

- `message` (string)
  Detailed error message.
- `name` (string)
  Name of the module or service that returned the error.
- `status_code` (integer<int32>)
  HTTP status code of the error.
- `details` (object[])
  Network tokenization error details.
  - `status` (string)
    Error situation.
  - `error_code` (string)
    Error code.
  - `description` (string)
    Short description of the error.
  - `description_detail` (string)
    Specific reason the network token or cryptogram request failed, naming the invalid field or the token service provider's denial reason.

Example:

```json
{
  "message": "Unprocessable Entity",
  "name": "GatewayParametersServiceError",
  "status_code": 422,
  "details": [
    {
      "status": "DENIED",
      "error_code": "TOKENIZATION-422",
      "description": "Unprocessable Entity",
      "description_detail": "The card is not enrolled for network tokenization with this card brand's token service provider."
    }
  ]
}
```

### 401

Invalid Authentication.

- `message` (string)
  Detailed error message.
- `name` (string)
  Name of the module or service that returned the error.
- `status_code` (integer<int32>)
  HTTP status code of the error.
- `details` (object[])
  Network tokenization error details.
  - `status` (string)
    Error situation.
  - `error_code` (string)
    Error code.
  - `description` (string)
    Short description of the error.
  - `description_detail` (string)
    Specific reason the network token or cryptogram request failed, naming the invalid field or the token service provider's denial reason.

Example:

```json
{
  "message": "Unprocessable Entity",
  "name": "GatewayParametersServiceError",
  "status_code": 422,
  "details": [
    {
      "status": "DENIED",
      "error_code": "TOKENIZATION-422",
      "description": "Unprocessable Entity",
      "description_detail": "The card is not enrolled for network tokenization with this card brand's token service provider."
    }
  ]
}
```

### 422

Unprocessable Entity

- `message` (string)
  Detailed error message.
- `name` (string)
  Name of the module or service that returned the error.
- `status_code` (integer<int32>)
  HTTP status code of the error.
- `details` (object[])
  Network tokenization error details.
  - `status` (string)
    Error situation.
  - `error_code` (string)
    Error code.
  - `description` (string)
    Short description of the error.
  - `description_detail` (string)
    Specific reason the network token or cryptogram request failed, naming the invalid field or the token service provider's denial reason.

Example:

```json
{
  "message": "Unprocessable Entity",
  "name": "GatewayParametersServiceError",
  "status_code": 422,
  "details": [
    {
      "status": "DENIED",
      "error_code": "TOKENIZATION-422",
      "description": "Unprocessable Entity",
      "description_detail": "The card is not enrolled for network tokenization with this card brand's token service provider."
    }
  ]
}
```

### 500

Internal server or service error.

- `message` (string)
  Detailed error message.
- `name` (string)
  Name of the module or service that returned the error.
- `status_code` (integer<int32>)
  HTTP status code of the error.
- `details` (object[])
  Network tokenization error details.
  - `status` (string)
    Error situation.
  - `error_code` (string)
    Error code.
  - `description` (string)
    Short description of the error.
  - `description_detail` (string)
    Specific reason the network token or cryptogram request failed, naming the invalid field or the token service provider's denial reason.

Example:

```json
{
  "message": "Unprocessable Entity",
  "name": "GatewayParametersServiceError",
  "status_code": 422,
  "details": [
    {
      "status": "DENIED",
      "error_code": "TOKENIZATION-422",
      "description": "Unprocessable Entity",
      "description_detail": "The card is not enrolled for network tokenization with this card brand's token service provider."
    }
  ]
}
```