Skip to main content

Official Python SDK for Billingrails API

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

billingrails-0.2.2.tar.gz (25.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

billingrails-0.2.2-py3-none-any.whl (73.7 kB view details)

Uploaded Python 3

File details

Details for the file billingrails-0.2.2.tar.gz.

File metadata

  • Download URL: billingrails-0.2.2.tar.gz
  • Upload date:
  • Size: 25.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for billingrails-0.2.2.tar.gz
Algorithm Hash digest
SHA256 afd41e0981a99b3035fae4b5d3fe55b0f8ef75be522d37987f0165f694a3a7e4
MD5 54418bcdb0f8bc91062422e8250b6e36
BLAKE2b-256 5b8234b7ccb48b4ee1f18c89bcb15188ad88f5817fa22f45e3bf94fdaef0561b

See more details on using hashes here.

File details

Details for the file billingrails-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: billingrails-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 73.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for billingrails-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1ea667b3cc0e997abacfa2dc703ac1df416e30da0ac36f5ec21e87a8a6ff4d0d
MD5 de6ab362c0c038cf7d31f9e3238062c2
BLAKE2b-256 4cf9d208418fc6b3322ab4cb0cc136ac7c7a7eda4477d70f6f6e29f58b93b50a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page