Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

braintree python client library

2.29.0

latest commit a9dbe300b3
Braintree Open Source braintreeps authored
Octocat-spinner-32 braintree 2.29.0
Octocat-spinner-32 docs 2.18.0
Octocat-spinner-32 tests 2.29.0
Octocat-spinner-32 .gitignore 2.21.0
Octocat-spinner-32 CHANGELOG.md 2.29.0
Octocat-spinner-32 LICENSE 1.0.0
Octocat-spinner-32 MANIFEST.in 1.0.0
Octocat-spinner-32 README.md Add open source attribution.
Octocat-spinner-32 Rakefile 2.20.0
Octocat-spinner-32 ci.sh 2.20.0
Octocat-spinner-32 setup.py 2.25.0
README.md

Braintree Python Client Library

The Braintree library provides integration access to the Braintree Gateway.

Dependencies

Note: Although discouraged, the dependency on PycURL / requests can be bypassed during development or for deployment on servers where they are impossible to use via:

# Allow unsafe SSL, removes dependency on PycURL in dev environments
braintree.Configuration.use_unsafe_ssl = True

Documentation

Quick Start Example

import braintree

braintree.Configuration.configure(
    braintree.Environment.Sandbox,
    "your_merchant_id",
    "your_public_key",
    "your_private_key"
)

result = braintree.Transaction.sale({
    "amount": "1000.00",
    "credit_card": {
        "number": "4111111111111111",
        "expiration_date": "05/2012"
    }
})

if result.is_success:
    print "success!: " + result.transaction.id
elif result.transaction:
    print "Error processing transaction:"
    print "  code: " + result.transaction.processor_response_code
    print "  text: " + result.transaction.processor_response_text
else:
    for error in result.errors.deep_errors:
        print "attribute: " + error.attribute
        print "  code: " + error.code
        print "  message: " + error.message

Open Source Attribution

A list of open source projects that help power Braintree can be found here.

License

See the LICENSE file.

Something went wrong with that request. Please try again.