A Python SDK for integrating with the Barte payment platform API. This library provides a simple and efficient way to interact with Barte's payment services, allowing you to process payments, manage transactions, and handle customer data securely.
- Simple and intuitive API client
- Secure payment processing
- Card tokenization support
- Comprehensive error handling
- Type hints for better development experience
pip install barte-python-sdk
from barte import BarteClient
# Initialize the client
client = BarteClient(api_key="your_api_key", environment="sandbox")
# Create a card token
buyer = client.get_buyer({"documentNumber": "00011122233"})
card_token = client.create_card_token({
"holderName": "Barte Card Test",
"number": "5383638854440891",
"cvv": "220",
"expiration": "12/2025",
"buyerUuid": buyer.uuid,
})
- OpenAPI Documentation - Complete API reference
- Integration Guide - Detailed integration guide with examples and best practices
To run the test suite, follow these steps:
- Run tests using pytest:
uv run pytest tests/ -v --cov=barte --cov-report=xml
You can find example implementations in the examples
directory. To run the examples:
- Clone the repository:
git clone https://github.com/buser-brasil/barte-python-sdk.git
cd barte-python-sdk
- Run specific examples:
uv run examples/card_token_example.py
Make sure to set up your API credentials before running the examples.
We welcome contributions! Here's how you can help:
- Fork the repository
- Create your feature branch:
git checkout -b feature/amazing-feature
- Install development dependencies:
uv sync
- Make your changes and ensure tests pass
- Commit your changes:
git commit -m 'Add amazing feature'
- Push to the branch:
git push origin feature/amazing-feature
- Open a Pull Request
- Follow PEP 8 style guide
- Add tests for new features
- Update documentation as needed
- Use type hints
- Write meaningful commit messages
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or need support, please open an issue on GitHub or contact our support team.