Class: SmplkitGeneratedClient::App::BillingApi

Inherits:
Object
  • Object
show all
Defined in:
lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ BillingApi

Returns a new instance of BillingApi.



19
20
21
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#cancel_subscription(id, opts = {}) ⇒ SubscriptionResponse

Cancel Subscription Cancel a subscription at end of the current billing period.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



27
28
29
30
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 27

def cancel_subscription(id, opts = {})
  data, _status_code, _headers = cancel_subscription_with_http_info(id, opts)
  data
end

#cancel_subscription_with_http_info(id, opts = {}) ⇒ Array<(SubscriptionResponse, Integer, Hash)>

Cancel Subscription Cancel a subscription at end of the current billing period.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(SubscriptionResponse, Integer, Hash)>)

    SubscriptionResponse data, response status code and response headers



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 37

def cancel_subscription_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.cancel_subscription ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling BillingApi.cancel_subscription"
  end
  # resource path
  local_var_path = '/api/v1/subscriptions/{id}/actions/cancel'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'SubscriptionResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"BillingApi.cancel_subscription",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BillingApi#cancel_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_payment_method(add_payment_method_body, opts = {}) ⇒ PaymentMethodResponse

Add Payment Method Register a Stripe payment method (“pm_…“) as a persistent resource. The frontend obtains the Stripe ID via SetupIntent + Stripe Elements, then POSTs it here. Body shape and server behavior per ADR-044 §5.1.

Parameters:

  • add_payment_method_body (AddPaymentMethodBody)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



90
91
92
93
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 90

def create_payment_method(add_payment_method_body, opts = {})
  data, _status_code, _headers = create_payment_method_with_http_info(add_payment_method_body, opts)
  data
end

#create_payment_method_with_http_info(add_payment_method_body, opts = {}) ⇒ Array<(PaymentMethodResponse, Integer, Hash)>

Add Payment Method Register a Stripe payment method (&#x60;&#x60;pm_…&#x60;&#x60;) as a persistent resource. The frontend obtains the Stripe ID via SetupIntent + Stripe Elements, then POSTs it here. Body shape and server behavior per ADR-044 §5.1.

Parameters:

  • add_payment_method_body (AddPaymentMethodBody)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(PaymentMethodResponse, Integer, Hash)>)

    PaymentMethodResponse data, response status code and response headers



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 100

