Paddle.Subscription.update

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

update(subscription_id, params)

View Source

Specs

update(integer(), params) :: {:ok, map()} | {:error, Paddle.Error.t()}
when params: %{
       :quantity => integer(),
       optional(:currency) => String.t(),
       optional(:recurring_price) => number(),
       optional(:bill_immediately) => boolean(),
       optional(:plan_id) => integer(),
       optional(:prorate) => boolean(),
       optional(:keep_modifiers) => boolean(),
       optional(:passthrough) => String.t(),
       optional(:pause) => boolean()
     }

Update the quantity, price, and/or plan of a user’s subscription

Usage Notes

  • Subscribers on non-quantity plans can move to quantity plans but not the inverse.
  • Subscribers must be billed immediately when moving to a plan with a different billing interval.
  • Subscribers cannot be moved to a plan where the current currency is not enabled.
  • Subscribers cannot be moved to a different plan while on a trialing state.
  • Subscribers in a paused state cannot be modified until they restart their subscription.
  • Subscribers in a past due state can only have the passthrough or pause field updated.
  • The currency of an existing subscription cannot be changed.
  • Recurring coupons (if present) will be removed when this API is used.

Examples

params = %{
  bill_immediately: true,
  plan_id: 525123,
  prorate: true,
  keep_modifiers: true,
  passthrough: true,
  pause: true
}
Paddle.Subscription.update(12345, params) 
{:ok, %{
  subscription_id: 12345,
  user_id: 425123,
  plan_id: 525123,
  next_payment: %{
    "amount" => 144.06,
    "currency" => "GBP",
    "date" => ~D"2018-02-15",
  }
}}