MollieEx.Subscriptions (mollie_ex v0.4.0)

Copy Markdown View Source

Create, retrieve, list, update, cancel, and inspect payments for Mollie subscriptions.

All functions return result tuples. They do not raise for ordinary API, transport, or validation failures.

Summary

Functions

Lists subscriptions across customers.

Cancels a customer subscription by ID.

Creates a subscription for a customer.

Retrieves a customer subscription by ID.

Lists subscriptions for a customer.

Lists payments generated for a subscription.

Types

all_option()

(since 0.4.0)
@type all_option() ::
  {:from, String.t()}
  | {:limit, pos_integer()}
  | {:profile_id, String.t() | nil}
  | {:testmode, boolean()}
  | {:pool_timeout, pos_integer()}
  | {:receive_timeout, pos_integer()}
  | {:request_timeout, pos_integer()}

cancel_option()

(since 0.4.0)
@type cancel_option() ::
  {:idempotency_key, String.t()}
  | {:testmode, boolean()}
  | {:pool_timeout, pos_integer()}
  | {:receive_timeout, pos_integer()}
  | {:request_timeout, pos_integer()}

create_option()

(since 0.4.0)
@type create_option() ::
  {:idempotency_key, String.t()}
  | {:profile_id, String.t()}
  | {:testmode, boolean()}
  | {:pool_timeout, pos_integer()}
  | {:receive_timeout, pos_integer()}
  | {:request_timeout, pos_integer()}

create_params()

(since 0.4.0)
@type create_params() :: map()

get_option()

(since 0.4.0)
@type get_option() ::
  {:testmode, boolean()}
  | {:pool_timeout, pos_integer()}
  | {:receive_timeout, pos_integer()}
  | {:request_timeout, pos_integer()}

list_option()

(since 0.4.0)
@type list_option() ::
  {:from, String.t()}
  | {:limit, pos_integer()}
  | {:sort, :asc | :desc | String.t()}
  | {:testmode, boolean()}
  | {:pool_timeout, pos_integer()}
  | {:receive_timeout, pos_integer()}
  | {:request_timeout, pos_integer()}

list_payments_option()

(since 0.4.0)
@type list_payments_option() ::
  {:from, String.t()}
  | {:limit, pos_integer()}
  | {:sort, :asc | :desc | String.t()}
  | {:profile_id, String.t()}
  | {:testmode, boolean()}
  | {:pool_timeout, pos_integer()}
  | {:receive_timeout, pos_integer()}
  | {:request_timeout, pos_integer()}

update_option()

(since 0.4.0)
@type update_option() ::
  {:idempotency_key, String.t()}
  | {:testmode, boolean()}
  | {:pool_timeout, pos_integer()}
  | {:receive_timeout, pos_integer()}
  | {:request_timeout, pos_integer()}

update_params()

(since 0.4.0)
@type update_params() :: map()

Functions

all(client, opts \\ [])

(since 0.4.0)

Lists subscriptions across customers.

Pass profile_id: nil with organization-level credentials to omit a configured client profile and list subscriptions across the organization.

cancel(client, customer_id, subscription_id, opts \\ [])

(since 0.4.0)
@spec cancel(MollieEx.Client.t(), String.t(), String.t(), [cancel_option()]) ::
  {:ok, MollieEx.Subscription.t()} | {:error, MollieEx.Error.t()}

Cancels a customer subscription by ID.

Subscription cancellation supports caller-owned idempotency keys. The SDK never generates idempotency keys implicitly.

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

(since 0.4.0)
@spec create(MollieEx.Client.t(), String.t(), create_params(), [create_option()]) ::
  {:ok, MollieEx.Subscription.t()} | {:error, MollieEx.Error.t()}

Creates a subscription for a customer.

Subscription creation supports caller-owned idempotency keys. The SDK never generates idempotency keys implicitly.

get(client, customer_id, subscription_id, opts \\ [])

(since 0.4.0)
@spec get(MollieEx.Client.t(), String.t(), String.t(), [get_option()]) ::
  {:ok, MollieEx.Subscription.t()} | {:error, MollieEx.Error.t()}

Retrieves a customer subscription by ID.

list(client, customer_id, opts \\ [])

(since 0.4.0)

Lists subscriptions for a customer.

list_payments(client, customer_id, subscription_id, opts \\ [])

(since 0.4.0)
@spec list_payments(MollieEx.Client.t(), String.t(), String.t(), [
  list_payments_option()
]) ::
  {:ok, MollieEx.List.t(MollieEx.Payment.t())} | {:error, MollieEx.Error.t()}

Lists payments generated for a subscription.

update(client, customer_id, subscription_id, params, opts \\ [])

(since 0.4.0)
@spec update(MollieEx.Client.t(), String.t(), String.t(), update_params(), [
  update_option()
]) ::
  {:ok, MollieEx.Subscription.t()} | {:error, MollieEx.Error.t()}

Updates a customer subscription by ID.

Subscription updates support caller-owned idempotency keys. The SDK never generates idempotency keys implicitly.