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.



1302
1303
1304
1305
1306
1307
1308
1309
1310
# File 'lib/stripe/services/subscription_schedule_service.rb', line 1302

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.



1313
1314
1315
1316
1317
1318
1319
1320
1321
# File 'lib/stripe/services/subscription_schedule_service.rb', line 1313

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.



1324
1325
1326
1327
1328
1329
1330
1331
1332
# File 'lib/stripe/services/subscription_schedule_service.rb', line 1324

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.



1335
1336
1337
1338
1339
1340
1341
1342
1343
# File 'lib/stripe/services/subscription_schedule_service.rb', line 1335

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.



1346
1347
1348
1349
1350
1351
1352
1353
1354
# File 'lib/stripe/services/subscription_schedule_service.rb', line 1346

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.



1357
1358
1359
1360
1361
1362
1363
1364
1365
# File 'lib/stripe/services/subscription_schedule_service.rb', line 1357

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