GoCardlessClient.Resources.Subscriptions (GoCardlessClient v2.0.0)

Copy Markdown View Source

GoCardlessClient Subscriptions API.

Subscriptions automatically create payments on a recurring schedule.

Example

{:ok, sub} = GoCardlessClient.Resources.Subscriptions.create(client, %{
  amount: 2500,
  currency: "GBP",
  name: "Premium Monthly",
  interval_unit: "monthly",
  interval: 1,
  day_of_month: 1,
  links: %{mandate: "MD123"}
})

Summary

Functions

Cancels a subscription. No further payments will be created.

Eagerly collects all subscriptions into a list.

Creates a subscription on a mandate with a recurring schedule.

Retrieves a single subscription by ID.

Returns a page of subscriptions with optional filters.

Pauses a subscription for a given number of cycles. Pass %{pause_cycles: n} as params.

Resumes a paused subscription.

Returns a lazy Stream over all pages of subscriptions.

Updates a subscription's amount, name, or payment_reference.

Functions

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

Cancels a subscription. No further payments will be created.

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

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

Creates a subscription on a mandate with a recurring schedule.

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

Retrieves a single subscription 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 subscriptions with optional filters.

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

Pauses a subscription for a given number of cycles. Pass %{pause_cycles: n} as params.

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

Resumes a paused subscription.

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

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

Returns a lazy Stream over all pages of subscriptions.

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

Updates a subscription's amount, name, or payment_reference.