def create_payment_method_with_http_info(add_payment_method_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.create_payment_method ...'
  end
  # verify the required parameter 'add_payment_method_body' is set
  if @api_client.config.client_side_validation && add_payment_method_body.nil?
    fail ArgumentError, "Missing the required parameter 'add_payment_method_body' when calling BillingApi.create_payment_method"
  end
  # resource path
  local_var_path = '/api/v1/payment_methods'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(add_payment_method_body)

  # return_type
  return_type = opts[:debug_return_type] || 'PaymentMethodResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"BillingApi.create_payment_method",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BillingApi#create_payment_method\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_subscription(create_subscription_body, opts = {}) ⇒ SubscriptionResponse

Create Subscription Create a new paid subscription for a product.

Parameters:

Returns:



158
159
160
161
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 158

def create_subscription(create_subscription_body, opts = {})
  data, _status_code, _headers = create_subscription_with_http_info(create_subscription_body, opts)
  data
end

#create_subscription_with_http_info(create_subscription_body, opts = {}) ⇒ Array<(SubscriptionResponse, Integer, Hash)>

Create Subscription Create a new paid subscription for a product.

Parameters:

Returns:

  • (Array<(SubscriptionResponse, Integer, Hash)>)

    SubscriptionResponse data, response status code and response headers



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 168

def create_subscription_with_http_info(create_subscription_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.create_subscription ...'
  end
  # verify the required parameter 'create_subscription_body' is set
  if @api_client.config.client_side_validation && create_subscription_body.nil?
    fail ArgumentError, "Missing the required parameter 'create_subscription_body' when calling BillingApi.create_subscription"
  end
  # resource path
  local_var_path = '/api/v1/subscriptions'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_subscription_body)

  # return_type
  return_type = opts[:debug_return_type] || 'SubscriptionResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"BillingApi.create_subscription",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BillingApi#create_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_payment_method(id, opts = {}) ⇒ nil

Delete Payment Method Detach the payment method from Stripe and soft-delete the local row. Returns 409 if this is the only PM and the account has an active paid subscription. If the deleted row was default, the oldest remaining row is promoted.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


226
227
228
229
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 226

def delete_payment_method(id, opts = {})
  delete_payment_method_with_http_info(id, opts)
  nil
end

#delete_payment_method_with_http_info(id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete Payment Method Detach the payment method from Stripe and soft-delete the local row. Returns 409 if this is the only PM and the account has an active paid subscription. If the deleted row was default, the oldest remaining row is promoted.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 236

def delete_payment_method_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.delete_payment_method ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling BillingApi.delete_payment_method"
  end
  # resource path
  local_var_path = '/api/v1/payment_methods/{id}'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"BillingApi.delete_payment_method",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BillingApi#delete_payment_method\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#downgrade_subscription(id, plan_change_request, opts = {}) ⇒ SubscriptionResponse

Downgrade Subscription Downgrade an existing paid subscription to a lower plan.

Parameters:

  • id (String)
  • plan_change_request (PlanChangeRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



290
291
292
293
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 290

def downgrade_subscription(id, plan_change_request, opts = {})
  data, _status_code, _headers = downgrade_subscription_with_http_info(id, plan_change_request, opts)
  data
end

#downgrade_subscription_with_http_info(id, plan_change_request, opts = {}) ⇒ Array<(SubscriptionResponse, Integer, Hash)>

Downgrade Subscription Downgrade an existing paid subscription to a lower plan.

Parameters:

  • id (String)
  • plan_change_request (PlanChangeRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(SubscriptionResponse, Integer, Hash)>)

    SubscriptionResponse data, response status code and response headers



301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 301

def downgrade_subscription_with_http_info(id, plan_change_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.downgrade_subscription ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling BillingApi.downgrade_subscription"
  end
  # verify the required parameter 'plan_change_request' is set
  if @api_client.config.client_side_validation && plan_change_request.nil?
    fail ArgumentError, "Missing the required parameter 'plan_change_request' when calling BillingApi.downgrade_subscription"
  end
  # resource path
  local_var_path = '/api/v1/subscriptions/{id}/actions/downgrade'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(plan_change_request)

  # return_type
  return_type = opts[:debug_return_type] || 'SubscriptionResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"BillingApi.downgrade_subscription",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BillingApi#downgrade_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#execute_setup_intent(opts = {}) ⇒ SetupIntentResponse

Execute Setup Intent Create a Stripe SetupIntent for saving a payment method. Returns a “client_secret“ that the frontend passes to Stripe’s Payment Element so the customer can securely enter card details without an immediate charge.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



362
363
364
365
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 362

def execute_setup_intent(opts = {})
  data, _status_code, _headers = execute_setup_intent_with_http_info(opts)
  data
end

#execute_setup_intent_with_http_info(opts = {}) ⇒ Array<(SetupIntentResponse, Integer, Hash)>

Execute Setup Intent Create a Stripe SetupIntent for saving a payment method. Returns a &#x60;&#x60;client_secret&#x60;&#x60; that the frontend passes to Stripe&#39;s Payment Element so the customer can securely enter card details without an immediate charge.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(SetupIntentResponse, Integer, Hash)>)

    SetupIntentResponse data, response status code and response headers



371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 371

def execute_setup_intent_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.execute_setup_intent ...'
  end
  # resource path
  local_var_path = '/api/v1/functions/setup_intent/actions/execute'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'SetupIntentResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"BillingApi.execute_setup_intent",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BillingApi#execute_setup_intent\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_invoice(invoice_id, opts = {}) ⇒ InvoiceSingleResponse

Get Invoice Return a single invoice by ID. Supports content negotiation via Accept header: - “application/pdf“ — PDF bytes proxy-streamed from Stripe - “application/vnd.api+json“ / “application/json“ / absent — JSON:API resource - Any other value — 406 Not Acceptable

Parameters:

  • invoice_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



420
421
422
423
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 420

def get_invoice(invoice_id, opts = {})
  data, _status_code, _headers = get_invoice_with_http_info(invoice_id, opts)
  data
end

#get_invoice_with_http_info(invoice_id, opts = {}) ⇒ Array<(InvoiceSingleResponse, Integer, Hash)>

Get Invoice Return a single invoice by ID. Supports content negotiation via Accept header: - &#x60;&#x60;application/pdf&#x60;&#x60; — PDF bytes proxy-streamed from Stripe - &#x60;&#x60;application/vnd.api+json&#x60;&#x60; / &#x60;&#x60;application/json&#x60;&#x60; / absent — JSON:API resource - Any other value — 406 Not Acceptable

Parameters:

  • invoice_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(InvoiceSingleResponse, Integer, Hash)>)

    InvoiceSingleResponse data, response status code and response headers



430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 430

def get_invoice_with_http_info(invoice_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.get_invoice ...'
  end
  # verify the required parameter 'invoice_id' is set
  if @api_client.config.client_side_validation && invoice_id.nil?
    fail ArgumentError, "Missing the required parameter 'invoice_id' when calling BillingApi.get_invoice"
  end
  # resource path
  local_var_path = '/api/v1/invoices/{invoice_id}'.sub('{invoice_id}', CGI.escape(invoice_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'InvoiceSingleResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"BillingApi.get_invoice",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BillingApi#get_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_payment_method(id, opts = {}) ⇒ PaymentMethodResponse

Get Payment Method Return a payment method by id.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



483
484
485
486
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 483

def get_payment_method(id, opts = {})
  data, _status_code, _headers = get_payment_method_with_http_info(id, opts)
  data
end

#get_payment_method_with_http_info(id, opts = {}) ⇒ Array<(PaymentMethodResponse, Integer, Hash)>

Get Payment Method Return a payment method by id.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(PaymentMethodResponse, Integer, Hash)>)

    PaymentMethodResponse data, response status code and response headers



493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 493

def get_payment_method_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.get_payment_method ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling BillingApi.get_payment_method"
  end
  # resource path
  local_var_path = '/api/v1/payment_methods/{id}'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'PaymentMethodResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"BillingApi.get_payment_method",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BillingApi#get_payment_method\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_invoices(opts = {}) ⇒ InvoiceListResponse

List Invoices Return invoice history for the account from Stripe.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



545
546
547
548
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 545

def list_invoices(opts = {})
  data, _status_code, _headers = list_invoices_with_http_info(opts)
  data
end

#list_invoices_with_http_info(opts = {}) ⇒ Array<(InvoiceListResponse, Integer, Hash)>

List Invoices Return invoice history for the account from Stripe.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(InvoiceListResponse, Integer, Hash)>)

    InvoiceListResponse data, response status code and response headers



554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 554

def list_invoices_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.list_invoices ...'
  end
  # resource path
  local_var_path = '/api/v1/invoices'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'InvoiceListResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"BillingApi.list_invoices",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BillingApi#list_invoices\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_payment_methods(opts = {}) ⇒ PaymentMethodListResponse

List Payment Methods List all payment methods for the account. Default is returned first, then newest first.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



602
603
604
605
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 602

def list_payment_methods(opts = {})
  data, _status_code, _headers = list_payment_methods_with_http_info(opts)
  data
end

#list_payment_methods_with_http_info(opts = {}) ⇒ Array<(PaymentMethodListResponse, Integer, Hash)>

List Payment Methods List all payment methods for the account. Default is returned first, then newest first.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(PaymentMethodListResponse, Integer, Hash)>)

    PaymentMethodListResponse data, response status code and response headers



611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 611

def list_payment_methods_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.list_payment_methods ...'
  end
  # resource path
  local_var_path = '/api/v1/payment_methods'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'PaymentMethodListResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"BillingApi.list_payment_methods",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BillingApi#list_payment_methods\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_subscriptions(opts = {}) ⇒ SubscriptionListResponse

List Subscriptions Return subscription rows for the authenticated account.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



659
660
661
662
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 659

def list_subscriptions(opts = {})
  data, _status_code, _headers = list_subscriptions_with_http_info(opts)
  data
end

#list_subscriptions_with_http_info(opts = {}) ⇒ Array<(SubscriptionListResponse, Integer, Hash)>

List Subscriptions Return subscription rows for the authenticated account.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(SubscriptionListResponse, Integer, Hash)>)

    SubscriptionListResponse data, response status code and response headers



668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 668

def list_subscriptions_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.list_subscriptions ...'
  end
  # resource path
  local_var_path = '/api/v1/subscriptions'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'SubscriptionListResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"BillingApi.list_subscriptions",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BillingApi#list_subscriptions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#set_default_payment_method(id, opts = {}) ⇒ PaymentMethodResponse

Set Default Payment Method Mark this payment method as the account’s default. Idempotent — a no-op 200 if already default.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



717
718
719
720
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 717

def set_default_payment_method(id, opts = {})
  data, _status_code, _headers = set_default_payment_method_with_http_info(id, opts)
  data
end

#set_default_payment_method_with_http_info(id, opts = {}) ⇒ Array<(PaymentMethodResponse, Integer, Hash)>

Set Default Payment Method Mark this payment method as the account&#39;s default. Idempotent — a no-op 200 if already default.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(PaymentMethodResponse, Integer, Hash)>)

    PaymentMethodResponse data, response status code and response headers



727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 727

def set_default_payment_method_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.set_default_payment_method ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling BillingApi.set_default_payment_method"
  end
  # resource path
  local_var_path = '/api/v1/payment_methods/{id}/actions/set_default'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'PaymentMethodResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"BillingApi.set_default_payment_method",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BillingApi#set_default_payment_method\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#uncancel_subscription(id, opts = {}) ⇒ SubscriptionResponse

Undo Cancellation Reverse a pending cancellation; subscription will renew as normal.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



780
781
782
783
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 780

def uncancel_subscription(id, opts = {})
  data, _status_code, _headers = uncancel_subscription_with_http_info(id, opts)
  data
end

#uncancel_subscription_with_http_info(id, opts = {}) ⇒ Array<(SubscriptionResponse, Integer, Hash)>

Undo Cancellation Reverse a pending cancellation; subscription will renew as normal.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(SubscriptionResponse, Integer, Hash)>)

    SubscriptionResponse data, response status code and response headers



