GoCardlessClient Payments API.
Payments are the core of GoCardlessClient — they represent money being pulled from a customer's bank account on a mandate.
Example
{:ok, payment} = GoCardlessClient.Resources.Payments.create(client, %{
amount: 1500,
currency: "GBP",
description: "Monthly service fee",
links: %{mandate: "MD123"}
}, idempotency_key: GoCardlessClient.new_idempotency_key())
Summary
Functions
Cancels a payment. Only possible before it is submitted to the banks.
Eagerly collects all payments into a list. Use stream/3 for large datasets.
Creates a payment against an existing mandate. Always pass an idempotency key to make retries safe.
Retrieves a single payment by ID.
Returns a single page of payments with optional filters (:status, :mandate, :customer, :created_at[gte], etc.).
Retries a failed payment on a new charge date.
Returns a lazy Stream over all pages of payments. Efficient for large datasets.
Updates a payment's description or metadata. Only possible before submission.
Functions
@spec cancel(GoCardlessClient.Client.t(), String.t(), map(), keyword()) :: {:ok, map()} | {:error, GoCardlessClient.APIError.t() | GoCardlessClient.Error.t()}
Cancels a payment. Only possible before it is submitted to the banks.
@spec collect_all(GoCardlessClient.Client.t(), map(), keyword()) :: {:ok, [map()]} | {:error, GoCardlessClient.APIError.t() | GoCardlessClient.Error.t()}
Eagerly collects all payments into a list. Use stream/3 for large datasets.
@spec create(GoCardlessClient.Client.t(), map(), keyword()) :: {:ok, map()} | {:error, GoCardlessClient.APIError.t() | GoCardlessClient.Error.t()}
Creates a payment against an existing mandate. Always pass an idempotency key to make retries safe.
@spec get(GoCardlessClient.Client.t(), String.t(), keyword()) :: {:ok, map()} | {:error, GoCardlessClient.APIError.t() | GoCardlessClient.Error.t()}
Retrieves a single payment by ID.
@spec list(GoCardlessClient.Client.t(), map(), keyword()) :: {:ok, %{items: [map()], meta: map()}} | {:error, GoCardlessClient.APIError.t() | GoCardlessClient.Error.t()}
Returns a single page of payments with optional filters (:status, :mandate, :customer, :created_at[gte], etc.).
@spec retry(GoCardlessClient.Client.t(), String.t(), map(), keyword()) :: {:ok, map()} | {:error, GoCardlessClient.APIError.t() | GoCardlessClient.Error.t()}
Retries a failed payment on a new charge date.
@spec stream(GoCardlessClient.Client.t(), map(), keyword()) :: Enumerable.t()
Returns a lazy Stream over all pages of payments. Efficient for large datasets.
@spec update(GoCardlessClient.Client.t(), String.t(), map(), keyword()) :: {:ok, map()} | {:error, GoCardlessClient.APIError.t() | GoCardlessClient.Error.t()}
Updates a payment's description or metadata. Only possible before submission.