GoCardlessClient.Resources.Mandates (GoCardlessClient v2.0.0)

Copy Markdown View Source

GoCardlessClient Mandates API.

A Mandate is a Direct Debit agreement between a customer and a creditor, authorising the creditor to collect payments.

Example

{:ok, mandate} = GoCardlessClient.Resources.Mandates.create(client, %{
  scheme: "bacs",
  metadata: %{"contract_id" => "C-001"},
  links: %{customer_bank_account: "BA123"}
})

Summary

Functions

Cancels a mandate. All future payments against it will also be cancelled.

Eagerly collects all mandates into a list.

Creates a mandate against a customer bank account.

Retrieves a single mandate by ID.

Returns a page of mandates with optional filters (:status, :customer, :created_at[gte], etc.).

Reinstates a cancelled or failed mandate. Not available for all mandate statuses.

Returns a lazy Stream over all pages of mandates.

Updates a mandate's metadata. Only :metadata can be changed.

Functions

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

Cancels a mandate. All future payments against it will also be cancelled.

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 mandates into a list.

create(client, params, opts \\ [])

Creates a mandate against a customer bank account.

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

Retrieves a single mandate 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 mandates with optional filters (:status, :customer, :created_at[gte], etc.).

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

@spec reinstate(GoCardlessClient.Client.t(), String.t(), map(), keyword()) ::
  {:ok, map()}
  | {:error, GoCardlessClient.APIError.t() | GoCardlessClient.Error.t()}

Reinstates a cancelled or failed mandate. Not available for all mandate statuses.

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

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

Returns a lazy Stream over all pages of mandates.

update(client, id, params, opts \\ [])

Updates a mandate's metadata. Only :metadata can be changed.