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 supports cross-account use when the key has a resource-based policy that grants access. For more information, see Resource-based policies.
Related operations:
Parameters:
-
key_identifier
(KeyArnOrKeyAliasType)
–
The keyARN of the CVK encryption key that Amazon Web Services Payment Cryptography uses to generate card data.
-
primary_account_number
(PrimaryAccountNumberType)
–
The Primary Account Number (PAN), a unique identifier for a payment credit or debit card that associates the card with a specific account holder.
-
generation_attributes
(CardGenerationAttributes)
–
The algorithm for generating CVV or CSC values for the card within Amazon Web Services Payment Cryptography.
-
validation_data_length
(Optional[IntegerRangeBetween3And5Type], default:
None
)
–
The length of the CVV or CSC to be generated. The default value is 3.
Raises:
Source code in docs_src/capo_payment_cryptography_data/_services/payment_cryptography_data.py
| def generate_card_validation_data(
self,
key_identifier: "capo_payment_cryptography_data.types.key_arn_or_key_alias_type.KeyArnOrKeyAliasType",
primary_account_number: "capo_payment_cryptography_data.types.primary_account_number_type.PrimaryAccountNumberType",
generation_attributes: "capo_payment_cryptography_data.types.card_generation_attributes.CardGenerationAttributes",
*,
config_overrides: Optional[PaymentCryptographyDataClientConfig] = None,
validation_data_length: Optional[
"capo_payment_cryptography_data.types.integer_range_between3_and5_type.IntegerRangeBetween3And5Type"
] = None,
) -> "capo_payment_cryptography_data.types.generate_card_validation_data_output.GenerateCardValidationDataOutput":
"""<p>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 <a href="https://docs.aws.amazon.com/payment-cryptography/latest/userguide/generate-card-data.html">Generate card data</a> in the <i>Amazon Web Services Payment Cryptography User Guide</i>.</p> <p>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 <a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_CreateKey.html">CreateKey</a> or <a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_ImportKey.html">ImportKey</a> to establish a CVK within Amazon Web Services Payment Cryptography. The <code>KeyModesOfUse</code> should be set to <code>Generate</code> and <code>Verify</code> for a CVK encryption key. </p> <p>For information about valid keys for this operation, see <a href="https://docs.aws.amazon.com/payment-cryptography/latest/userguide/keys-validattributes.html">Understanding key attributes</a> and <a href="https://docs.aws.amazon.com/payment-cryptography/latest/userguide/crypto-ops-validkeys-ops.html">Key types for specific data operations</a> in the <i>Amazon Web Services Payment Cryptography User Guide</i>. </p> <p> <b>Cross-account use</b>: This operation supports cross-account use when the key has a resource-based policy that grants access. For more information, see <a href="https://docs.aws.amazon.com/payment-cryptography/latest/userguide/security_iam_resource-based-policies.html">Resource-based policies</a>.</p> <p> <b>Related operations:</b> </p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_ImportKey.html">ImportKey</a> </p> </li> <li> <p> <a>VerifyCardValidationData</a> </p> </li> </ul>
Args:
key_identifier: <p>The <code>keyARN</code> of the CVK encryption key that Amazon Web Services Payment Cryptography uses to generate card data.</p>
primary_account_number: <p>The Primary Account Number (PAN), a unique identifier for a payment credit or debit card that associates the card with a specific account holder.</p>
generation_attributes: <p>The algorithm for generating CVV or CSC values for the card within Amazon Web Services Payment Cryptography.</p>
validation_data_length: <p>The length of the CVV or CSC to be generated. The default value is 3.</p>
Raises:
capo_payment_cryptography_data.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
capo_payment_cryptography_data.errors.internal_server_exception.InternalServerException: <p>The request processing has failed because of an unknown error, exception, or failure.</p>
capo_payment_cryptography_data.errors.resource_not_found_exception.ResourceNotFoundException: <p>The request was denied due to an invalid resource error.</p>
capo_payment_cryptography_data.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
capo_payment_cryptography_data.errors.validation_exception.ValidationException: <p>The request was denied due to an invalid request error.</p>
capo_payment_cryptography_data.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_payment_cryptography_data.types.generate_card_validation_data_input.GenerateCardValidationDataInput]",
) -> OperationResponse[
"capo_payment_cryptography_data.types.generate_card_validation_data_output.GenerateCardValidationDataOutput"
]:
import capo_payment_cryptography_data._operations.payment_cryptography_data_plane.generate_card_validation_data
output, http_response = (
capo_payment_cryptography_data._operations.payment_cryptography_data_plane.generate_card_validation_data.generate_card_validation_data(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
def _redact_input(
input_: "capo_payment_cryptography_data.types.generate_card_validation_data_input.GenerateCardValidationDataInput",
) -> dict[str, Any]:
import capo_payment_cryptography_data.types.generate_card_validation_data_input
return capo_payment_cryptography_data.types.generate_card_validation_data_input.redact_sensitive(
input_
)
def _redact_output(
output: "capo_payment_cryptography_data.types.generate_card_validation_data_output.GenerateCardValidationDataOutput",
) -> dict[str, Any]:
import capo_payment_cryptography_data.types.generate_card_validation_data_output
return capo_payment_cryptography_data.types.generate_card_validation_data_output.redact_sensitive(
output
)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging(
"GenerateCardValidationData",
redact_input=_redact_input,
redact_output=_redact_output,
),
)
input_: capo_payment_cryptography_data.types.generate_card_validation_data_input.GenerateCardValidationDataInput = {
"key_identifier": key_identifier,
"primary_account_number": primary_account_number,
"generation_attributes": generation_attributes,
}
if validation_data_length is not None:
input_["validation_data_length"] = validation_data_length
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|