This package provides static type checking stubs for the `braintree` Python SDK. It allows tools like Mypy and Pylance to validate type usage in your Braintree integration code, improving code quality and catching potential errors before runtime. It's maintained as part of the `typeshed` project and is updated regularly to reflect changes in the official `braintree` library. The current version is `4.42.0.20260408`.
pip install braintree types-braintreeVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to configure the Braintree gateway using environment variables and generate a client token. This code uses the actual `braintree` library; `types-braintree` merely provides static type checking for this code.
Ensure both `pip install braintree` and `pip install types-braintree` are run in your environment.
Keep both `braintree` and `types-braintree` up to date. If type errors persist for new features, consider contributing to typeshed or temporarily suppressing specific type checker errors.
Upgrade your Python environment to 3.10 or newer. If you must use an older Python version, you might need to pin `types-braintree` to an older compatible version, which might lack stubs for newer `braintree` features.
Ensure your `BRAINTREE_ENVIRONMENT` and corresponding `merchant_id`, `public_key`, `private_key` environment variables are correctly set for your target environment (Sandbox or Production).