790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 790

def uncancel_subscription_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.uncancel_subscription ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling BillingApi.uncancel_subscription"
  end
  # resource path
  local_var_path = '/api/v1/subscriptions/{id}/actions/uncancel'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'SubscriptionResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"BillingApi.uncancel_subscription",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BillingApi#uncancel_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#undowngrade_subscription(id, opts = {}) ⇒ SubscriptionResponse

Undo Pending Downgrade Reverse a pending downgrade scheduled for end of the current billing period.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



843
844
845
846
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 843

def undowngrade_subscription(id, opts = {})
  data, _status_code, _headers = undowngrade_subscription_with_http_info(id, opts)
  data
end

#undowngrade_subscription_with_http_info(id, opts = {}) ⇒ Array<(SubscriptionResponse, Integer, Hash)>

Undo Pending Downgrade Reverse a pending downgrade scheduled for end of the current billing period.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(SubscriptionResponse, Integer, Hash)>)

    SubscriptionResponse data, response status code and response headers



853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 853

def undowngrade_subscription_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.undowngrade_subscription ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling BillingApi.undowngrade_subscription"
  end
  # resource path
  local_var_path = '/api/v1/subscriptions/{id}/actions/undowngrade'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'SubscriptionResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"BillingApi.undowngrade_subscription",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BillingApi#undowngrade_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_payment_method(id, payment_method_response, opts = {}) ⇒ PaymentMethodResponse

