Santander Python SDK
An unofficial Python SDK for Santander's API that simplifies integration with Santander banking services.
Features
- ✨ Authentication: Automatic token management
- 💰 Account Information: Retrieve account and workspace details
- 💸 PIX Transfers: Easy PIX payment processing
- 📑 Receipts: Query and retrieve receipts of any transaction
- 📊 Transaction History: Query and track transactions history
- 🔒 Secure: Built-in security best practices
Installation
pip install santander-python-sdk
Quick Start
from decimal import Decimal
from santander_sdk import SantanderApiClient, SantanderClientConfiguration
# Initialize the client
client = SantanderApiClient(
SantanderClientConfiguration(
client_id="your_client_id",
client_secret="your_client_secret",
cert="path_to_certificate",
base_url="api_url",
workspace_id="optional_workspace_id"
)
)
# Make a simple PIX transfer
from santander_sdk import transfer_pix
transfer = transfer_pix(
client,
pix_key="recipient@email.com",
value=Decimal("50.00"),
description="Lunch payment"
)
# Check transfer status
from santander_sdk import get_transfer
status = get_transfer(transfer["id"])
print(f"Transfer status: {status['status']}")
Advanced Usage
PIX Transfer to Bank Account
from santander_sdk import SantanderBeneficiary
# Create beneficiary
beneficiary = SantanderBeneficiary(
name="John Doe",
bankCode="404", # Santander bank code
branch="2424",
number="123456789", # Account number with check digit
type="CONTA_CORRENTE",
documentType="CPF",
documentNumber="12345678909"
)
# Make transfer
transfer = transfer_pix(
client,
beneficiary,
value=Decimal("100.00"),
description="Rent payment"
)
List Payments to get useful information
You can get the list of payments made, filtering by payment type, recipient, etc. See ListPaymentParams for all possible filters. One use case, for example, is when you want to generate a receipt but don't have the payment ID.
from santander_sdk import payment_list, ListPaymentParams
payments = payment_list(client, ListPaymentParams(
start_date="2025-01-01",
end_date="2025-01-02",
))
payment_id = payments[0]["payment"]["paymentId"]
Create a Receipt Request
Create a receipt request using the payment ID.
from santander_sdk import create_receipt
create_response = create_receipt(client, "MY-PAYMENT-ID")
The receipt creation is asynchronous on Santander. You will likely receive a response indicating that your receipt has been requested. Since the process is asynchronous, you should check back later to retrieve it.
Get the Receipt Information/URL
To obtain the receipt information, you need the payment id and the receipt_request_id (which is generated when you made the request on create_receipt).
from santander_sdk import get_receipt
receipt_info = get_receipt(client, payment_id, receipt_request_id)
print('Receipt Status:', receipt_info["status"])
print('Receipt URL Location:', receipt_info["location"])
print('Full Information:', receipt_info["data"])
Advanced usage of Receipts
Iterate Over Payments List
If the payments list is too large and you want to iterate over them, use payment_list_iter_by_pages.
from santander_sdk import payment_list_iter_by_pages, ListPaymentParams
# Filtering by one month with a return of 2 payments per page, the max per page is 1000
payments_pages = payment_list_iter_by_pages(client, ListPaymentParams(
start_date="2025-02-01",
end_date="2025-02-28",
_limit="2")
)
for page in payments_pages:
print('Page:', page)
Obtain Receipt Creation History
To obtain the history of receipt creation:
from santander_sdk.payment_receipts import receipt_creation_history
history = receipt_creation_history(client, payment_id)
print('Receipt Creation History:', history)
This function is used internally to handle cases where a receipt request has expired or encountered an error. However, you can use it to view all receipt creation requests that have been made.
Contributing
We welcome contributions! Here's how you can help:
Setting up Development Environment
- Clone the repository
git clone https://github.com/yourusername/santander-python-sdk
cd santander-python-sdk
- Create a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install development dependencies
pip install -e ".[dev]"
Development Guidelines
- Write tests for new features using pytest
- Follow PEP 8 style guide
- Add docstrings to new functions and classes
- Update documentation when adding features
Running Tests
pytest tests/
Submitting Changes
- Fork the repository
- Create a new branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Support
- 📫 Open an issue for bugs or feature requests
- 💬 Join our Discord community for discussions
- 📖 Check our FAQ for common questions
Santander oficial documentation
License
This project is licensed under the MIT License - see the LICENSE file for details.
Security
For security concerns, please email foss@buser.com.br.
Acknowledgments
- Thanks to all contributors who have helped shape this SDK
- Built with support from the Python community
⭐ If you find this SDK helpful, please star the repository!
Metadata
Release files for santander-python-sdk 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| santander_python_sdk-0.4.1.tar.gz | 51.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| santander_python_sdk-0.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 73.5 kB
Release files / santander_python_sdk-0.4.1.tar.gz
| Download URL | santander_python_sdk-0.4.1.tar.gz |
|---|---|
| Size | 51.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
80ed942151df7a6c9cf864f153c6acc26c282bc1a1e39a7adade96e96dc4ac24
|
|
BLAKE2b-256 checksum How to use checksums |
82dad3e8d260b91d9245a33428cdbd85fb912eb1e3b45779c69d0322cafbd403
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 17, 2025.
Transparency logRelease files / santander_python_sdk-0.4.1-py3-none-any.whl
| Download URL | santander_python_sdk-0.4.1-py3-none-any.whl |
|---|---|
| Size | 22.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1377c1f2de3382f9aea0c6116a879c19b50b9b8be57d8c8b59a086b0353c5ecf
|
|
BLAKE2b-256 checksum How to use checksums |
3318a28d02d506528da080ef08dc7dbdf958dee2011b0196613cdf93d8a642a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 17, 2025.
Transparency log