Money.Subscription.new

You're seeing just the function new, go back to Money.Subscription module for more information.
Link to this function

new(plan, effective_date, options \\ [])

View Source

Specs

new(
  plan :: Money.Subscription.Plan.t(),
  effective_date :: Date.t(),
  Keyword.t()
) :: {:ok, t()} | {:error, {module(), String.t()}}

Creates a new subscription.

Arguments

  • plan is any Money.Subscription.Plan.t the defines the initial plan

  • effective_date is a Date.t that represents the effective date of the initial plan. This defines the start of the first interval

  • options is a keyword list of options

Options

  • :id is any term that an application can use to uniquely identify this subscription. It is not used in any function in this module.

  • :created_at is a DateTime.t that records the timestamp when the subscription was created. The default is DateTime.utc_now/0

Returns

  • {:ok, Money.Subscription.t} or

  • {:error, {exception, message}}