Skip to main content

Lago Python API Client

Project description

Lago Python Client

This is a python wrapper for Lago API

PyPI version

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

Api reference

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

Api reference

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

Api reference

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

Api reference

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

Api reference

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

Api reference

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


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 details)

Uploaded Source

Built Distribution

lago_python_client-0.2.0-py3-none-any.whl (28.6 kB view details)

Uploaded Python 3

File details

Details for the file lago-python-client-0.2.0.tar.gz.

File metadata

  • Download URL: lago-python-client-0.2.0.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for lago-python-client-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0a65ddefd1b1653c67a891e18c092860be46fbd92a969f1efc04024ebadf35a2
MD5 24f90faf6b5593653588e996aa52e4a7
BLAKE2b-256 46361d11472f591095f6d4cca2e163e04a3fa0033f42b739cc6b7f17c217ed27

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lago_python_client-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 db8aefac1f484f4a6c06f027fbadde571c1a3fa0cd454efc7903bdf2dfefb3fb
MD5 ea09789aa1442ab262dfa0921415c7ac
BLAKE2b-256 9076f16269255b91ae655bdc4597b229850a8c69c63b2f1d708804b13398d7d0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page