View Source ExOAPI.Stripe.SDK.SubscriptionSchedules (exoapi_stripe v0.1.4)

Link to this section Summary

Functions

description: <p>Retrieves the list of your subscription schedules.</p>

description: <p>Retrieves the details of an existing subscription schedule. You only need to supply the unique subscription schedule identifier that was returned upon subscription schedule creation.</p>

description: <p>Creates a new subscription schedule object. Each customer can have up to 500 active or scheduled subscriptions.</p>

description: <p>Updates an existing subscription schedule.</p>

description: <p>Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). A subscription schedule can only be canceled if its status is <code>not_started</code> or <code>active</code>.</p>

description: <p>Releases the subscription schedule immediately, which will stop scheduling of its phases, but leave any existing subscription in place. A schedule can only be released if its status is <code>not_started</code> or <code>active</code>. If the subscription schedule is currently associated with a subscription, releasing it will remove its <code>subscription</code> property and set the subscription’s ID to the <code>released_subscription</code> property.</p>

Link to this section Types

Link to this type

get_subscription_schedules_opts()

View Source
@type get_subscription_schedules_opts() ::
  {:starting_after, String.t()}
  | {:scheduled, String.t()}
  | {:released_at, String.t()}
  | {:limit, String.t()}
  | {:expand, String.t()}
  | {:ending_before, String.t()}
  | {:customer, String.t()}
  | {:created, String.t()}
  | {:completed_at, String.t()}
  | {:canceled_at, String.t()}
Link to this type

get_subscription_schedules_schedule_opts()

View Source
@type get_subscription_schedules_schedule_opts() :: {:expand, String.t()}

Link to this section Functions

Link to this function

get_subscription_schedules(client, opts \\ [])

View Source
@spec get_subscription_schedules(client :: ExOAPI.Client.t(), [
  get_subscription_schedules_opts()
]) ::
  {:ok,
   ExOAPI.Stripe.Schemas.Error.t()
   | %{
       url: String.t(),
       object: String.t() | :list,
       has_more: boolean(),
       data: [ExOAPI.Stripe.Schemas.SubscriptionSchedule.t()]
     }
   | map()}
  | {:error, any()}

description: <p>Retrieves the list of your subscription schedules.</p>

Link to this function

get_subscription_schedules_schedule(client, schedule, opts \\ [])

View Source
@spec get_subscription_schedules_schedule(
  client :: ExOAPI.Client.t(),
  schedule :: String.t(),
  [get_subscription_schedules_schedule_opts()]
) ::
  {:ok,
   ExOAPI.Stripe.Schemas.Error.t()
   | ExOAPI.Stripe.Schemas.SubscriptionSchedule.t()
   | map()}
  | {:error, any()}

description: <p>Retrieves the details of an existing subscription schedule. You only need to supply the unique subscription schedule identifier that was returned upon subscription schedule creation.</p>

Link to this function

post_subscription_schedules(client, body)

View Source
@spec post_subscription_schedules(
  client :: ExOAPI.Client.t(),
  body ::
    %{
      start_date: String.t() | :now | integer(),
      phases: [
        %{
          trial_end: integer(),
          trial: boolean(),
          transfer_data: %{destination: String.t(), amount_percent: number()},
          proration_behavior:
            String.t() | :always_invoice | :create_prorations | :none,
          iterations: integer(),
          items: [
            %{
              tax_rates: String.t() | [String.t()],
              quantity: integer(),
              price_data: %{
                unit_amount_decimal: String.t(),
                unit_amount: integer(),
                tax_behavior:
                  String.t() | :exclusive | :inclusive | :unspecified,
                recurring: %{
                  interval_count: integer(),
                  interval: String.t() | :day | :month | :week | :year
                },
                product: String.t(),
                currency: String.t()
              },
              price: String.t(),
              billing_thresholds: String.t() | %{usage_gte: integer()}
            }
          ],
          invoice_settings: %{days_until_due: integer()},
          end_date: integer(),
          default_tax_rates: String.t() | [String.t()],
          default_payment_method: String.t(),
          coupon: String.t(),
          collection_method: String.t() | :charge_automatically | :send_invoice,
          billing_thresholds:
            String.t()
            | %{reset_billing_cycle_anchor: boolean(), amount_gte: integer()},
          billing_cycle_anchor: String.t() | :automatic | :phase_start,
          automatic_tax: %{enabled: boolean()},
          application_fee_percent: number(),
          add_invoice_items: [
            %{
              tax_rates: String.t() | [String.t()],
              quantity: integer(),
              price_data: %{
                unit_amount_decimal: String.t(),
                unit_amount: integer(),
                tax_behavior:
                  String.t() | :exclusive | :inclusive | :unspecified,
                product: String.t(),
                currency: String.t()
              },
              price: String.t()
            }
          ]
        }
      ],
      metadata: String.t() | map(),
      from_subscription: String.t(),
      expand: [String.t()],
      end_behavior: String.t() | :cancel | :none | :release | :renew,
      default_settings: %{
        transfer_data:
          String.t() | %{destination: String.t(), amount_percent: number()},
        invoice_settings: %{days_until_due: integer()},
        default_payment_method: String.t(),
        collection_method: String.t() | :charge_automatically | :send_invoice,
        billing_thresholds:
          String.t()
          | %{reset_billing_cycle_anchor: boolean(), amount_gte: integer()},
        billing_cycle_anchor: String.t() | :automatic | :phase_start,
        automatic_tax: %{enabled: boolean()},
        application_fee_percent: number()
      },
      customer: String.t()
    }
    | map()
) ::
  {:ok,
   ExOAPI.Stripe.Schemas.Error.t()
   | ExOAPI.Stripe.Schemas.SubscriptionSchedule.t()
   | map()}
  | {:error, any()}