Update Payment Method Update the mutable fields (“billing_details“, “exp_month“, “exp_year“). The “default“ field is not mutable via PUT — see ADR-044 §5.2; use the “set_default“ action instead.

Parameters:

  • id (String)
  • payment_method_response (PaymentMethodResponse)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



907
908
909
910
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 907

def update_payment_method(id, payment_method_response, opts = {})
  data, _status_code, _headers = update_payment_method_with_http_info(id, payment_method_response, opts)
  data
end

#update_payment_method_with_http_info(id, payment_method_response, opts = {}) ⇒ Array<(PaymentMethodResponse, Integer, Hash)>

Update Payment Method Update the mutable fields (&#x60;&#x60;billing_details&#x60;&#x60;, &#x60;&#x60;exp_month&#x60;&#x60;, &#x60;&#x60;exp_year&#x60;&#x60;). The &#x60;&#x60;default&#x60;&#x60; field is not mutable via PUT — see ADR-044 §5.2; use the &#x60;&#x60;set_default&#x60;&#x60; action instead.

Parameters:

  • id (String)
  • payment_method_response (PaymentMethodResponse)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(PaymentMethodResponse, Integer, Hash)>)

    PaymentMethodResponse data, response status code and response headers



918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 918

def update_payment_method_with_http_info(id, payment_method_response, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.update_payment_method ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling BillingApi.update_payment_method"
  end
  # verify the required parameter 'payment_method_response' is set
  if @api_client.config.client_side_validation && payment_method_response.nil?
    fail ArgumentError, "Missing the required parameter 'payment_method_response' when calling BillingApi.update_payment_method"
  end
  # resource path
  local_var_path = '/api/v1/payment_methods/{id}'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(payment_method_response)

  # return_type
  return_type = opts[:debug_return_type] || 'PaymentMethodResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"BillingApi.update_payment_method",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BillingApi#update_payment_method\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#upgrade_subscription(id, plan_change_request, opts = {}) ⇒ SubscriptionResponse

Upgrade Subscription Upgrade an existing paid subscription to a higher plan.

Parameters:

  • id (String)
  • plan_change_request (PlanChangeRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



981
982
983
984
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 981

def upgrade_subscription(id, plan_change_request, opts = {})
  data, _status_code, _headers = upgrade_subscription_with_http_info(id, plan_change_request, opts)
  data
end

#upgrade_subscription_with_http_info(id, plan_change_request, opts = {}) ⇒ Array<(SubscriptionResponse, Integer, Hash)>

Upgrade Subscription Upgrade an existing paid subscription to a higher plan.

Parameters:

  • id (String)
  • plan_change_request (PlanChangeRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(SubscriptionResponse, Integer, Hash)>)

    SubscriptionResponse data, response status code and response headers



992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
# File 'lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb', line 992

def upgrade_subscription_with_http_info(id, plan_change_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.upgrade_subscription ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling BillingApi.upgrade_subscription"
  end
  # verify the required parameter 'plan_change_request' is set
  if @api_client.config.client_side_validation && plan_change_request.nil?
    fail ArgumentError, "Missing the required parameter 'plan_change_request' when calling BillingApi.upgrade_subscription"
  end
  # resource path
  local_var_path = '/api/v1/subscriptions/{id}/actions/upgrade'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(plan_change_request)

  # return_type
  return_type = opts[:debug_return_type] || 'SubscriptionResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['HTTPBearer']

  new_options = opts.merge(
    :operation => :"BillingApi.upgrade_subscription",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BillingApi#upgrade_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end