API module for Unit Card Authorizations.
Authorizations represent pending card transactions that have been approved by the card network but not yet settled. They transition to transactions upon settlement, or are reversed if canceled/expired.
Lifecycle
- Card is presented at merchant
authorization.createdwebhook fires → Authorization resource created- Authorization settles →
purchaseTransactioncreated, authorizationCompleted - Or: authorization expires/is voided →
Canceled
Authorization requests (real-time decline)
If your program has real-time authorization control enabled, Unit will send an HTTP request to your endpoint for each authorization. You have ~3 seconds to respond with approve/decline + optional partial amount.
See Unit.API.Authorizations.list_requests/1 and Unit.API.Authorizations.approve_request/3.
Summary
Functions
Approve a real-time authorization request.
Decline a real-time authorization request.
Get an authorization by ID.
Get a real-time authorization request by ID.
List authorizations.
List real-time authorization requests (requires authorization control feature).
Functions
@spec approve_request(String.t(), map(), keyword()) :: Unit.Client.response()
Approve a real-time authorization request.
Must be called within ~3 seconds of receiving the authorization request webhook.
Params
:amount— approved amount in cents (omit or match original to approve in full; provide less for partial approval):funding_account— override the funding account:tags
@spec decline_request(String.t(), String.t(), keyword()) :: Unit.Client.response()
Decline a real-time authorization request.
Params
:reason— decline reason string (e.g."AccountClosed","DoNotHonor")
@spec get( String.t(), keyword() ) :: {:ok, Unit.Resource.Authorization.t()} | {:error, term()}
Get an authorization by ID.
@spec get_request( String.t(), keyword() ) :: Unit.Client.response()
Get a real-time authorization request by ID.
@spec list(keyword()) :: {:ok, [Unit.Resource.Authorization.t()], map()} | {:error, term()}
List authorizations.
Filter options
:account_id:customer_id:card_id:since/:until— ISO 8601 datetime strings:status—"Authorized"|"Completed"|"Canceled"|"Declined":page_limit,:page_offset
@spec list_requests(keyword()) :: Unit.Client.response()
List real-time authorization requests (requires authorization control feature).
Authorization requests are pending decisions — your handler must respond within ~3 seconds. These are distinct from the standard Authorization resource.
Filter options
:customer_id:card_id:page_limit,:page_offset