Lago Python API Client
Project description
Lago Python Client
This is a python wrapper for Lago API
Installation
Install the lago-python-client via pip from PyPI:
$ pip install lago-python-client
Usage
from lago_python_client import Client
client = Client(api_key = 'key')
Events
from lago_python_client.models import Event
event = Event(
customer_id="5eb02857-a71e-4ea2-bcf9-57d8885990ba",
transaction_id="__UNIQUE_ID__",
code="123",
timestamp=1650893379,
properties={"custom_field": "custom"}
)
client.events().create(event)
transaction_id = "6afadc2a-f28c-40a4-a868-35636f229765"
event = client.events().find(transaction_id)
Customers
from lago_python_client.models import Customer, BillingConfiguration
customer = Customer(
customer_id="5eb02857-a71e-4ea2-bcf9-57d8885990ba",
address_line1=None,
address_line2=None,
city=None,
country=None,
email="test@example.com",
legal_name=None,
legal_number=None,
logo_url=None,
name="test name",
phone=None,
state=None,
url=None,
vat_rate=None,
zipcode=None,
billing_configuration=BillingConfiguration(
payment_provider=None,
provider_customer_id=None,
sync=None
)
)
client.customers().create(customer)
Invoices
from lago_python_client.models import InvoiceStatusChange
status_change = InvoiceStatusChange(
lago_id="5eb02857-a71e-4ea2-bcf9-57d8885990ba",
status="succeeded"
)
client.invoices().update(status_change)
Subscriptions
from lago_python_client.models import Subscription
subscription = Subscription(
customer_id="5eb02857-a71e-4ea2-bcf9-57d8885990ba",
plan_code="code"
)
client.subscriptions().create(subscription)
params_delete = {
"customer_id": "5eb02857-a71e-4ea2-bcf9-57d8885990ba"
}
client.subscriptions().delete(params_delete)
Applied coupons
from lago_python_client.models import AppliedCoupon
applied_coupon = AppliedCoupon(
customer_id="5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
coupon_code="code",
amount_cents=123,
amount_currency="EUR"
)
client.applied_coupons().create(applied_coupon)
Applied add-ons
from lago_python_client.models import AppliedAddOn
applied_add_on = AppliedAddOn(
customer_id="5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
add_on_code="code",
amount_cents=123,
amount_currency="EUR"
)
client.applied_add_ons().create(applied_add_on)
Development
Install the dependencies
pip install .
Run tests
python3 -m unittest tests
Documentation
The Lago documentation is available at doc.getlago.com.
Contributing
The contribution documentation is available here
License
Lago Python client is distributed under AGPL-3.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lago-python-client-0.2.0.tar.gz
(20.5 kB
view hashes)
Built Distribution
Close
Hashes for lago_python_client-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db8aefac1f484f4a6c06f027fbadde571c1a3fa0cd454efc7903bdf2dfefb3fb |
|
MD5 | ea09789aa1442ab262dfa0921415c7ac |
|
BLAKE2b-256 | 9076f16269255b91ae655bdc4597b229850a8c69c63b2f1d708804b13398d7d0 |