Skip to content

Examples

Christian KASSE edited this page Apr 2, 2026 · 1 revision

Examples

Complete code examples are available in the examples/ directory.

Available Examples

File Description Module
authentication.py Login, token refresh, password reset flows Identity
create_employee.py Employee creation and management HR
create_invoice.py Invoice creation and payment recording Accounting
crm_pipeline.py CRM pipeline: customers, opportunities, orders Trade
einvoice_submit.py E-invoice creation and tax authority submission E-Invoice
loan_application.py Loan product and application workflow Payment
process_payment.py Payment intent creation, confirmation, capture Payment
webhook_handler.py Webhook receiving and signature verification Webhooks

Running Examples

# Clone the repository
git clone https://github.com/essabu/essabu-python.git
cd essabu-python

# Set up environment
export ESSABU_API_KEY=esa_test_your_key
export ESSABU_TENANT_ID=your-tenant-id

# Run an example
python examples/create_employee.py

Quick Snippets

Create an Employee

from essabu import Essabu

with Essabu(api_key="esa_test_xxx", tenant_id="tenant-id") as client:
    employee = client.hr.employees.create(
        first_name="Jean",
        last_name="Mukendi",
        email="jean.mukendi@example.com",
        department_id="dept-001",
    )
    print(f"Created employee: {employee['id']}")

Create and Pay an Invoice

from essabu import Essabu

with Essabu(api_key="esa_test_xxx", tenant_id="tenant-id") as client:
    invoice = client.accounting.invoices.create(
        customer_id="cust-001",
        items=[{"description": "Consulting", "quantity": 10, "unit_price": 150}],
        currency="USD",
    )
    payment = client.accounting.payments.create(
        invoice_id=invoice["id"],
        amount=1500,
        method="bank_transfer",
        date="2026-03-26",
    )
    print(f"Invoice {invoice['id']} paid via {payment['method']}")

Process a Payment

from essabu import Essabu

with Essabu(api_key="esa_test_xxx", tenant_id="tenant-id") as client:
    intent = client.payment.payment_intents.create(
        amount=500,
        currency="USD",
        payment_method="mobile_money",
    )
    client.payment.payment_intents.confirm(intent["id"])
    client.payment.payment_intents.capture(intent["id"], amount=500)
    print(f"Payment captured: {intent['id']}")

CRM Pipeline

from essabu import Essabu

with Essabu(api_key="esa_test_xxx", tenant_id="tenant-id") as client:
    customer = client.trade.customers.create(
        name="ACME Corp",
        email="contact@acme.com",
    )
    deal = client.trade.opportunities.create(
        title="Enterprise Deal",
        customer_id=customer["id"],
        value=50000,
        currency="USD",
        stage="qualification",
    )
    print(f"Pipeline deal: {deal['title']} = ${deal['value']}")

Clone this wiki locally