Skip to main content

Huakunjingxiu Billing SDK

Project description

A1 Huakunjingxiu Billing SDK

Python SDK for interacting with the A1 Huakunjingxiu Billing API.

项目结构

billing-sdk/
├── billing/                      # 主应用目录
│   ├── product/                 # 产品模块
│   │   ├── __init__.py
│   │   └── schemas.py
│   ├── transaction/             # 交易模块
│   │   ├── __init__.py
│   │   └── schemas.py
│   ├── __init__.py
│   ├── exceptions.py
│   ├── http.py
│   └── schemas.py
├── tests/                       # 测试目录
│   └── test_transaction_create.py
├── docs/                        # 文档目录
├── examples/                    # 示例目录
│   ├── product/                 # 产品示例
│   │   ├── __init__.py
│   │   └── create_token_example.py
│   ├── transaction/             # 交易示例
│   │   ├── __init__.py
│   │   └── create_transaction_example.py
│   ├── __init__.py
│   └── README.md
├── .clinerules
├── .cursorrules
├── .gitignore
├── .pre-commit-config.yaml
├── LICENSE
├── pyproject.toml
├── README.md
└── uv.lock

运行示例

运行示例代码前需要设置PYTHONPATH环境变量:

$env:PYTHONPATH=$PWD
uv run examples/product/create_token_example.py
export PYTHONPATH=$(pwd)
uv run examples/product/create_token_example.py

Installation

pip install billing-sdk

Usage

from billing import Client

# Initialize client
client = Client(api_key="your_api_key")

# Create an invoice
invoice = client.create_invoice(
    amount=100.00,
    description="Monthly subscription"
)

# Get invoice details
invoice_details = client.get_invoice(invoice["id"])

# List invoices
invoices = client.list_invoices(limit=10)

Error Handling

The SDK provides several exception types:

from billing import (
    BillingError,
    AuthenticationError,
    InvalidRequestError,
    APIError
)

try:
    # API calls
except AuthenticationError as e:
    print("Invalid API key")
except InvalidRequestError as e:
    print("Invalid request parameters")
except APIError as e:
    print("Server error occurred")
except BillingError as e:
    print("General billing error")

Development

Install development dependencies:

pip install -e ".[dev]"

Run tests:

pytest

License

MIT

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

hkjx_billing_sdk-0.1.3.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

hkjx_billing_sdk-0.1.3-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file hkjx_billing_sdk-0.1.3.tar.gz.

File metadata

  • Download URL: hkjx_billing_sdk-0.1.3.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.29

File hashes

Hashes for hkjx_billing_sdk-0.1.3.tar.gz
Algorithm Hash digest
SHA256 37b5793ebe5ecc8544bc8ac173f758a3fdf9a0ea62366fc0a40e1c90aa3c6b9e
MD5 1b86a59166b6e3787e117858ec70a65c
BLAKE2b-256 29084356953cba8d7d253352956d1ecacadf663add3ee523ec35b08b14d6e2ab

See more details on using hashes here.

File details

Details for the file hkjx_billing_sdk-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for hkjx_billing_sdk-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3cc9507b2f1b37c871a64efbe7b9ee4bda4b6c08b78d41ee428bf1f0b0d6f76d
MD5 0f509cea69e8f8af4609d08740d4d812
BLAKE2b-256 043cff550fcc1362eb2d0edd3e933f4ace055de3fb9d0e7bad7272cd0de9771c

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