Skip to content

Payment Module

Christian KASSE edited this page Apr 2, 2026 · 2 revisions

Payment Module

Payment processing, financial accounts, loans, KYC, subscriptions, refunds, and transaction management.

Accessor: client.payment

Available Resources

Resource Accessor Description
Payment Intents client.payment.payment_intents Payment intents (authorize, capture)
Payment Accounts client.payment.payment_accounts Payment account configuration
Financial Accounts client.payment.financial_accounts Financial account management
Transactions client.payment.transactions Transaction records
Refunds client.payment.refunds Refund processing
Subscriptions client.payment.subscriptions Recurring subscriptions
Subscription Plans client.payment.subscription_plans Subscription plan definitions
Loan Applications client.payment.loan_applications Loan applications
Loan Products client.payment.loan_products Loan product catalog
Loan Repayments client.payment.loan_repayments Loan repayment schedules
Collaterals client.payment.collaterals Loan collaterals
KYC Profiles client.payment.kyc_profiles KYC customer profiles
KYC Documents client.payment.kyc_documents KYC identity documents
Reports client.payment.reports Payment reports

Payment Intent Lifecycle

Payment intents support additional actions beyond standard CRUD:

# Create -> Confirm -> Capture
intent = client.payment.payment_intents.create(amount=5000, currency="USD", ...)
confirmed = client.payment.payment_intents.confirm(intent["id"])
captured = client.payment.payment_intents.capture(intent["id"], amount=5000)

# Or cancel
client.payment.payment_intents.cancel(intent["id"])

Code Examples

Payment Intents

from essabu import Essabu

client = Essabu(api_key="esa_live_xxx", tenant_id="tenant-id")

intent = client.payment.payment_intents.create(
    amount=5000,
    currency="USD",
    customer_id="cust-uuid",
    payment_method="mobile_money",
    description="Invoice #INV-001",
)
confirmed = client.payment.payment_intents.confirm(intent["id"])
captured = client.payment.payment_intents.capture(intent["id"], amount=5000)

Refunds

refund = client.payment.refunds.create(
    transaction_id="txn-uuid",
    amount=2500,
    reason="Customer request",
)

Subscriptions

plan = client.payment.subscription_plans.create(
    name="Pro Monthly",
    amount=29.99,
    currency="USD",
    interval="month",
)
subscription = client.payment.subscriptions.create(
    customer_id="cust-uuid",
    plan_id=plan["id"],
    start_date="2026-04-01",
)

Loans

product = client.payment.loan_products.create(
    name="Micro-credit",
    max_amount=10000,
    interest_rate=5.0,
    term_months=12,
)
application = client.payment.loan_applications.create(
    customer_id="cust-uuid",
    product_id=product["id"],
    amount=5000,
    purpose="Working capital",
)
repayments = client.payment.loan_repayments.list(application_id=application["id"])

KYC

profile = client.payment.kyc_profiles.create(
    customer_id="cust-uuid",
    level="enhanced",
)
doc = client.payment.kyc_documents.create(
    profile_id=profile["id"],
    type="national_id",
    document_number="ID-123456",
    expiry_date="2030-12-31",
)

Financial Accounts

accounts = client.payment.financial_accounts.list()
account = client.payment.financial_accounts.create(
    name="Main Operating Account",
    type="bank",
    bank_name="Trust Bank",
    account_number="123456789",
)

See Also

Clone this wiki locally