Skip to main content

Lara Payment Plan Python SDK

This is the Lara Payment Plan SDK, the core of the Lara Credit Proposal System.

About

This SDK, like other Lara Payment Plan SDKs, is a wrapper around the Lara Payment Plan Rust library. The calculations are performed by the bundled native library inside payment_plan/_internal. Currently, the library is available for Linux and Windows. MacOS support is planned for the future.

Installation

Install from PyPI:

pip install payment-plan-python-sdk

The SDK depends on bundled native binaries. If your environment blocks binary loading, make sure your runtime allows loading shared libraries.

Usage

from datetime import datetime, timedelta, timezone
from payment_plan import (
	Params,
	DownPaymentParams,
	calculate_payment_plan,
	calculate_down_payment_plan,
	disbursement_date_range,
	get_non_business_days_between,
	next_disbursement_date,
)

calculate_payment_plan

Calculates payment plans without down payment given a Params object.

Returns a list[Response] with plans from 1 installment up to the requested number of installments. Plans whose installment_amount are below min_installment_amount are not included.

from datetime import datetime, timedelta, timezone
from payment_plan import Params, calculate_payment_plan

params = Params(
	requested_amount=7800,
	first_payment_date=datetime(2025, 5, 3, tzinfo=timezone(timedelta(hours=-3))),
	disbursement_date=datetime(2025, 4, 5, tzinfo=timezone(timedelta(hours=-3))),
	installments=4,
	debit_service_percentage=0,
	mdr=0.05,
	tac_percentage=0,
	iof_overall=0.0038,
	iof_percentage=0.000082,
	interest_rate=0.0235,
	min_installment_amount=100,
	max_total_amount=1_000_000,
	disbursement_only_on_business_days=True,
	min_installments=None,
)

plans = calculate_payment_plan(params)
print(len(plans), plans[0].installment_amount)

Parameters:

  • requested_amount: Requested principal amount.
  • first_payment_date: First due date of the plan.
  • disbursement_date: Date when funds are disbursed.
  • installments: Maximum number of installments to evaluate.
  • debit_service_percentage: Debit service percentage.
  • mdr: Merchant Discount Rate.
  • tac_percentage: TAC percentage.
  • iof_overall: Overall IOF value.
  • iof_percentage: Daily IOF percentage.
  • interest_rate: Monthly interest rate.
  • min_installment_amount: Minimum allowed installment amount.
  • max_total_amount: Maximum allowed total amount.
  • disbursement_only_on_business_days: Restrict disbursement to business days.
  • min_installments: Optional minimum installment number to include in results.

Errors:

  • If requested_amount is less than or equal to 0.
  • If installments is less than or equal to 0.
  • If date fields are invalid.
  • If tax/interest parameters are incompatible with the internal XIRR-based calculation.

calculate_down_payment_plan

Calculates payment plans with down payment given a DownPaymentParams object.

Returns a list[DownPaymentResponse] with down-payment options from 1 installment up to the requested installment count.

from datetime import datetime, timedelta, timezone
from payment_plan import Params, DownPaymentParams, calculate_down_payment_plan

base_params = Params(
	requested_amount=7800,
	first_payment_date=datetime(2025, 5, 3, tzinfo=timezone(timedelta(hours=-3))),
	disbursement_date=datetime(2025, 4, 5, tzinfo=timezone(timedelta(hours=-3))),
	installments=4,
	debit_service_percentage=0,
	mdr=0.05,
	tac_percentage=0,
	iof_overall=0.0038,
	iof_percentage=0.000082,
	interest_rate=0.0235,
	min_installment_amount=100,
	max_total_amount=1_000_000,
	disbursement_only_on_business_days=True,
	min_installments=None,
)

down_payment_params = DownPaymentParams(
	first_payment_date=datetime(2025, 5, 3, tzinfo=timezone(timedelta(hours=-3))),
	requested_amount=1000,
	installments=4,
	min_installment_amount=100,
	params=base_params,
)

down_payment_plans = calculate_down_payment_plan(down_payment_params)
print(down_payment_plans[0].installment_quantity)

