GoCardlessClient.Resources.Events (GoCardlessClient v2.0.0)

Copy Markdown View Source

GoCardless Events API.

An immutable, append-only audit log of everything that happens in the system. Events are the basis for webhook payloads and are used for reconciling payouts.

Event structure

%{
  "id" => "EV123",
  "created_at" => "2025-01-15T10:30:00.000Z",
  "action" => "paid_out",
  "resource_type" => "payments",
  "links" => %{"payment" => "PM123", "payout" => "PO456"},
  "details" => %{
    "origin" => "gocardless",
    "cause" => "payment_paid_out",
    "description" => "Payment paid out by GoCardless"
  },
  "metadata" => %{}
}

Example — reconcile a payout

{:ok, %{items: events}} = GoCardlessClient.Resources.Events.list(client, %{
  "payout" => "PO123"
})

Summary

Functions

Eagerly collects all events into a list. Use stream/3 for large datasets.

Retrieves a single event by ID.

Returns a page of events with optional filters.

Returns a lazy Stream over all pages of events.

Functions

collect_all(client, params \\ %{}, opts \\ [])

@spec collect_all(GoCardlessClient.Client.t(), map(), keyword()) ::
  {:ok, [map()]}
  | {:error, GoCardlessClient.APIError.t() | GoCardlessClient.Error.t()}

Eagerly collects all events into a list. Use stream/3 for large datasets.

get(client, id, opts \\ [])

Retrieves a single event by ID.

list(client, params \\ %{}, opts \\ [])

@spec list(GoCardlessClient.Client.t(), map(), keyword()) ::
  {:ok, %{items: [map()], meta: map()}}
  | {:error, GoCardlessClient.APIError.t() | GoCardlessClient.Error.t()}

Returns a page of events with optional filters.

Filter params

  • :action — e.g. "paid_out", "failed", "active"
  • :resource_type"payments", "mandates", "payouts", "refunds", "subscriptions", "billing_requests"
  • :payment — filter by payment ID
  • :mandate — filter by mandate ID
  • :subscription — filter by subscription ID
  • :refund — filter by refund ID
  • :payout — filter by payout ID
  • :billing_request — filter by billing request ID
  • :created_at[gte] / :created_at[lte] — date range filters

stream(client, params \\ %{}, opts \\ [])

@spec stream(GoCardlessClient.Client.t(), map(), keyword()) :: Enumerable.t()

Returns a lazy Stream over all pages of events.