Class: Stripe::SubscriptionScheduleService

Inherits:
StripeService show all
Defined in:
lib/stripe/services/subscription_schedule_service.rb

Defined Under Namespace

Classes: AmendParams, CancelParams, CreateParams, ListParams, ReleaseParams, RetrieveParams, UpdateParams

Instance Method Summary collapse

Methods inherited from StripeService

#initialize, #request, #request_stream

Constructor Details

This class inherits a constructor from Stripe::StripeService

Instance Method Details

#amend(schedule, params = {}, opts = {}) ⇒ Object

Amends an existing subscription schedule.



1963
1964
1965
1966
1967
1968
1969
1970
1971
# File 'lib/stripe/services/subscription_schedule_service.rb', line 1963

def amend(schedule, params = {}, opts = {})
  request(
    method: :post,
    path: format("/v1/subscription_schedules/%<schedule>s/amend", { schedule: CGI.escape(schedule) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

#cancel(schedule, params = {}, opts = {}) ⇒ Object

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 not_started or active.



1974
1975
1976
1977
1978
1979
1980
1981
1982
# File 'lib/stripe/services/subscription_schedule_service.rb', line 1974

def cancel(schedule, params = {}, opts = {})
  request(
    method: :post,
    path: format("/v1/subscription_schedules/%<schedule>s/cancel", { schedule: CGI.escape(schedule) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

#create(params = {}, opts = {}) ⇒ Object

Creates a new subscription schedule object. Each customer can have up to 500 active or scheduled subscriptions.



1985
1986
1987
1988
1989
1990
1991
1992
1993
# File 'lib/stripe/services/subscription_schedule_service.rb', line 1985

def create(params = {}, opts = {})
  request(
    method: :post,
    path: "/v1/subscription_schedules",
    params: params,
    opts: opts,
    base_address: :api
  )
end

#list(params = {}, opts = {}) ⇒ Object

Retrieves the list of your subscription schedules.



1996
1997
1998
1999
2000
2001
2002
2003
2004
# File 'lib/stripe/services/subscription_schedule_service.rb', line 1996

def list(params = {}, opts = {})
  request(
    method: :get,
    path: "/v1/subscription_schedules",
    params: params,
    opts: opts,
    base_address: :api
  )
end

#release(schedule, params = {}, opts = {}) ⇒ Object

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 not_started or active. If the subscription schedule is currently associated with a subscription, releasing it will remove its subscription property and set the subscription’s ID to the released_subscription property.



2007
2008
2009
2010
2011
2012
2013
2014
2015
# File 'lib/stripe/services/subscription_schedule_service.rb', line 2007

def release(schedule, params = {}, opts = {})
  request(
    method: :post,
    path: format("/v1/subscription_schedules/%<schedule>s/release", { schedule: CGI.escape(schedule) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

#retrieve(schedule, params = {}, opts = {}) ⇒ Object

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.



2018
2019
2020
2021
2022
2023
2024
2025
2026
# File 'lib/stripe/services/subscription_schedule_service.rb', line 2018

def retrieve(schedule, params = {}, opts = {})
  request(
    method: :get,
    path: format("/v1/subscription_schedules/%<schedule>s", { schedule: CGI.escape(schedule) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

#update(schedule, params = {}, opts = {}) ⇒ Object

Updates an existing subscription schedule.



2029
2030
2031
2032
2033
2034
2035
2036
2037
# File 'lib/stripe/services/subscription_schedule_service.rb', line 2029

def update(schedule, params = {}, opts = {})
  request(
    method: :post,
    path: format("/v1/subscription_schedules/%<schedule>s", { schedule: CGI.escape(schedule) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end