Easy Labs
SDKsPythonResources

Authorizations

Authorizations — methods, parameters, and examples for easy-sdk (pip).

An Authorization represents a hold on a customer's payment instrument that hasn't been captured yet — useful for two-step "auth then capture" flows (rentals, marketplaces, pre-orders).

Namespace: client.authorizations. Authorizations are typically created via the checkout flow with auth_only=True; this resource exposes the read + capture/void endpoints.

Methods

list

auths = client.authorizations.list(limit=50, offset=0)
batch = client.authorizations.list(ids=["auth_1", "auth_2"])

Returns list[Authorization].

retrieve

auth = client.authorizations.retrieve("auth_123")

capture

captured = client.authorizations.capture(
    "auth_123",
    amount=2000,                           # ≤ original auth amount
    idempotency_key="capture-auth_123-1",
)

Captures funds against the existing hold. amount is required and is the amount you want to actually charge (in the smallest currency unit).

void

voided = client.authorizations.void(
    "auth_123",
    idempotency_key="void-auth_123-1",
)

Releases the hold without charging.

Object shape

Authorization:

FieldType
idstr
statestr | None
amountint | None
currencystr | None
captured_amountint | None
voidedbool | None
transfer_idstr | None
payment_instrument_idstr | None
expires_atstr | None
tagsdict[str, Any] | None
created_at, updated_atstr | None

Examples

Auth on order, capture on ship

# 1. (Checkout flow elsewhere creates the auth — auth_id returned)

# 2. When the order ships, capture the actual amount
client.authorizations.capture(
    auth_id,
    amount=order.shipped_total_cents,
    idempotency_key=f"capture-{auth_id}",
)

Void a hold after the customer cancels

client.authorizations.void(
    auth_id,
    idempotency_key=f"void-{auth_id}",
)

Sweep expiring authorizations

import datetime as dt

soon = dt.datetime.now(dt.timezone.utc) + dt.timedelta(days=1)
for a in client.authorizations.list(limit=200):
    if a.expires_at and a.expires_at <= soon.isoformat():
        log.warning("auth %s expires at %s", a.id, a.expires_at)

On this page