Skip to main content

Billingrails Python SDK

Official Python SDK for Billingrails

PyPI Version License

Installation

pip install billingrails

Quick Start

from billingrails import Billingrails

# Initialize the client
client = Billingrails(
    api_key="your-api-key",
    base_url="https://api.billingrails.com"
)

# List accounts
list_response = client.accounts.list()
print(list_response["accounts"])

# Create an account
create_response = client.accounts.create({
    "name": "John Doe",
    "email": "john@example.com",
    "country": "US",
    "default_currency": "USD"
})
print(create_response["account"])

# Retrieve an account
retrieve_response = client.accounts.retrieve("acc_123")
print(retrieve_response["account"])

# Update an account
update_response = client.accounts.update("acc_123", {
    "name": "Jane Doe"
})
print(update_response["account"])

# Get account balances
balances_response = client.accounts.get_balances("acc_123")
print(balances_response["balances"])

# Debit an account
debit_response = client.accounts.debit("acc_123", {
    "amount": 1000,  # Amount in cents
    "currency": "USD"
})
print(debit_response["balances"])

Configuration

Basic Configuration

client = Billingrails(api_key="your-api-key")

Advanced Configuration

client = Billingrails(
    api_key="your-api-key",
    base_url="https://api.billingrails.com",
    timeout=30,  # Request timeout in seconds
    max_retries=3  # Maximum number of retries for failed requests
)

Error Handling

from billingrails import Billingrails
import requests

client = Billingrails(api_key="your-api-key")

try:
    retrieve_response = client.accounts.retrieve("acc_123")
except requests.exceptions.HTTPError as e:
    print(f"HTTP error occurred: {e}")
except requests.exceptions.RequestException as e:
    print(f"Error occurred: {e}")

License

MIT - See LICENSE file for details

Support

For support, please contact ugo@billingrails.com or visit our documentation.

Metadata

Release files for billingrails 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for billingrails 0.2.2
File Size Uploaded Provenance Actions
billingrails-0.2.2.tar.gz 25.9 kB Without provenance Details for billingrails-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for billingrails 0.2.2
File Interpreter ABI Platform Actions
billingrails-0.2.2-py3-none-any.whl Python 3 none any Details for billingrails-0.2.2-py3-none-any.whl

Total release size: 99.5 kB

Release files / billingrails-0.2.2.tar.gz

Download URL billingrails-0.2.2.tar.gz
Size 25.9 kB
Tags Source
SHA-256 checksum
How to use checksums
afd41e0981a99b3035fae4b5d3fe55b0f8ef75be522d37987f0165f694a3a7e4
BLAKE2b-256 checksum
How to use checksums
5b8234b7ccb48b4ee1f18c89bcb15188ad88f5817fa22f45e3bf94fdaef0561b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release files / billingrails-0.2.2-py3-none-any.whl

Download URL billingrails-0.2.2-py3-none-any.whl
Size 73.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ea667b3cc0e997abacfa2dc703ac1df416e30da0ac36f5ec21e87a8a6ff4d0d
BLAKE2b-256 checksum
How to use checksums
4cf9d208418fc6b3322ab4cb0cc136ac7c7a7eda4477d70f6f6e29f58b93b50a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Security for billingrails 0.2.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page