Paddle.SubscriptionPayment (paddlex v0.2.0)

Copy Markdown View Source

List and reschedule payments related to subscriptions.

Summary

Functions

List all paid and upcoming (unpaid) payments

Change the due date of the upcoming subscription payment

Types

list_args()

@type list_args() :: [
  plan: integer(),
  is_paid: boolean(),
  from: String.t(),
  to: String.t(),
  is_one_off_charge: boolean()
]

t()

@type t() :: %Paddle.SubscriptionPayment{
  amount: integer(),
  currency: String.t(),
  id: integer(),
  is_one_off_charge: boolean(),
  is_paid: boolean(),
  payout_date: String.t(),
  receipt_url: String.t(),
  subscription_id: integer()
}

Functions

list(opts \\ [])

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

List all paid and upcoming (unpaid) payments

Examples

Paddle.SubscriptionPayment.list() 
{:ok, [%Paddle.SubscriptionPayment{
  id: 8936,
  subscription_id: 2746,
  amount: 1,
  currency: "USD",
  payout_date: "2015-10-15",
  is_paid: 0,
  is_one_off_charge: 0,
  receipt_url: "https://www.paddle.com/receipt/469214-8936/1940881-chrea0eb34164b5-f0d6553bdf"
}]}

reschedule(payment_id, date, opts \\ [])

@spec reschedule(integer(), Date.t(), keyword()) ::
  {:ok, nil} | {:error, Paddle.Error.t()}

Change the due date of the upcoming subscription payment

Note: You may need to first call Paddle.SubscriptionPayment.list/1 to obtain an upcoming (unpaid) payment ID value to make this call.

Examples

Paddle.SubscriptionPayment.reschedule(10, ~D[2015-10-15])
{:ok, nil}