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
@spec cancel(GoCardlessClient.Client.t(), String.t(), map(), keyword()) :: {:ok, map()} | {:error, GoCardlessClient.APIError.t() | GoCardlessClient.Error.t()}
Cancels a subscription. No further payments will be created.
@spec collect_all(GoCardlessClient.Client.t(), map(), keyword()) :: {:ok, [map()]} | {:error, GoCardlessClient.APIError.t() | GoCardlessClient.Error.t()}
Eagerly collects all subscriptions into a list.
@spec create(GoCardlessClient.Client.t(), map(), keyword()) :: {:ok, map()} | {:error, GoCardlessClient.APIError.t() | GoCardlessClient.Error.t()}
Creates a subscription on a mandate with a recurring schedule.
@spec get(GoCardlessClient.Client.t(), String.t(), keyword()) :: {:ok, map()} | {:error, GoCardlessClient.APIError.t() | GoCardlessClient.Error.t()}
Retrieves a single subscription by ID.
@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.
@spec pause(GoCardlessClient.Client.t(), String.t(), map(), keyword()) :: {:ok, map()} | {:error, GoCardlessClient.APIError.t() | GoCardlessClient.Error.t()}
Pauses a subscription for a given number of cycles. Pass %{pause_cycles: n} as params.
@spec resume(GoCardlessClient.Client.t(), String.t(), map(), keyword()) :: {:ok, map()} | {:error, GoCardlessClient.APIError.t() | GoCardlessClient.Error.t()}
Resumes a paused subscription.
@spec stream(GoCardlessClient.Client.t(), map(), keyword()) :: Enumerable.t()
Returns a lazy Stream over all pages of subscriptions.
@spec update(GoCardlessClient.Client.t(), String.t(), map(), keyword()) :: {:ok, map()} | {:error, GoCardlessClient.APIError.t() | GoCardlessClient.Error.t()}
Updates a subscription's amount, name, or payment_reference.