Braintree provides a Python module that simplifies dealing with its API. The source code is located at https://github.com/braintree/braintree_python. We are going to integrate the payment gateway into our project using the braintree module.
Install the braintree module from the shell using the following command:
pip install braintree==3.45.0
Add the following settings to the settings.py file of your project:
# Braintree settingsBRAINTREE_MERCHANT_ID = 'XXX' # Merchant IDBRAINTREE_PUBLIC_KEY = 'XXX' # Public KeyBRAINTREE_PRIVATE_KEY = 'XXX' # Private keyfrom braintree import Configuration, EnvironmentConfiguration.configure( Environment.Sandbox, BRAINTREE_MERCHANT_ID, BRAINTREE_PUBLIC_KEY, BRAINTREE_PRIVATE_KEY ...