Class: Stripe::SubscriptionScheduleService

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

Defined Under Namespace

Classes: 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

#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.



1204
1205
1206
1207
1208
1209
1210
1211
1212
# File 'lib/stripe/services/subscription_schedule_service.rb', line 1204

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.



1215
1216
1217
1218
1219
1220
1221
1222
1223
# File 'lib/stripe/services/subscription_schedule_service.rb', line 1215

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.



1226
1227
1228
1229
1230
1231
1232
1233
1234
# File 'lib/stripe/services/subscription_schedule_service.rb', line 1226

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.



1237
1238
1239
1240
1241
1242
1243
1244
1245
# File 'lib/stripe/services/subscription_schedule_service.rb', line 1237

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.



1248
1249
1250
1251
1252
1253
1254
1255
1256
# File 'lib/stripe/services/subscription_schedule_service.rb', line 1248

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.



1259
1260
1261
1262
1263
1264
1265
1266
1267
# File 'lib/stripe/services/subscription_schedule_service.rb', line 1259

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