PaymentCryptographyDataPlane / Client / generate_card_validation_data

generate_card_validation_data#

PaymentCryptographyDataPlane.Client.generate_card_validation_data(**kwargs)#

Generates card-related validation data using algorithms such as Card Verification Values (CVV/CVV2), Dynamic Card Verification Values (dCVV/dCVV2), or Card Security Codes (CSC). For more information, see Generate card data in the Amazon Web Services Payment Cryptography User Guide.

This operation generates a CVV or CSC value that is printed on a payment credit or debit card during card production. The CVV or CSC, PAN (Primary Account Number) and expiration date of the card are required to check its validity during transaction processing. To begin this operation, a CVK (Card Verification Key) encryption key is required. You can use CreateKey or ImportKey to establish a CVK within Amazon Web Services Payment Cryptography. The KeyModesOfUse should be set to Generate and Verify for a CVK encryption key.

For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide.

Cross-account use: This operation can’t be used across different Amazon Web Services accounts.

Related operations:

See also: AWS API Documentation

Request Syntax

response = client.generate_card_validation_data(
    KeyIdentifier='string',
    PrimaryAccountNumber='string',
    GenerationAttributes={
        'AmexCardSecurityCodeVersion1': {
            'CardExpiryDate': 'string'
        },
        'AmexCardSecurityCodeVersion2': {
            'CardExpiryDate': 'string',
            'ServiceCode': 'string'
        },
        'CardVerificationValue1': {
            'CardExpiryDate': 'string',
            'ServiceCode': 'string'
        },
        'CardVerificationValue2': {
            'CardExpiryDate': 'string'
        },
        'CardHolderVerificationValue': {
            'UnpredictableNumber': 'string',
            'PanSequenceNumber': 'string',
            'ApplicationTransactionCounter': 'string'
        },
        'DynamicCardVerificationCode': {
            'UnpredictableNumber': 'string',
            'PanSequenceNumber': 'string',
            'ApplicationTransactionCounter': 'string',
            'TrackData': 'string'
        },
        'DynamicCardVerificationValue': {
            'PanSequenceNumber': 'string',
            'CardExpiryDate': 'string',
            'ServiceCode': 'string',
            'ApplicationTransactionCounter': 'string'
        }
    },
    ValidationDataLength=123
)
Parameters:
  • KeyIdentifier (string) –

    [REQUIRED]

    The keyARN of the CVK encryption key that Amazon Web Services Payment Cryptography uses to generate card data.

  • PrimaryAccountNumber (string) –

    [REQUIRED]

    The Primary Account Number (PAN), a unique identifier for a payment credit or debit card that associates the card with a specific account holder.

  • GenerationAttributes (dict) –

    [REQUIRED]

    The algorithm for generating CVV or CSC values for the card within Amazon Web Services Payment Cryptography.

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: AmexCardSecurityCodeVersion1, AmexCardSecurityCodeVersion2, CardVerificationValue1, CardVerificationValue2, CardHolderVerificationValue, DynamicCardVerificationCode, DynamicCardVerificationValue.

    • AmexCardSecurityCodeVersion1 (dict) –

      Card data parameters that are required to generate a Card Security Code (CSC2) for an AMEX payment card.

      • CardExpiryDate (string) – [REQUIRED]

        The expiry date of a payment card.

    • AmexCardSecurityCodeVersion2 (dict) –

      Card data parameters that are required to generate a Card Security Code (CSC2) for an AMEX payment card.

      • CardExpiryDate (string) – [REQUIRED]

        The expiry date of a payment card.

      • ServiceCode (string) – [REQUIRED]

        The service code of the AMEX payment card. This is different from the Card Security Code (CSC).

    • CardVerificationValue1 (dict) –

      Card data parameters that are required to generate Card Verification Value (CVV) for the payment card.

      • CardExpiryDate (string) – [REQUIRED]

        The expiry date of a payment card.

      • ServiceCode (string) – [REQUIRED]

        The service code of the payment card. This is different from Card Security Code (CSC).

    • CardVerificationValue2 (dict) –

      Card data parameters that are required to generate Card Verification Value (CVV2) for the payment card.

      • CardExpiryDate (string) – [REQUIRED]

        The expiry date of a payment card.

    • CardHolderVerificationValue (dict) –

      Card data parameters that are required to generate a cardholder verification value for the payment card.

      • UnpredictableNumber (string) – [REQUIRED]

        A random number generated by the issuer.

      • PanSequenceNumber (string) – [REQUIRED]

        A number that identifies and differentiates payment cards with the same Primary Account Number (PAN).

      • ApplicationTransactionCounter (string) – [REQUIRED]

        The transaction counter value that comes from a point of sale terminal.

    • DynamicCardVerificationCode (dict) –

      Card data parameters that are required to generate CDynamic Card Verification Code (dCVC) for the payment card.

      • UnpredictableNumber (string) – [REQUIRED]

        A random number generated by the issuer.

      • PanSequenceNumber (string) – [REQUIRED]

        A number that identifies and differentiates payment cards with the same Primary Account Number (PAN).

      • ApplicationTransactionCounter (string) – [REQUIRED]

        The transaction counter value that comes from the terminal.

      • TrackData (string) – [REQUIRED]

        The data on the two tracks of magnetic cards used for financial transactions. This includes the cardholder name, PAN, expiration date, bank ID (BIN) and several other numbers the issuing bank uses to validate the data received.

    • DynamicCardVerificationValue (dict) –

      Card data parameters that are required to generate CDynamic Card Verification Value (dCVV) for the payment card.

      • PanSequenceNumber (string) – [REQUIRED]

        A number that identifies and differentiates payment cards with the same Primary Account Number (PAN).

      • CardExpiryDate (string) – [REQUIRED]

        The expiry date of a payment card.

      • ServiceCode (string) – [REQUIRED]

        The service code of the payment card. This is different from Card Security Code (CSC).

      • ApplicationTransactionCounter (string) – [REQUIRED]

        The transaction counter value that comes from the terminal.

  • ValidationDataLength (integer) – The length of the CVV or CSC to be generated. The default value is 3.

Return type:

dict

Returns:

Response Syntax

{
    'KeyArn': 'string',
    'KeyCheckValue': 'string',
    'ValidationData': 'string'
}

Response Structure

  • (dict) –

    • KeyArn (string) –

      The keyARN of the CVK encryption key that Amazon Web Services Payment Cryptography uses to generate CVV or CSC.

    • KeyCheckValue (string) –

      The key check value (KCV) of the encryption key. The KCV is used to check if all parties holding a given key have the same key or to detect that a key has changed.

      Amazon Web Services Payment Cryptography computes the KCV according to the CMAC specification.

    • ValidationData (string) –

      The CVV or CSC value that Amazon Web Services Payment Cryptography generates for the card.

Exceptions