LemonSqueezy-py-api is an unofficial Python library for interacting with the LemonSqueezy API.
Project description
LemonSqueezy Py API
An unofficial Python SDK for the LemonSqueezy API. Simplify your integration with LemonSqueezy's platform to manage license keys, checkouts, webhooks, usage records, discounts, and more.
Features
- 🔑 License Key Management
- 💳 Checkout & Payment Processing
- 🔔 Webhook Integration
- 📊 Usage Tracking
- 🏷️ Discount Management
- 🏪 Store & Product Management
- 👥 Customer Data Access
- 📦 Digital File Management
- 🔁 Subscription Management
Installation
pip install lemonsqueezy
Quick Start
Initialize the client with your API key:
from lemonsqueezy import LemonSqueezy
client = LemonSqueezy(api_key="your_api_key")
Examples
# List all your stores
stores = client.list_stores()
# Get customer information
customers = client.list_customers()
# Inspect commerce helpers
checkout = client.get_checkout("ac470bd4-7c41-474d-b6cd-0f296f5be02a")
discounts = client.list_discounts()
discount_redemptions = client.list_discount_redemptions()
# Work with orders
order = client.get_order(123)
orders = client.list_orders()
# Manage products
product = client.get_product(123)
all_products = client.list_products()
product_variants = client.get_product_variants(123)
# Handle digital files
file = client.get_file(456)
all_files = client.list_files()
# Work with variants
variant = client.get_variant(789)
all_variants = client.list_variants()
# Manage subscriptions
subscription = client.get_subscription(321)
subscription_items = client.list_subscription_items()
subscription_invoices = client.list_subscription_invoices()
# Manage license keys
license_keys = client.list_license_keys()
license_key = client.get_license_key(license_keys[0].id_)
validation = client.validate_license_key(license_key.attributes.key)
activation = client.activate_license_key(
license_key.attributes.key, "My Device"
)
if activation.activated and activation.instance:
client.deactivate_license_key(
license_key.attributes.key, activation.instance.id
)
Alternative examples:
from lemonsqueezy.api.customer import list_customers
from lemonsqueezy.api.product import list_products
all_customers = list_customers(client)
all_products = list_products(client)
Configuration
You can configure the client using environment variables:
LEMONSQUEEZY_API_KEY=your_api_key
LEMONSQUEEZY_API_URL=https://api.lemonsqueezy.com/v1 # Optional
Then create your client object:
from lemonsqueezy import LemonSqueezy
client = LemonSqueezy()
Or pass configuration directly to the client:
client = LemonSqueezy(
api_key="your_api_key",
api_url="https://api.lemonsqueezy.com/v1" # Optional
)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
See CONTRIBUTING for more details.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
- 🌟 Star this repo to show your support
- 🐛 Open an issue to report bugs
- 💡 Open an issue to request features
- 📖 Documentation coming soon!
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lemonsqueezy-0.2.0.tar.gz.
File metadata
- Download URL: lemonsqueezy-0.2.0.tar.gz
- Upload date:
- Size: 75.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15ff90d1f07637a84f4b4ac90ad89e239f163eb8f0c67b4f0eedfc2c90a9ccfd
|
|
| MD5 |
f19d2f12d172a528da8646508c1e361d
|
|
| BLAKE2b-256 |
35ef925ab9ae4e6ec6b1aa6fc38528e860d52fb407f9a52fe441fc721f50548f
|
File details
Details for the file lemonsqueezy-0.2.0-py3-none-any.whl.
File metadata
- Download URL: lemonsqueezy-0.2.0-py3-none-any.whl
- Upload date:
- Size: 34.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e33e10b340b1fef82c960c8279c6a3eca44a7c3c7eedab0b6386ad2e274851e3
|
|
| MD5 |
fb50530bd3a88c4aa24c7b5c40da7287
|
|
| BLAKE2b-256 |
a0e495c947877c4c981ebef167ab4afa8f335afbc9e8c67eaa59cd7942a19a45
|