Inttegro.Refunds (inttegro v0.2.0)

Copy Markdown View Source

Returns funds from a paid order to its original payment method.

Refunds are asynchronous financial records. Creating a refund validates the requested line items and amount, while the returned status describes processing progress. Look up the refund until it reaches a terminal state and reconcile it through balance transactions.

Summary

Functions

Cancels a pending refund before processing claims it. Cancellation releases the merchant balance hold and restores the refundable capacity reserved against its order line items. Repeating cancellation returns the same canceled refund.

Starts a refund for one or more paid order line items. Refund processing is asynchronous: a successful request returns the new refund in pending status. Retry an uncertain request with the same URL, idempotency key, and body.

Returns the current lifecycle state and amounts for one refund.

Returns refunds in pages of the requested size. Page numbering starts at 1.

Functions

cancel(client, request, options \\ [])

Cancels a pending refund before processing claims it. Cancellation releases the merchant balance hold and restores the refundable capacity reserved against its order line items. Repeating cancellation returns the same canceled refund.

Parameters

Returns

Returns {:ok, Inttegro.Refunds.Refund.t()} when Inttegro accepts and decodes the operation. Returns {:error, exception} for API, transport, or decoding failures. A successful API response can still describe an asynchronous resource that has not reached its terminal state.

Example

request = Inttegro.Refunds.CancelRequest.new!(request_attributes)

case Inttegro.Refunds.cancel(client, request) do
  {:ok, result} -> result
  {:error, error} -> {:error, error}
end

create(client, request, options \\ [])

Starts a refund for one or more paid order line items. Refund processing is asynchronous: a successful request returns the new refund in pending status. Retry an uncertain request with the same URL, idempotency key, and body.

Parameters

Returns

Returns {:ok, Inttegro.Refunds.Refund.t()} when Inttegro accepts and decodes the operation. Returns {:error, exception} for API, transport, or decoding failures. A successful API response can still describe an asynchronous resource that has not reached its terminal state.

Example

request = Inttegro.Refunds.CreateRequest.new!(request_attributes)

case Inttegro.Refunds.create(client, request) do
  {:ok, result} -> result
  {:error, error} -> {:error, error}
end

lookup(client, request, options \\ [])

Returns the current lifecycle state and amounts for one refund.

Parameters

Returns

Returns {:ok, Inttegro.Refunds.Refund.t()} when Inttegro accepts and decodes the operation. Returns {:error, exception} for API, transport, or decoding failures. A successful API response can still describe an asynchronous resource that has not reached its terminal state.

Example

request = Inttegro.Refunds.LookupRequest.new!(request_attributes)

case Inttegro.Refunds.lookup(client, request) do
  {:ok, result} -> result
  {:error, error} -> {:error, error}
end

page(client, request, options \\ [])

Returns refunds in pages of the requested size. Page numbering starts at 1.

Parameters

Returns

Returns {:ok, Inttegro.Refunds.Page.t()} when Inttegro accepts and decodes the operation. Returns {:error, exception} for API, transport, or decoding failures. A successful API response can still describe an asynchronous resource that has not reached its terminal state.

Example

request = Inttegro.Refunds.PageRequest.new!(request_attributes)

case Inttegro.Refunds.page(client, request) do
  {:ok, result} -> result
  {:error, error} -> {:error, error}
end