{"id":184,"library":"braintree","title":"Braintree Python SDK","description":"PayPal's Braintree payment gateway Python SDK. Current version: 4.42.0 (Mar 2026). Stable API — no major breaking changes from v3 to v4 for Python. SSL certificate update required: Braintree updated root SSL cert April 2024 — SDKs older than ~4.33 will fail after March 2026. Three-step flow: generate client token server-side → collect payment method nonce client-side → create transaction server-side. Amount as string. submit_for_settlement must be True to actually capture funds.","status":"active","version":"4.42.0","language":"python","source_language":"en","source_url":"https://github.com/braintree/braintree_python","tags":["braintree","payments","paypal","python","payment-gateway"],"install":[{"cmd":"pip install braintree","lang":"bash","label":"Python"}],"dependencies":[{"reason":"Required. Installed automatically.","package":"requests","optional":false}],"imports":[{"wrong":"import braintree","symbol":"BraintreeGateway","correct":"from braintree import BraintreeGateway"},{"wrong":"import braintree","symbol":"Configuration","correct":"from braintree import Configuration"},{"wrong":"import braintree","symbol":"Environment","correct":"from braintree import Environment"}],"quickstart":{"code":"# pip install braintree\nimport braintree\n\ngateway = braintree.BraintreeGateway(\n    braintree.Configuration(\n        environment=braintree.Environment.Sandbox,\n        merchant_id='your_merchant_id',\n        public_key='your_public_key',\n        private_key='your_private_key'\n    )\n)\n\n# Step 1: Generate client token for frontend\nclient_token = gateway.client_token.generate()\n# Pass client_token to frontend Braintree Drop-in UI\n\n# Step 2: Receive nonce from frontend, create transaction\nresult = gateway.transaction.sale({\n    'amount': '49.99',\n    'payment_method_nonce': 'nonce-from-frontend',\n    'options': {'submit_for_settlement': True}\n})\n\nif result.is_success:\n    print('Success:', result.transaction.id)\nelif result.transaction:\n    print('Processor error:', result.transaction.processor_response_code)\nelse:\n    for err in result.errors.deep_errors:\n        print('Validation error:', err.message)","lang":"python","description":"Braintree Python SDK — client token generation and transaction sale."},"warnings":[{"fix":"pip install --upgrade braintree","message":"SSL certificate update: Braintree updated root SSL cert April 2024. SDK versions older than ~4.33.0 will stop working after March 30, 2026. Update to latest version.","severity":"breaking","affected_versions":"< 4.33"},{"fix":"amount = f'{float_value:.2f}'","message":"Amount must be a string ('100.00'), not float or int. Passing a number raises an error or causes unexpected behavior.","severity":"gotcha","affected_versions":"all"},{"fix":"'options': {'submit_for_settlement': True}","message":"Without submit_for_settlement: True, transactions are only authorized — not captured. Funds are not collected. Must explicitly settle.","severity":"gotcha","affected_versions":"all"},{"fix":"Check both: result.transaction for processor errors, result.errors.deep_errors for validation errors.","message":"result.is_success being False doesn't always mean total failure — check result.transaction for processor decline (card declined) vs result.errors for validation errors.","severity":"gotcha","affected_versions":"all"},{"fix":"Verify your Braintree API credentials (merchant_id, public_key, private_key) are correct and correspond to the specified environment (e.g., sandbox, production). Ensure they are properly configured in your Braintree gateway initialization.","message":"AuthenticationError indicates invalid Braintree API credentials (merchant_id, public_key, private_key) or incorrect environment configuration.","severity":"breaking","affected_versions":"all"},{"fix":"Verify Braintree API credentials (Merchant ID, Public Key, Private Key) are correct and configured properly in your `braintree.Configuration` object.","message":"AuthenticationError: This typically indicates incorrect Braintree API credentials (Merchant ID, Public Key, Private Key) or an issue with their configuration. Ensure your gateway credentials are set up correctly.","severity":"breaking","affected_versions":"all"}],"env_vars":null,"search_vec":"'2024':38 '2026':15,47 '4.33':42 '4.42.0':13 'actual':80 'amount':70 'api':17 'april':37 'braintre':1,6,32,83 'break':20 'captur':81 'cert':36 'certif':29 'chang':21 'client':53,63 'client-sid':62 'collect':58 'creat':65 'current':11 'fail':44 'flow':51 'fund':82 'gateway':8,89 'generat':52 'major':19 'mar':14 'march':46 'method':60 'must':76 'nonc':61 'older':40 'payment':7,59,84,88 'payment-gateway':87 'paypal':4,85 'python':2,9,27,86 'requir':31 'root':34 'sdk':3,10 'sdks':39 'server':56,68 'server-sid':55,67 'settlement':75 'side':57,64,69 'ssl':28,35 'stabl':16 'step':50 'string':72 'submit':73 'three':49 'three-step':48 'token':54 'transact':66 'true':78 'updat':30,33 'v3':23 'v4':25 'version':12","created_at":"2026-03-25T03:08:21.482801+00:00","updated_at":"2026-04-16T00:51:33.123902+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":100,"quickstart_score":80,"quickstart_tag":"verified","pypi_latest":"4.44.0","cli_name":"","cli_version":null,"type":"library","homepage":"https://developer.paypal.com/braintree/docs/reference/overview","github":null,"docs":null,"changelog":null,"pypi":"https://pypi.org/project/braintree/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["payments"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-30","last_verified":"2026-06-30","next_check":"2026-07-30","install_tag":"verified"}}