Parameters:

  • requested_amount: Down payment amount.
  • min_installment_amount: Minimum installment amount for down payment options.
  • installments: Maximum number of down payment installments to evaluate.
  • first_payment_date: First due date for the down payment plan.
  • params: A Params object used for the main payment plan calculation.

Errors:

  • If requested_amount is less than or equal to 0.
  • If installments is less than or equal to 0.
  • If date fields are invalid.
  • If tax/interest parameters are incompatible with the internal XIRR-based calculation.

disbursement_date_range

Calculates start and end dates for a disbursement period based on a base_date and number of business days.

from datetime import datetime, timezone
from payment_plan import disbursement_date_range

base_date = datetime(2078, 2, 12, tzinfo=timezone.utc)
days = 5
start_date, end_date = disbursement_date_range(base_date, days)
print(start_date, end_date)

Parameters:

  • base_date: Base date used to calculate the business-day range.
  • days: Number of business days to include.

Returns:

  • A tuple (start_date, end_date).

Errors:

  • If base_date is invalid.

get_non_business_days_between

Returns non-business days (weekends and bank holidays) between two dates, inclusive.

from datetime import datetime, timezone
from payment_plan import get_non_business_days_between

start_date = datetime(2078, 11, 12, tzinfo=timezone.utc)
end_date = datetime(2078, 11, 22, tzinfo=timezone.utc)
non_business_days = get_non_business_days_between(start_date, end_date)
print(non_business_days)

Parameters:

  • start_date: Start date of the interval.
  • end_date: End date of the interval.

Returns:

  • A list of non-business dates between start_date and end_date.

Errors:

  • If start_date or end_date is invalid.
  • If start_date is after end_date.

next_disbursement_date

Calculates the next valid disbursement date based on base_date.

from datetime import datetime, timezone
from payment_plan import next_disbursement_date

base_date = datetime(2078, 2, 12, tzinfo=timezone.utc)
result = next_disbursement_date(base_date)
print(result)

Parameters:

  • base_date: Base date used for the calculation.

Returns:

  • The next valid disbursement date.

Errors:

  • If base_date is invalid.

Warning: As of now, if base_date is the same calendar day as "today", this day is considered invalid for disbursement and the function returns the next valid date.

Contributing

This repository and the code in it are a mirror of the code on Parcelado Lara Payment Plan. To contribute, open contributions in the main payment-plan repository. Changes are reflected here after release.

License

This software is provided free of charge for personal or internal business use only. Modification, redistribution, sublicensing, or reverse engineering is not permitted. Copyright (c) 2025 SWEETPAY SOLUCOES FINANCEIRAS LTDA. All rights reserved.

Metadata

Release files for payment-plan-python-sdk 3.2.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for payment-plan-python-sdk 3.2.6
File Size Uploaded Provenance Actions
payment_plan_python_sdk-3.2.6.tar.gz 1.3 MB With provenance Details for payment_plan_python_sdk-3.2.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for payment-plan-python-sdk 3.2.6
File Interpreter ABI Platform Actions
payment_plan_python_sdk-3.2.6-py3-none-any.whl Python 3 none any Details for payment_plan_python_sdk-3.2.6-py3-none-any.whl

Total release size: 2.6 MB

Release files / payment_plan_python_sdk-3.2.6.tar.gz

Download URL payment_plan_python_sdk-3.2.6.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
6ca2bdeffa01f8b9550401a1b8e3ea7cd63f98aa669b484bd7a60689eb36442c
BLAKE2b-256 checksum
How to use checksums
cf36402447d7a6b44efa5068be3df6fd51e58c32389aa0ffc12329b2b534c2de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Release files / payment_plan_python_sdk-3.2.6-py3-none-any.whl

Download URL payment_plan_python_sdk-3.2.6-py3-none-any.whl
Size 1.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
deacfebe687dd851f5b1ad77f1548fe3d10f2315d91a0a20108e41d845c8c6f0
BLAKE2b-256 checksum
How to use checksums
58857c159af153dda28da4dc524f84bd36fe8ff9fc52a8156e8c7decbb8527a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Security for payment-plan-python-sdk 3.2.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for payment_plan_python_sdk-3.2.6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page