description: <p>Creates a new subscription schedule object. Each customer can have up to 500 active or scheduled subscriptions.</p>

Link to this function

post_subscription_schedules_schedule(client, body, schedule)

View Source
@spec post_subscription_schedules_schedule(
  client :: ExOAPI.Client.t(),
  body ::
    %{
      proration_behavior:
        String.t() | :always_invoice | :create_prorations | :none,
      phases: [
        %{
          trial_end: String.t() | :now | integer(),
          trial: boolean(),
          transfer_data: %{destination: String.t(), amount_percent: number()},
          start_date: String.t() | :now | integer(),
          proration_behavior:
            String.t() | :always_invoice | :create_prorations | :none,
          iterations: integer(),
          items: [
            %{
              tax_rates: String.t() | [String.t()],
              quantity: integer(),
              price_data: %{
                unit_amount_decimal: String.t(),
                unit_amount: integer(),
                tax_behavior:
                  String.t() | :exclusive | :inclusive | :unspecified,
                recurring: %{
                  interval_count: integer(),
                  interval: String.t() | :day | :month | :week | :year
                },
                product: String.t(),
                currency: String.t()
              },
              price: String.t(),
              billing_thresholds: String.t() | %{usage_gte: integer()}
            }
          ],
          invoice_settings: %{days_until_due: integer()},
          end_date: String.t() | :now | integer(),
          default_tax_rates: String.t() | [String.t()],
          default_payment_method: String.t(),
          coupon: String.t(),
          collection_method: String.t() | :charge_automatically | :send_invoice,
          billing_thresholds:
            String.t()
            | %{reset_billing_cycle_anchor: boolean(), amount_gte: integer()},
          billing_cycle_anchor: String.t() | :automatic | :phase_start,
          automatic_tax: %{enabled: boolean()},
          application_fee_percent: number(),
          add_invoice_items: [
            %{
              tax_rates: String.t() | [String.t()],
              quantity: integer(),
              price_data: %{
                unit_amount_decimal: String.t(),
                unit_amount: integer(),
                tax_behavior:
                  String.t() | :exclusive | :inclusive | :unspecified,
                product: String.t(),
                currency: String.t()
              },
              price: String.t()
            }
          ]
        }
      ],
      metadata: String.t() | map(),
      expand: [String.t()],
      end_behavior: String.t() | :cancel | :none | :release | :renew,
      default_settings: %{
        transfer_data:
          String.t() | %{destination: String.t(), amount_percent: number()},
        invoice_settings: %{days_until_due: integer()},
        default_payment_method: String.t(),
        collection_method: String.t() | :charge_automatically | :send_invoice,
        billing_thresholds:
          String.t()
          | %{reset_billing_cycle_anchor: boolean(), amount_gte: integer()},
        billing_cycle_anchor: String.t() | :automatic | :phase_start,
        automatic_tax: %{enabled: boolean()},
        application_fee_percent: number()
      }
    }
    | map(),
  schedule :: String.t()
) ::
  {:ok,
   ExOAPI.Stripe.Schemas.Error.t()
   | ExOAPI.Stripe.Schemas.SubscriptionSchedule.t()
   | map()}
  | {:error, any()}

description: <p>Updates an existing subscription schedule.</p>

Link to this function

post_subscription_schedules_schedule_cancel(client, body, schedule)

View Source
@spec post_subscription_schedules_schedule_cancel(
  client :: ExOAPI.Client.t(),
  body ::
    %{prorate: boolean(), invoice_now: boolean(), expand: [String.t()]} | map(),
  schedule :: String.t()
) ::
  {:ok,
   ExOAPI.Stripe.Schemas.Error.t()
   | ExOAPI.Stripe.Schemas.SubscriptionSchedule.t()
   | map()}
  | {:error, any()}

description: <p>Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). A subscription schedule can only be canceled if its status is <code>not_started</code> or <code>active</code>.</p>

Link to this function

post_subscription_schedules_schedule_release(client, body, schedule)

View Source
@spec post_subscription_schedules_schedule_release(
  client :: ExOAPI.Client.t(),
  body :: %{preserve_cancel_date: boolean(), expand: [String.t()]} | map(),
  schedule :: String.t()
) ::
  {:ok,
   ExOAPI.Stripe.Schemas.Error.t()
   | ExOAPI.Stripe.Schemas.SubscriptionSchedule.t()
   | map()}
  | {:error, any()}

description: <p>Releases the subscription schedule immediately, which will stop scheduling of its phases, but leave any existing subscription in place. A schedule can only be released if its status is <code>not_started</code> or <code>active</code>. If the subscription schedule is currently associated with a subscription, releasing it will remove its <code>subscription</code> property and set the subscription’s ID to the <code>released_subscription</code> property.</p>