Teya.Capture (teya v0.4.0)

Copy Markdown View Source

Capture pre-authorised funds.

After a PRE_AUTHORISATION transaction succeeds, call create/2 to settle the funds. Uncaptured pre-authorisations are released automatically by the issuer after a network-defined period (typically 7 days).

Required OAuth scope: captures/create.

Summary

Functions

Captures a pre-authorised transaction.

Functions

create(transaction_id, params \\ %{}, opts \\ [])

@spec create(String.t(), map(), keyword()) :: {:ok, map()} | {:error, Teya.Error.t()}

Captures a pre-authorised transaction.

transaction_id is the transaction_id from the PRE_AUTHORISATION response.

Returns {:ok, response} where status is "SUCCESS", "FAILURE", or "PENDING". A "PENDING" response (HTTP 202) means the capture is still being processed; poll Teya.Transaction.get/1 until the status is final.

Options

  • idempotency_key — override the auto-generated idempotency key

Examples

{:ok, _} = Teya.Capture.create(transaction_id)