Transactions: read-heavy history and lookup endpoints (API version
v2.1), plus refunds (API version v1.0).
Summary
Functions
Retrieves a single transaction. Exactly one lookup key must be given:
:id, :transaction_code, :foreign_transaction_id, or
:client_transaction_id.
Lists a single page of transaction history.
Lazily streams every transaction matching the given filters,
following the response's next hypermedia link page by page. See
Sumup.Pagination.
Refunds a transaction, fully or partially. Pass amount: for a partial
refund; omit it for a full refund. Returns :ok on success (the API
responds 204 No Content).
Functions
@spec get(Sumup.Config.t(), String.t(), keyword()) :: {:ok, Sumup.Transaction.t()} | {:error, Sumup.Error.t()}
Retrieves a single transaction. Exactly one lookup key must be given:
:id, :transaction_code, :foreign_transaction_id, or
:client_transaction_id.
Sumup.Transactions.get(config, merchant_code, id: "tx_123")
Sumup.Transactions.get(config, merchant_code, client_transaction_id: "ctx_abc")
@spec list(Sumup.Config.t(), String.t(), keyword()) :: {:ok, map()} | {:error, Sumup.Error.t()}
Lists a single page of transaction history.
:transaction_code(String.t/0) - Filter to a single transaction code.:order- Sort direction (default"ascending").:limit(pos_integer/0) - Page size.:users(list ofString.t/0) - Filter by one or more registered-user emails.:statuses(list ofString.t/0) - Filter by one or more of SUCCESSFUL, CANCELLED, FAILED, PENDING, REFUNDED.:payment_types(list ofString.t/0) - Filter by one or more payment types (CASH, POS, ECOM, ...).:entry_modes(list ofString.t/0) - Filter by one or more entry modes (CHIP, CONTACTLESS, ...).:types(list ofString.t/0) - Filter by one or more of PAYMENT, REFUND, CHARGE_BACK.:changes_since(String.t/0) - ISO 8601 timestamp: only transactions changed since this time.:oldest_time(String.t/0) - ISO 8601 lower bound (superseded byoldest_reffor pagination).:newest_time(String.t/0) - ISO 8601 upper bound (superseded bynewest_reffor pagination).:oldest_ref(String.t/0) - Opaque cursor: fetch the page immediately older than this ref.:newest_ref(String.t/0) - Opaque cursor: fetch the page immediately newer than this ref.
@spec list_all(Sumup.Config.t(), String.t(), keyword()) :: Enumerable.t()
Lazily streams every transaction matching the given filters,
following the response's next hypermedia link page by page. See
Sumup.Pagination.
Sumup.Transactions.list_all(config, merchant_code, statuses: ["SUCCESSFUL"])
|> Stream.map(& &1.amount)
|> Enum.to_list()
@spec refund(Sumup.Config.t(), String.t(), String.t(), keyword() | map()) :: :ok | {:error, Sumup.Error.t()}
Refunds a transaction, fully or partially. Pass amount: for a partial
refund; omit it for a full refund. Returns :ok on success (the API
responds 204 No Content).