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.1.8.tar.gz (22.3 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.1.8-py3-none-any.whl (62.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for billingrails-0.1.8.tar.gz
Algorithm Hash digest
SHA256 479d2c406f91007ca5170e38196cbd5d431e085082ab98a4b20494fc2a30202a
MD5 a6ecbcd8477bb72cacf883a85d40f6f6
BLAKE2b-256 77ef4e87d499b5c85ed40e1802d6529e373a6fc65bd626c3f541cb4613ffe876

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for billingrails-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 f8f0101f4071f8e7ae1095f811f53e1e3ee1cedbe2187e72d847f11ba183815b
MD5 f8be18410657e0749c4e74b16d33478d
BLAKE2b-256 3dc5213ca7b1b92b4fb27354d7757107f7e96e3514e2f4ad2132c92accfa6473

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