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.



1959
1960
1961
1962
1963
1964
1965
1966
1967
# File 'lib/stripe/services/subscription_schedule_service.rb', line 1959

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.



1970
1971
1972
1973
1974
1975
1976
1977
1978
# File 'lib/stripe/services/subscription_schedule_service.rb', line 1970

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.



1981
1982
1983
1984
1985
1986
1987
1988
1989
# File 'lib/stripe/services/subscription_schedule_service.rb', line 1981

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.



1992
1993
1994
1995
1996
1997
1998
1999
2000
# File 'lib/stripe/services/subscription_schedule_service.rb', line 1992

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.



2003
2004
2005
2006
2007
2008
2009
2010
2011
# File 'lib/stripe/services/subscription_schedule_service.rb', line 2003

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.



2014
2015
2016
2017
2018
2019
2020
2021
2022
# File 'lib/stripe/services/subscription_schedule_service.rb', line 2014

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.



2025
2026
2027
2028
2029
2030
2031
2032
2033
# File 'lib/stripe/services/subscription_schedule_service.rb', line 2025

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