Repository navigation
v0.2.0
[0.2.0] - 2026-08-28
Production-hardening release. Contains breaking changes to the exception
taxonomy and to the result dataclasses.
Fixed
- Packaging (blocking).
generated/was excluded from the built
distribution, so a wheel or Git install produced an SDK where every method
raised "generated client is not available".pyproject.tomlnow includes
generated*, andgenerated/__init__.pymakes it a real package. - Missing runtime dependencies (blocking).
attrsandpython-dateutil
are required by the shipped generated code but were undeclared. - Khipu error bodies were discarded. Non-success responses raised
"Empty response"even when Khipu returned useful JSON.KhipuApiErrornow
carriespayload(parsed JSON),body(bounded raw text) and a message
derived from Khipu's own diagnostics. - Exceptions could not be pickled, breaking Celery result backends. The
dataclass-basedKhipuApiErrorwas replaced with explicitException
subclasses. create_chargesignature defect.error_response_url,customand
notify_urlare required by Khipu'sChargeRequestschema but were absent
from the public signature, so calling the method as documented failed. They
are now required parameters.KhipuConfigno longer exposes the API key throughrepr().
Added
Decimalmoney support.amount/max_amountacceptDecimal,int,
strorfloat.Decimalis canonical; conversion tofloat/inthappens
only at the generated-model boundary (khipu_sdk.money.amount_to_wire).- Currency minor-unit validation. Amounts are checked against the currency's
ISO-4217 scale before serialisation and are never silently rounded. Fractional
CLP (e.g.Decimal("9700.5")) now raisesKhipuValidationErrorwith no HTTP
request made. New modulekhipu_sdk.money. - Exception taxonomy under
KhipuError:KhipuConfigurationError,
KhipuValidationError,KhipuTransportError(withKhipuTimeoutErrorand
KhipuConnectionError),KhipuApiErrorandKhipuResponseError. Transport
errors exposerequest_may_have_been_delivered, derived from httpx's own
taxonomy, so an ambiguous create-payment outcome is explicit. - Correlation and verification fields promoted onto
InstantPaymentStatus:
transaction_id,custom,status_detail,receiver_id,
notification_token,expires_date,conciliation_dateand
out_of_date_conciliation. Callers no longer need.raw. - All create-response URLs promoted onto
InstantPaymentCreateResult:
simplified_transfer_url,transfer_url,app_url,ready_for_terminal. py.typedmarker so downstream type checkers see the package as typed.- Public exports from
khipu_sdk: the client, config, every exception, every
result dataclass, andCURRENCY_MINOR_UNITS/SUPPORTED_CURRENCIES. httpx.Timeoutis accepted byKhipuConfig.timeoutfor per-phase control.- CI packaging regression guard: a
packagejob builds the wheel, asserts it
contains the generated clients andpy.typed, installs it into a clean
virtualenv and creates/retrieves a payment against a mock server
(make build,make smoke-dist,tools/smoke_installed.py). - Real HTTP-boundary tests using
pytest-httpx, replacingSimpleNamespace
stubs ofsync_detailed. Coverage added for thex-api-keyheader, 400/401/
403/500/429 responses, timeouts, connection failures, malformed JSON, missing
required fields,Decimalserialization, fractional-CLP rejection, the real
pending/verifying/donestatus values,status_detail == "reversed",
correlation round-trip, exception pickling and credential-reprsafety. .env/.env.*added to.gitignore.
Changed
- Breaking: a missing generated client now raises
KhipuConfigurationError
instead ofKhipuApiError(500). - Breaking: timeouts, connection failures, local validation errors and
malformed responses no longer surface asKhipuApiError(status_code=500).
CatchKhipuErrorfor a blanket handler. - Breaking:
InstantPaymentCreateResult.statuswas removed. It was always
None— Khipu's create response carries no status. - Breaking:
InstantPaymentStatus.amountis nowOptional[Decimal]instead
ofOptional[float], andstatusis a plainstrrather than a generated
enum leaking through anOptional[str]annotation. rawis excluded fromrepr()on all result types; the underlying Khipu
payment model carries payer PII.- Removed the vestigial
types-requestsdev dependency (requestsis unused);
addedbuild.
Upstream API
- Adopted the Khipu OpenAPI specifications as published on 2026-08-28, replacing
the 2025-12-26 snapshot, and refreshedOPENAPI_SPECS.lock.jsonand the
generated clients accordingly. - Instant Payments.
payment-get-payment.amountand.discountchanged from
numbertostringupstream; the facade continues to expose
InstantPaymentStatus.amountasOptional[Decimal]and accepts either
representation.status_detailgainedpartially-refundedand
fully-refunded, surfaced verbatim as plain strings. New optional fields
authorizer_operation_code(response) andpsp_client_merchant_logo_url
(request).POST /v3/payments/{id}/refundsis now marked obsolete, takes no
body and refunds the full amount only;POST /v3/payments/{id}/void,
POST /v3/refunds,GET /v3/refund-wallet/balanceand
GET /v3/receivers/childrenare new. The receiver creation response now also
returns anapi_key. - Automatic Payments. Documentation-URL change only; no schema change and no
effect oncreate_charge. - The new refund, void and receiver operations are generated but deliberately
not exposed onKhipuClient. The facade stays small; promoting an
operation is a separate decision. - Pinned
openapi-python-client==0.28.0exactly. The generator produces the
committed contents ofgenerated/, so a floating version could change that
code with no change in this repository. Regeneration from the committed specs
is byte-identical.
Notes
Unchanged by design, because Khipu does not provide them:
create_instant_paymentis not idempotent, andtransaction_idis not
documented by Khipu as a deduplication key.- There is no lookup-by-
transaction_idendpoint. - There is no pre-payment merchant-fee quotation in either vendored spec.
- There is no settlement/report API, and the SDK contains no webhook
handling. - The SDK still performs no retries, including on create-payment.