{"id":3665,"library":"mypy-boto3-payment-cryptography","title":"mypy-boto3-payment-cryptography Type Stubs","description":"mypy-boto3-payment-cryptography provides type annotations for the boto3 AWS Payment Cryptography Control Plane service (version 1.42.83). It is part of the `mypy-boto3-builder` project, which automatically generates comprehensive type stubs for boto3 to enable static type checking with tools like MyPy, Pyright, and enhance IDE auto-completion. The project is actively maintained, with releases typically synchronized with upstream boto3 updates.","status":"active","version":"1.42.83","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","mypy","type-hinting","stubs","payment-cryptography"],"install":[{"cmd":"pip install mypy-boto3-payment-cryptography","lang":"bash","label":"Install service-specific stubs"},{"cmd":"pip install 'boto3-stubs[payment-cryptography]'","lang":"bash","label":"Install as part of boto3-stubs (recommended)"}],"dependencies":[{"reason":"Provides the AWS SDK for Python, which these stubs type-hint.","package":"boto3","optional":false}],"imports":[{"note":"While functional at runtime, without the explicit stub import, static type checkers cannot infer the client's methods and types, leading to a lack of auto-completion and type safety.","wrong":"import boto3\nclient = boto3.client('payment-cryptography')","symbol":"PaymentCryptographyControlPlaneClient","correct":"from mypy_boto3_payment_cryptography.client import PaymentCryptographyControlPlaneClient"},{"note":"TypedDicts for request/response payloads are located in the `type_defs` submodule for precise type hinting.","symbol":"CreateKeyInputRequestTypeDef","correct":"from mypy_boto3_payment_cryptography.type_defs import CreateKeyInputRequestTypeDef"},{"note":"Literal types (enums) are provided in the `literals` submodule for clearer type definitions.","symbol":"KeyUsageType","correct":"from mypy_boto3_payment_cryptography.literals import KeyUsageType"},{"note":"Used for instantiating clients explicitly via a session.","symbol":"Session","correct":"from boto3.session import Session"},{"note":"Recommended practice to conditionally import stubs for dev-only dependencies.","symbol":"TYPE_CHECKING","correct":"from typing import TYPE_CHECKING"}],"quickstart":{"code":"import boto3\nfrom typing import TYPE_CHECKING\n\nif TYPE_CHECKING:\n    from mypy_boto3_payment_cryptography.client import PaymentCryptographyControlPlaneClient\n    from mypy_boto3_payment_cryptography.type_defs import CreateKeyInputRequestTypeDef\n\n\ndef create_payment_cryptography_key():\n    # The 'client' variable will be type-checked as PaymentCryptographyControlPlaneClient\n    client: 'PaymentCryptographyControlPlaneClient' = boto3.client(\n        'payment-cryptography-control-plane'\n    )\n\n    key_alias = \"alias/my-test-key\"\n    \n    # Example of using a TypedDict for a request payload\n    create_key_params: CreateKeyInputRequestTypeDef = {\n        \"KeyAttributes\": {\n            \"KeyUsage\": \"TR31_K0_CARD_PROCESSING_EMV_COMPATIBILITY\",\n            \"KeyClass\": \"SYMMETRIC_KEY\",\n            \"KeyAlgorithm\": \"AES_128\",\n            \"KeyModesOfUse\": {\n                \"Encrypt\": True,\n                \"Decrypt\": True\n            }\n        },\n        \"Enabled\": True,\n        \"KeyCheckValueAlgorithm\": \"CMAC\"\n    }\n\n    try:\n        response = client.create_key(**create_key_params)\n        print(f\"Key created successfully with ARN: {response['Key']['KeyArn']}\")\n        # Type checkers will understand the structure of 'response'\n    except client.exceptions.ConflictException:\n        print(f\"Key alias {key_alias} already exists.\")\n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n\n\n# To run this example, ensure you have AWS credentials configured\n# or set environment variables like AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION.\n# Example: os.environ['AWS_REGION'] = os.environ.get('AWS_REGION', 'us-east-1')\ncreate_payment_cryptography_key()","lang":"python","description":"This quickstart demonstrates how to initialize a `PaymentCryptographyControlPlaneClient` with type hints and how to use a `TypeDef` for request parameters. The `if TYPE_CHECKING:` block ensures that `mypy-boto3-payment-cryptography` is only a development dependency. The example attempts to create a key in AWS Payment Cryptography Control Plane."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or a newer supported version.","message":"Python 3.8 support has been removed. `mypy-boto3-builder` version 8.12.0 (which generated this stub) and consequently this stub package now require Python 3.9 or newer. Ensure your environment meets this requirement.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.12.0, mypy-boto3-payment-cryptography >=1.42.83"},{"fix":"Review your code for direct imports or references to `TypeDef` objects. Update their names according to the latest generated types if you were using specific, potentially verbose, `TypeDef` names.","message":"In `mypy-boto3-builder` version 8.9.0, some generated `TypeDef` names were shortened or had conflicting postfixes moved for consistency (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`). While this specific stub is newer, direct usage of `TypeDef` names from older generated versions may break.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.9.0"},{"fix":"Ensure you are installing the correct stub package (`mypy-boto3-payment-cryptography` for Control Plane, `mypy-boto3-payment-cryptography-data` for Data Plane) based on the AWS Payment Cryptography API you intend to use.","message":"This package provides type stubs for the **Payment Cryptography Control Plane** service. If you are looking for type annotations for the **Payment Cryptography Data Plane** service, you need to install `mypy-boto3-payment-cryptography-data` instead.","severity":"gotcha","affected_versions":"All"},{"fix":"Modify your imports from `from mypy_boto3_... import ...` to include a conditional block:\n`from typing import TYPE_CHECKING`\n`if TYPE_CHECKING:`\n    `from mypy_boto3_payment_cryptography.client import PaymentCryptographyControlPlaneClient`\n\nAnd then use a forward reference for type hints: `client: 'PaymentCryptographyControlPlaneClient' = boto3.client(...)`.","message":"It is best practice to wrap `mypy-boto3` stub imports within an `if TYPE_CHECKING:` block. This prevents the stub packages from being imported at runtime, making them purely development dependencies and avoiding potential runtime issues or increased startup times in production environments.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}