Skip to main content

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.

Leave a star

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.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. 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

lemonsqueezy-0.2.0.tar.gz (75.0 kB view details)

Uploaded Source

Built Distribution

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

lemonsqueezy-0.2.0-py3-none-any.whl (34.2 kB view details)

Uploaded Python 3

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

Hashes for lemonsqueezy-0.2.0.tar.gz
Algorithm Hash digest
SHA256 15ff90d1f07637a84f4b4ac90ad89e239f163eb8f0c67b4f0eedfc2c90a9ccfd
MD5 f19d2f12d172a528da8646508c1e361d
BLAKE2b-256 35ef925ab9ae4e6ec6b1aa6fc38528e860d52fb407f9a52fe441fc721f50548f

See more details on using hashes here.

File details

Details for the file lemonsqueezy-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for lemonsqueezy-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e33e10b340b1fef82c960c8279c6a3eca44a7c3c7eedab0b6386ad2e274851e3
MD5 fb50530bd3a88c4aa24c7b5c40da7287
BLAKE2b-256 a0e495c947877c4c981ebef167ab4afa8f335afbc9e8c67eaa59cd7942a19a45

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