Paddle.Plan (paddlex v0.1.0) View Source

Plan

Link to this section Summary

Functions

Create a new subscription plan with the supplied parameters

List all of the available subscription plans in your account

Link to this section Types

Specs

t() :: %{
  id: integer(),
  name: atom(),
  billing_type: String.t(),
  billing_period: integer(),
  intial_price: number(),
  recurring_price: number(),
  trial_days: non_neg_integer()
}

Link to this section Functions

Specs

create(params) :: {:ok, integer()} | {:error, Paddle.Error.t()}
when params: %{
       :plan_name => String.t(),
       :plan_length => pos_integer(),
       :plan_type => String.t(),
       optional(:plan_trial_days) => non_neg_integer(),
       optional(:main_currency_code) => String.t(),
       optional(:recurring_price_usd) => String.t(),
       optional(:recurring_price_gbp) => String.t()
     }

Create a new subscription plan with the supplied parameters

Examples

params = %{
  main_currency_code: "USD",
  plan_length: 123,
  plan_name: "Test",
  plan_trial_days: "123",
  plan_type: "day",
  recurring_price_eur: "10.00",
  recurring_price_gbp: "20.00",
  recurring_price_usd: "30.00",
}
Paddle.Plan.create(params)
{:ok, 502198}

Specs

list(keyword()) :: {:ok, [t()]} | {:error, Paddle.Error.t()}

List all of the available subscription plans in your account

Optionally also accepts the parameter plan_id with the value of a Plan/Product ID, to return just the information related to that specific plan.

Examples

Paddle.Plan.list() 
{:ok, [
  %Paddle.Plan{
    billing_period: 1,
    billing_type: "day",
    id: 9636,
    initial_price: %{"USD" => "0.00"},
    name: "Test",
    recurring_price: %{"USD" => "10.00"},
    trial_days: 0
  }
]}