Class: Mudbase::BillingApi

Inherits:
Object
  • Object
show all
Defined in:
lib/mudbase/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/mudbase/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/mudbase/api/billing_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#cancel_subscription(subscription_id, opts = {}) ⇒ DeleteRole200Response

Cancel subscription

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:



27
28
29
30
# File 'lib/mudbase/api/billing_api.rb', line 27

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

#cancel_subscription_with_http_info(subscription_id, opts = {}) ⇒ Array<(DeleteRole200Response, Integer, Hash)>

Cancel subscription

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:

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

    DeleteRole200Response 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
84
85
86
87
88
# File 'lib/mudbase/api/billing_api.rb', line 37

def cancel_subscription_with_http_info(subscription_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.cancel_subscription ...'
  end
  # verify the required parameter 'subscription_id' is set
  if @api_client.config.client_side_validation && subscription_id.nil?
    fail ArgumentError, "Missing the required parameter 'subscription_id' when calling BillingApi.cancel_subscription"
  end
  # resource path
  local_var_path = '/api/billing/subscriptions/{subscriptionId}/cancel'.sub('{' + 'subscriptionId' + '}', CGI.escape(subscription_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/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(opts[:'cancel_subscription_request'])

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ProjectBearerAuth']

  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

#check_feature_access(project_id, email, feature, opts = {}) ⇒ CheckFeatureAccess200Response

Check feature access (public)

Parameters:

  • project_id (String)
  • email (String)

    Customer email

  • feature (String)

    Feature slug to check access for

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

    the optional parameters

Returns:



96
97
98
99
# File 'lib/mudbase/api/billing_api.rb', line 96

def check_feature_access(project_id, email, feature, opts = {})
  data, _status_code, _headers = check_feature_access_with_http_info(project_id, email, feature, opts)
  data
end

#check_feature_access_with_http_info(project_id, email, feature, opts = {}) ⇒ Array<(CheckFeatureAccess200Response, Integer, Hash)>

Check feature access (public)

Parameters:

  • project_id (String)
  • email (String)

    Customer email

  • feature (String)

    Feature slug to check access for

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

    the optional parameters

Returns:



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
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/mudbase/api/billing_api.rb', line 107

def check_feature_access_with_http_info(project_id, email, feature, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.check_feature_access ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling BillingApi.check_feature_access"
  end
  # verify the required parameter 'email' is set
  if @api_client.config.client_side_validation && email.nil?
    fail ArgumentError, "Missing the required parameter 'email' when calling BillingApi.check_feature_access"
  end
  # verify the required parameter 'feature' is set
  if @api_client.config.client_side_validation && feature.nil?
    fail ArgumentError, "Missing the required parameter 'feature' when calling BillingApi.check_feature_access"
  end
  # resource path
  local_var_path = '/api/billing/public/projects/{projectId}/feature-access'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/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] || 'CheckFeatureAccess200Response'

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

  new_options = opts.merge(
    :operation => :"BillingApi.check_feature_access",
    :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#check_feature_access\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#check_subscription(project_id, email, opts = {}) ⇒ CheckSubscription200Response

Check subscription status (public)

Parameters:

  • project_id (String)
  • email (String)

    Customer email to check subscription for

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

    the optional parameters

Returns:



170
171
172
173
# File 'lib/mudbase/api/billing_api.rb', line 170

def check_subscription(project_id, email, opts = {})
  data, _status_code, _headers = check_subscription_with_http_info(project_id, email, opts)
  data
end

#check_subscription_with_http_info(project_id, email, opts = {}) ⇒ Array<(CheckSubscription200Response, Integer, Hash)>

Check subscription status (public)

Parameters:

  • project_id (String)
  • email (String)

    Customer email to check subscription for

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

    the optional parameters

Returns:



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
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/mudbase/api/billing_api.rb', line 180

def check_subscription_with_http_info(project_id, email, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.check_subscription ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling BillingApi.check_subscription"
  end
  # verify the required parameter 'email' is set
  if @api_client.config.client_side_validation && email.nil?
    fail ArgumentError, "Missing the required parameter 'email' when calling BillingApi.check_subscription"
  end
  # resource path
  local_var_path = '/api/billing/public/projects/{projectId}/subscription'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/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] || 'CheckSubscription200Response'

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

  new_options = opts.merge(
    :operation => :"BillingApi.check_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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BillingApi#check_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_checkout_session(project_id, create_checkout_session_request, opts = {}) ⇒ CreateCheckoutSession200Response

Create checkout session (fiat) Customer subscription flow — Step 2. Creates a fiat checkout session. Request body must include planId (from GET public plans), billingCycle (monthly|yearly), and customerInfo.email. Redirect the user to checkoutUrl (same URL as authorizationUrl). After payment, call verify-payment with reference (mudbase_...). Response includes only fiat fields (no paymentAddress, paymentOptions, network, asset, or pmt_ references).

Parameters:

  • project_id (String)

    Project ID

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

    the optional parameters

Returns:



239
240
241
242
# File 'lib/mudbase/api/billing_api.rb', line 239

def create_checkout_session(project_id, create_checkout_session_request, opts = {})
  data, _status_code, _headers = create_checkout_session_with_http_info(project_id, create_checkout_session_request, opts)
  data
end

#create_checkout_session_with_http_info(project_id, create_checkout_session_request, opts = {}) ⇒ Array<(CreateCheckoutSession200Response, Integer, Hash)>

Create checkout session (fiat) Customer subscription flow — Step 2. Creates a fiat checkout session. Request body must include planId (from GET public plans), billingCycle (monthly|yearly), and customerInfo.email. Redirect the user to checkoutUrl (same URL as authorizationUrl). After payment, call verify-payment with reference (mudbase_...). Response includes only fiat fields (no paymentAddress, paymentOptions, network, asset, or pmt_ references).

Parameters:

  • project_id (String)

    Project ID

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

    the optional parameters

Returns:



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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/mudbase/api/billing_api.rb', line 250

def create_checkout_session_with_http_info(project_id, create_checkout_session_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.create_checkout_session ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling BillingApi.create_checkout_session"
  end
  # verify the required parameter 'create_checkout_session_request' is set
  if @api_client.config.client_side_validation && create_checkout_session_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_checkout_session_request' when calling BillingApi.create_checkout_session"
  end
  # resource path
  local_var_path = '/api/billing/public/projects/{projectId}/checkout'.sub('{' + 'projectId' + '}', CGI.escape(project_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/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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_checkout_session_request)

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

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

  new_options = opts.merge(
    :operation => :"BillingApi.create_checkout_session",
    :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_checkout_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_plan(project_id, create_plan_request, opts = {}) ⇒ CreatePlan201Response

Create billing plan

Parameters:

  • project_id (String)
  • create_plan_request (CreatePlanRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



312
313
314
315
# File 'lib/mudbase/api/billing_api.rb', line 312

def create_plan(project_id, create_plan_request, opts = {})
  data, _status_code, _headers = create_plan_with_http_info(project_id, create_plan_request, opts)
  data
end

#create_plan_with_http_info(project_id, create_plan_request, opts = {}) ⇒ Array<(CreatePlan201Response, Integer, Hash)>

Create billing plan

Parameters:

  • project_id (String)
  • create_plan_request (CreatePlanRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    CreatePlan201Response data, response status code and response headers



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
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
# File 'lib/mudbase/api/billing_api.rb', line 322

def create_plan_with_http_info(project_id, create_plan_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.create_plan ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling BillingApi.create_plan"
  end
  # verify the required parameter 'create_plan_request' is set
  if @api_client.config.client_side_validation && create_plan_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_plan_request' when calling BillingApi.create_plan"
  end
  # resource path
  local_var_path = '/api/billing/projects/{projectId}/plans'.sub('{' + 'projectId' + '}', CGI.escape(project_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/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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_plan_request)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ProjectBearerAuth']

  new_options = opts.merge(
    :operation => :"BillingApi.create_plan",
    :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_plan\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_plan(project_id, plan_id, opts = {}) ⇒ MessageResponse

Delete billing plan

Parameters:

  • project_id (String)
  • plan_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



384
385
386
387
# File 'lib/mudbase/api/billing_api.rb', line 384

def delete_plan(project_id, plan_id, opts = {})
  data, _status_code, _headers = delete_plan_with_http_info(project_id, plan_id, opts)
  data
end

#delete_plan_with_http_info(project_id, plan_id, opts = {}) ⇒ Array<(MessageResponse, Integer, Hash)>

Delete billing plan

Parameters:

  • project_id (String)
  • plan_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    MessageResponse data, response status code and response headers



394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
# File 'lib/mudbase/api/billing_api.rb', line 394

def delete_plan_with_http_info(project_id, plan_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.delete_plan ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling BillingApi.delete_plan"
  end
  # verify the required parameter 'plan_id' is set
  if @api_client.config.client_side_validation && plan_id.nil?
    fail ArgumentError, "Missing the required parameter 'plan_id' when calling BillingApi.delete_plan"
  end
  # resource path
  local_var_path = '/api/billing/projects/{projectId}/plans/{planId}'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'planId' + '}', CGI.escape(plan_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/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] || 'MessageResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ProjectBearerAuth']

  new_options = opts.merge(
    :operation => :"BillingApi.delete_plan",
    :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_plan\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#download_invoice(project_id, invoice_id, opts = {}) ⇒ File

Download invoice PDF

Parameters:

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

    the optional parameters

Returns:

  • (File)


451
452
453
454
# File 'lib/mudbase/api/billing_api.rb', line 451

def download_invoice(project_id, invoice_id, opts = {})
  data, _status_code, _headers = download_invoice_with_http_info(project_id, invoice_id, opts)
  data
end

#download_invoice_with_http_info(project_id, invoice_id, opts = {}) ⇒ Array<(File, Integer, Hash)>

Download invoice PDF

Parameters:

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

    the optional parameters

Returns:

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

    File data, response status code and response headers



461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
# File 'lib/mudbase/api/billing_api.rb', line 461

def download_invoice_with_http_info(project_id, invoice_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.download_invoice ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling BillingApi.download_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.download_invoice"
  end
  # resource path
  local_var_path = '/api/billing/projects/{projectId}/invoices/{invoiceId}/download'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'invoiceId' + '}', 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/pdf', 'application/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] || 'File'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ProjectBearerAuth']

  new_options = opts.merge(
    :operation => :"BillingApi.download_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#download_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#enable_payment_processing(org_id, enable_payment_processing_request, opts = {}) ⇒ EnablePaymentProcessing200Response

Enable payment processing for organization Creates a payment-collection subaccount for the org with the provided bank details. Use USD-capable bank (e.g. country US) for USD settlement. BVN only required when country is NG. Requires owner or admin role.

Parameters:

Returns:



519
520
521
522
# File 'lib/mudbase/api/billing_api.rb', line 519

def enable_payment_processing(org_id, enable_payment_processing_request, opts = {})
  data, _status_code, _headers = enable_payment_processing_with_http_info(org_id, enable_payment_processing_request, opts)
  data
end

#enable_payment_processing_with_http_info(org_id, enable_payment_processing_request, opts = {}) ⇒ Array<(EnablePaymentProcessing200Response, Integer, Hash)>

Enable payment processing for organization Creates a payment-collection subaccount for the org with the provided bank details. Use USD-capable bank (e.g. country US) for USD settlement. BVN only required when country is NG. Requires owner or admin role.

Parameters:

Returns:



530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
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
# File 'lib/mudbase/api/billing_api.rb', line 530

def enable_payment_processing_with_http_info(org_id, enable_payment_processing_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.enable_payment_processing ...'
  end
  # verify the required parameter 'org_id' is set
  if @api_client.config.client_side_validation && org_id.nil?
    fail ArgumentError, "Missing the required parameter 'org_id' when calling BillingApi.enable_payment_processing"
  end
  # verify the required parameter 'enable_payment_processing_request' is set
  if @api_client.config.client_side_validation && enable_payment_processing_request.nil?
    fail ArgumentError, "Missing the required parameter 'enable_payment_processing_request' when calling BillingApi.enable_payment_processing"
  end
  # resource path
  local_var_path = '/api/orgs/{orgId}/payment-processing/enable'.sub('{' + 'orgId' + '}', CGI.escape(org_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/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(enable_payment_processing_request)

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

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

  new_options = opts.merge(
    :operation => :"BillingApi.enable_payment_processing",
    :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#enable_payment_processing\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#export_invoice(project_id, invoice_id, opts = {}) ⇒ DownloadInvoice200Response

Export invoice (e.g. PDF URL or file)

Parameters:

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

    the optional parameters

Returns:



592
593
594
595
# File 'lib/mudbase/api/billing_api.rb', line 592

def export_invoice(project_id, invoice_id, opts = {})
  data, _status_code, _headers = export_invoice_with_http_info(project_id, invoice_id, opts)
  data
end

#export_invoice_with_http_info(project_id, invoice_id, opts = {}) ⇒ Array<(DownloadInvoice200Response, Integer, Hash)>

Export invoice (e.g. PDF URL or file)

Parameters:

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

    the optional parameters

Returns:

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

    DownloadInvoice200Response data, response status code and response headers



602
603
604
605
606
607
608
609
610
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
# File 'lib/mudbase/api/billing_api.rb', line 602

def export_invoice_with_http_info(project_id, invoice_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.export_invoice ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling BillingApi.export_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.export_invoice"
  end
  # resource path
  local_var_path = '/api/billing/projects/{projectId}/invoices/{invoiceId}/export'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'invoiceId' + '}', 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/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] || 'DownloadInvoice200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ProjectBearerAuth']

  new_options = opts.merge(
    :operation => :"BillingApi.export_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#export_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_billing_estimate(opts = {}) ⇒ GetBillingEstimate200Response

Get billing estimate and forecast Returns current-month overage estimate and an optional end-of-month forecast for the authenticated organization. Includes spend limit settings (soft/hard) and whether usage is currently blocked. Requires org-level JWT.

Parameters:

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

    the optional parameters

Returns:



658
659
660
661
# File 'lib/mudbase/api/billing_api.rb', line 658

def get_billing_estimate(opts = {})
  data, _status_code, _headers = get_billing_estimate_with_http_info(opts)
  data
end

#get_billing_estimate_with_http_info(opts = {}) ⇒ Array<(GetBillingEstimate200Response, Integer, Hash)>

Get billing estimate and forecast Returns current-month overage estimate and an optional end-of-month forecast for the authenticated organization. Includes spend limit settings (soft/hard) and whether usage is currently blocked. Requires org-level JWT.

Parameters:

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

    the optional parameters

Returns:



667
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
# File 'lib/mudbase/api/billing_api.rb', line 667

def get_billing_estimate_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.get_billing_estimate ...'
  end
  # resource path
  local_var_path = '/api/billing/estimate'

  # 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/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] || 'GetBillingEstimate200Response'

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

  new_options = opts.merge(
    :operation => :"BillingApi.get_billing_estimate",
    :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_billing_estimate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_checkout_payment(project_id, payment_id, opts = {}) ⇒ nil

Get checkout payment details (not used for fiat billing) Fiat-only billing: checkout is completed on the payment gateway's hosted page; there is no server-side payment intent to poll. The live API returns 404 for this route. Reserved for compatibility; do not rely on a success body for project billing.

Parameters:

  • project_id (String)
  • payment_id (String)

    Opaque id from checkout (fiat billing does not expose pollable payment state here)

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

    the optional parameters

Returns:

  • (nil)


717
718
719
720
# File 'lib/mudbase/api/billing_api.rb', line 717

def get_checkout_payment(project_id, payment_id, opts = {})
  get_checkout_payment_with_http_info(project_id, payment_id, opts)
  nil
end

#get_checkout_payment_with_http_info(project_id, payment_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Get checkout payment details (not used for fiat billing) Fiat-only billing: checkout is completed on the payment gateway's hosted page; there is no server-side payment intent to poll. The live API returns 404 for this route. Reserved for compatibility; do not rely on a success body for project billing.

Parameters:

  • project_id (String)
  • payment_id (String)

    Opaque id from checkout (fiat billing does not expose pollable payment state here)

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
774
775
776
777
778
# File 'lib/mudbase/api/billing_api.rb', line 728

def get_checkout_payment_with_http_info(project_id, payment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.get_checkout_payment ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling BillingApi.get_checkout_payment"
  end
  # verify the required parameter 'payment_id' is set
  if @api_client.config.client_side_validation && payment_id.nil?
    fail ArgumentError, "Missing the required parameter 'payment_id' when calling BillingApi.get_checkout_payment"
  end
  # resource path
  local_var_path = '/api/billing/public/projects/{projectId}/checkout/{paymentId}'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'paymentId' + '}', CGI.escape(payment_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/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] || []

  new_options = opts.merge(
    :operation => :"BillingApi.get_checkout_payment",
    :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_checkout_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_dashboard(project_id, opts = {}) ⇒ GetDashboard200Response

Get billing dashboard data

Parameters:

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

    the optional parameters

Returns:



784
785
786
787
# File 'lib/mudbase/api/billing_api.rb', line 784

def get_dashboard(project_id, opts = {})
  data, _status_code, _headers = get_dashboard_with_http_info(project_id, opts)
  data
end

#get_dashboard_with_http_info(project_id, opts = {}) ⇒ Array<(GetDashboard200Response, Integer, Hash)>

Get billing dashboard data

Parameters:

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

    the optional parameters

Returns:

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

    GetDashboard200Response data, response status code and response headers



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
837
838
839
# File 'lib/mudbase/api/billing_api.rb', line 793

def get_dashboard_with_http_info(project_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.get_dashboard ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling BillingApi.get_dashboard"
  end
  # resource path
  local_var_path = '/api/billing/projects/{projectId}/dashboard'.sub('{' + 'projectId' + '}', CGI.escape(project_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/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] || 'GetDashboard200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ProjectBearerAuth']

  new_options = opts.merge(
    :operation => :"BillingApi.get_dashboard",
    :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_dashboard\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_fee_breakdown(org_id, amount, opts = {}) ⇒ GetFeeBreakdown200Response

Get fee breakdown for a given amount Returns orgReceives, platformPercent, platformFixed, processingFee for the given amount (7% + $0.50 platform fee; processing fee absorbed from platform share).

Parameters:

  • org_id (String)
  • amount (Float)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :currency (String) — default: default to 'USD'

Returns:



848
849
850
851
# File 'lib/mudbase/api/billing_api.rb', line 848

def get_fee_breakdown(org_id, amount, opts = {})
  data, _status_code, _headers = get_fee_breakdown_with_http_info(org_id, amount, opts)
  data
end

#get_fee_breakdown_with_http_info(org_id, amount, opts = {}) ⇒ Array<(GetFeeBreakdown200Response, Integer, Hash)>

Get fee breakdown for a given amount Returns orgReceives, platformPercent, platformFixed, processingFee for the given amount (7% + $0.50 platform fee; processing fee absorbed from platform share).

Parameters:

  • org_id (String)
  • amount (Float)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :currency (String) — default: default to 'USD'

Returns:

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

    GetFeeBreakdown200Response data, response status code and response headers



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
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
# File 'lib/mudbase/api/billing_api.rb', line 860

def get_fee_breakdown_with_http_info(org_id, amount, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.get_fee_breakdown ...'
  end
  # verify the required parameter 'org_id' is set
  if @api_client.config.client_side_validation && org_id.nil?
    fail ArgumentError, "Missing the required parameter 'org_id' when calling BillingApi.get_fee_breakdown"
  end
  # verify the required parameter 'amount' is set
  if @api_client.config.client_side_validation && amount.nil?
    fail ArgumentError, "Missing the required parameter 'amount' when calling BillingApi.get_fee_breakdown"
  end
  if @api_client.config.client_side_validation && amount < 0.01
    fail ArgumentError, 'invalid value for "amount" when calling BillingApi.get_fee_breakdown, must be greater than or equal to 0.01.'
  end

  # resource path
  local_var_path = '/api/orgs/{orgId}/payment-processing/fee-breakdown'.sub('{' + 'orgId' + '}', CGI.escape(org_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'amount'] = amount
  query_params[:'currency'] = opts[:'currency'] if !opts[:'currency'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/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] || 'GetFeeBreakdown200Response'

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

  new_options = opts.merge(
    :operation => :"BillingApi.get_fee_breakdown",
    :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_fee_breakdown\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_invoice(project_id, invoice_id, opts = {}) ⇒ GetInvoice200Response

Get single invoice

Parameters:

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

    the optional parameters

Returns:



923
924
925
926
# File 'lib/mudbase/api/billing_api.rb', line 923

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

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

Get single invoice

Parameters:

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

    the optional parameters

Returns:

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

    GetInvoice200Response data, response status code and response headers



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
974
975
976
977
978
979
980
981
982
983
# File 'lib/mudbase/api/billing_api.rb', line 933

def get_invoice_with_http_info(project_id, invoice_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.get_invoice ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling 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/billing/projects/{projectId}/invoices/{invoiceId}'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'invoiceId' + '}', 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/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] || 'GetInvoice200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ProjectBearerAuth']

  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_invoices(project_id, opts = {}) ⇒ GetInvoices200Response

List project invoices

Parameters:

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

    the optional parameters

Returns:



989
990
991
992
# File 'lib/mudbase/api/billing_api.rb', line 989

def get_invoices(project_id, opts = {})
  data, _status_code, _headers = get_invoices_with_http_info(project_id, opts)
  data
end

#get_invoices_with_http_info(project_id, opts = {}) ⇒ Array<(GetInvoices200Response, Integer, Hash)>

List project invoices

Parameters:

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

    the optional parameters

Returns:

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

    GetInvoices200Response data, response status code and response headers



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
# File 'lib/mudbase/api/billing_api.rb', line 998

def get_invoices_with_http_info(project_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.get_invoices ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling BillingApi.get_invoices"
  end
  # resource path
  local_var_path = '/api/billing/projects/{projectId}/invoices'.sub('{' + 'projectId' + '}', CGI.escape(project_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/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] || 'GetInvoices200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ProjectBearerAuth']

  new_options = opts.merge(
    :operation => :"BillingApi.get_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#get_invoices\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_payment_records(org_id, opts = {}) ⇒ GetPaymentRecords200Response

List fiat payment records for organization Paginated list of FiatPaymentRecord for this org (txRef, amount, orgReceives, status, paidAt).

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page (Integer) — default: default to 1
  • :limit (Integer) — default: default to 20
  • :status (String)

Returns:



1054
1055
1056
1057
# File 'lib/mudbase/api/billing_api.rb', line 1054

def get_payment_records(org_id, opts = {})
  data, _status_code, _headers = get_payment_records_with_http_info(org_id, opts)
  data
end

#get_payment_records_with_http_info(org_id, opts = {}) ⇒ Array<(GetPaymentRecords200Response, Integer, Hash)>

List fiat payment records for organization Paginated list of FiatPaymentRecord for this org (txRef, amount, orgReceives, status, paidAt).

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page (Integer) — default: default to 1
  • :limit (Integer) — default: default to 20
  • :status (String)

Returns:



1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
# File 'lib/mudbase/api/billing_api.rb', line 1067

def get_payment_records_with_http_info(org_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.get_payment_records ...'
  end
  # verify the required parameter 'org_id' is set
  if @api_client.config.client_side_validation && org_id.nil?
    fail ArgumentError, "Missing the required parameter 'org_id' when calling BillingApi.get_payment_records"
  end
  allowable_values = ["pending", "successful", "failed"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/orgs/{orgId}/payment-processing/records'.sub('{' + 'orgId' + '}', CGI.escape(org_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/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] || 'GetPaymentRecords200Response'

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

  new_options = opts.merge(
    :operation => :"BillingApi.get_payment_records",
    :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_records\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_plans(project_id, opts = {}) ⇒ GetPlans200Response

Get billing plans

Parameters:

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

    the optional parameters

Returns:



1126
1127
1128
1129
# File 'lib/mudbase/api/billing_api.rb', line 1126

def get_plans(project_id, opts = {})
  data, _status_code, _headers = get_plans_with_http_info(project_id, opts)
  data
end

#get_plans_with_http_info(project_id, opts = {}) ⇒ Array<(GetPlans200Response, Integer, Hash)>

Get billing plans

Parameters:

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

    the optional parameters

Returns:

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

    GetPlans200Response data, response status code and response headers



1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
# File 'lib/mudbase/api/billing_api.rb', line 1135

def get_plans_with_http_info(project_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.get_plans ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling BillingApi.get_plans"
  end
  # resource path
  local_var_path = '/api/billing/projects/{projectId}/plans'.sub('{' + 'projectId' + '}', CGI.escape(project_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/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] || 'GetPlans200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ProjectBearerAuth']

  new_options = opts.merge(
    :operation => :"BillingApi.get_plans",
    :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_plans\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_public_plans(project_id, opts = {}) ⇒ GetPublicPlans200Response

Get public plans (no auth required) Customer subscription flow — Step 1. Returns all active plans for the project. Use a plan's _id as planId in the checkout request. No authentication required (for pricing/checkout pages).

Parameters:

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

    the optional parameters

Returns:



1188
1189
1190
1191
# File 'lib/mudbase/api/billing_api.rb', line 1188

def get_public_plans(project_id, opts = {})
  data, _status_code, _headers = get_public_plans_with_http_info(project_id, opts)
  data
end

#get_public_plans_with_http_info(project_id, opts = {}) ⇒ Array<(GetPublicPlans200Response, Integer, Hash)>

Get public plans (no auth required) Customer subscription flow — Step 1. Returns all active plans for the project. Use a plan's _id as planId in the checkout request. No authentication required (for pricing/checkout pages).

Parameters:

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

    the optional parameters

Returns:

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

    GetPublicPlans200Response data, response status code and response headers



1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
# File 'lib/mudbase/api/billing_api.rb', line 1198

def get_public_plans_with_http_info(project_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.get_public_plans ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling BillingApi.get_public_plans"
  end
  # resource path
  local_var_path = '/api/billing/public/projects/{projectId}/plans'.sub('{' + 'projectId' + '}', CGI.escape(project_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/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] || 'GetPublicPlans200Response'

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

  new_options = opts.merge(
    :operation => :"BillingApi.get_public_plans",
    :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_public_plans\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_subscription_tier_by_id(plan_id, opts = {}) ⇒ GetSubscriptionTierById200Response

Get one subscription tier by id Returns a single org-level BaaS plan (free, starter, growth, scale, enterprise). Public; no auth required.

Parameters:

  • plan_id (String)

    Plan id (free, starter, growth, scale, enterprise)

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

    the optional parameters

Returns:



1251
1252
1253
1254
# File 'lib/mudbase/api/billing_api.rb', line 1251

def get_subscription_tier_by_id(plan_id, opts = {})
  data, _status_code, _headers = get_subscription_tier_by_id_with_http_info(plan_id, opts)
  data
end

#get_subscription_tier_by_id_with_http_info(plan_id, opts = {}) ⇒ Array<(GetSubscriptionTierById200Response, Integer, Hash)>

Get one subscription tier by id Returns a single org-level BaaS plan (free, starter, growth, scale, enterprise). Public; no auth required.

Parameters:

  • plan_id (String)

    Plan id (free, starter, growth, scale, enterprise)

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

    the optional parameters

Returns:



1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
# File 'lib/mudbase/api/billing_api.rb', line 1261

def get_subscription_tier_by_id_with_http_info(plan_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.get_subscription_tier_by_id ...'
  end
  # verify the required parameter 'plan_id' is set
  if @api_client.config.client_side_validation && plan_id.nil?
    fail ArgumentError, "Missing the required parameter 'plan_id' when calling BillingApi.get_subscription_tier_by_id"
  end
  # resource path
  local_var_path = '/api/billing/plans/{planId}'.sub('{' + 'planId' + '}', CGI.escape(plan_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/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] || 'GetSubscriptionTierById200Response'

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

  new_options = opts.merge(
    :operation => :"BillingApi.get_subscription_tier_by_id",
    :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_subscription_tier_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_subscription_tiers(opts = {}) ⇒ GetSubscriptionTiers200Response

Get subscription tiers (org-level BaaS plans) Org-level BaaS plan catalog (source of truth in paymentService.js). Returns Free, Starter ($29), Growth ($69), Scale ($199), Enterprise. Use for pricing page and to get plan ids for POST /api/billing/org/checkout. Public; no auth required. Each plan includes id (free|starter|growth|scale|enterprise), name, description, price (cents), priceYearly (cents, 8% off), currency, limits, overages, enforcement.

Parameters:

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

    the optional parameters

Returns:



1313
1314
1315
1316
# File 'lib/mudbase/api/billing_api.rb', line 1313

def get_subscription_tiers(opts = {})
  data, _status_code, _headers = get_subscription_tiers_with_http_info(opts)
  data
end

#get_subscription_tiers_with_http_info(opts = {}) ⇒ Array<(GetSubscriptionTiers200Response, Integer, Hash)>

Get subscription tiers (org-level BaaS plans) Org-level BaaS plan catalog (source of truth in paymentService.js). Returns Free, Starter ($29), Growth ($69), Scale ($199), Enterprise. Use for pricing page and to get plan ids for POST /api/billing/org/checkout. Public; no auth required. Each plan includes id (free|starter|growth|scale|enterprise), name, description, price (cents), priceYearly (cents, 8% off), currency, limits, overages, enforcement.

Parameters:

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

    the optional parameters

Returns:



1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
# File 'lib/mudbase/api/billing_api.rb', line 1322

def get_subscription_tiers_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.get_subscription_tiers ...'
  end
  # resource path
  local_var_path = '/api/billing/plans'

  # 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/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] || 'GetSubscriptionTiers200Response'

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

  new_options = opts.merge(
    :operation => :"BillingApi.get_subscription_tiers",
    :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_subscription_tiers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_subscriptions(project_id, opts = {}) ⇒ GetSubscriptions200Response

Get subscriptions

Parameters:

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

    the optional parameters

Returns:



1370
1371
1372
1373
# File 'lib/mudbase/api/billing_api.rb', line 1370

def get_subscriptions(project_id, opts = {})
  data, _status_code, _headers = get_subscriptions_with_http_info(project_id, opts)
  data
end

#get_subscriptions_with_http_info(project_id, opts = {}) ⇒ Array<(GetSubscriptions200Response, Integer, Hash)>

Get subscriptions

Parameters:

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

    the optional parameters

Returns:

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

    GetSubscriptions200Response data, response status code and response headers



1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
# File 'lib/mudbase/api/billing_api.rb', line 1379

def get_subscriptions_with_http_info(project_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.get_subscriptions ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling BillingApi.get_subscriptions"
  end
  # resource path
  local_var_path = '/api/billing/projects/{projectId}/subscriptions'.sub('{' + 'projectId' + '}', CGI.escape(project_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/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] || 'GetSubscriptions200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ProjectBearerAuth']

  new_options = opts.merge(
    :operation => :"BillingApi.get_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#get_subscriptions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#handle_flutterwave_webhook(handle_flutterwave_webhook_request, opts = {}) ⇒ HandleFlutterwaveWebhook200Response

Payment gateway webhook Receives payment gateway webhook events (charge.completed, payment.successful). No auth; verified by verif-hash header. - Subscription billing: meta without isPaymentProcessing triggers verifyPaymentAndCreateSubscription (mudbase_xxx refs). - Payment processing: meta.isPaymentProcessing === true triggers fiat payment record (mudbase_fiat_xxx refs); org share goes to org subaccount, platform fee to main or configured subaccounts.

Parameters:

Returns:



1432
1433
1434
1435
# File 'lib/mudbase/api/billing_api.rb', line 1432

def handle_flutterwave_webhook(handle_flutterwave_webhook_request, opts = {})
  data, _status_code, _headers = handle_flutterwave_webhook_with_http_info(handle_flutterwave_webhook_request, opts)
  data
end

#handle_flutterwave_webhook_with_http_info(handle_flutterwave_webhook_request, opts = {}) ⇒ Array<(HandleFlutterwaveWebhook200Response, Integer, Hash)>

Payment gateway webhook Receives payment gateway webhook events (charge.completed, payment.successful). No auth; verified by verif-hash header. - Subscription billing: meta without isPaymentProcessing triggers verifyPaymentAndCreateSubscription (mudbase_xxx refs). - Payment processing: meta.isPaymentProcessing === true triggers fiat payment record (mudbase_fiat_xxx refs); org share goes to org subaccount, platform fee to main or configured subaccounts.

Parameters:

Returns:



1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
# File 'lib/mudbase/api/billing_api.rb', line 1442

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

  # 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/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(handle_flutterwave_webhook_request)

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

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

  new_options = opts.merge(
    :operation => :"BillingApi.handle_flutterwave_webhook",
    :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#handle_flutterwave_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#initialize_org_plan_checkout(initialize_org_plan_checkout_request, opts = {}) ⇒ InitializeOrgPlanCheckout200Response

Initialize org-level BaaS plan payment (Starter, Growth, Scale) Org plan payment flow — Step 2. Creates a payment link for the authenticated org to subscribe to a BaaS plan (starter, growth, scale). Enterprise has no price; use contact-sales flow. Redirect the user to the returned link; after payment, call POST /api/billing/org/verify-payment with the tx_ref from the redirect. Requires org-level JWT.

Parameters:

Returns:



1500
1501
1502
1503
# File 'lib/mudbase/api/billing_api.rb', line 1500

def initialize_org_plan_checkout(initialize_org_plan_checkout_request, opts = {})
  data, _status_code, _headers = initialize_org_plan_checkout_with_http_info(initialize_org_plan_checkout_request, opts)
  data
end

#initialize_org_plan_checkout_with_http_info(initialize_org_plan_checkout_request, opts = {}) ⇒ Array<(InitializeOrgPlanCheckout200Response, Integer, Hash)>

Initialize org-level BaaS plan payment (Starter, Growth, Scale) Org plan payment flow — Step 2. Creates a payment link for the authenticated org to subscribe to a BaaS plan (starter, growth, scale). Enterprise has no price; use contact-sales flow. Redirect the user to the returned link; after payment, call POST /api/billing/org/verify-payment with the tx_ref from the redirect. Requires org-level JWT.

Parameters:

Returns:



1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
# File 'lib/mudbase/api/billing_api.rb', line 1510

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

  # 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/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(initialize_org_plan_checkout_request)

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

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

  new_options = opts.merge(
    :operation => :"BillingApi.initialize_org_plan_checkout",
    :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#initialize_org_plan_checkout\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#initialize_payment(org_id, initialize_payment_request, opts = {}) ⇒ InitializePayment200Response

Initialize fiat payment with split (org subaccount + platform fee) Creates a payment link. Customer pays; org receives (amount - 7% - $0.50) to their subaccount; platform fee (7% + $0.50, minus processing fee) stays on main account or goes to configured platform subaccounts. Requires payment processing enabled for org.

Parameters:

  • org_id (String)
  • initialize_payment_request (InitializePaymentRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1569
1570
1571
1572
# File 'lib/mudbase/api/billing_api.rb', line 1569

def initialize_payment(org_id, initialize_payment_request, opts = {})
  data, _status_code, _headers = initialize_payment_with_http_info(org_id, initialize_payment_request, opts)
  data
end

#initialize_payment_for_project(project_id, initialize_payment_for_project_request, opts = {}) ⇒ nil

Initialize fiat payment (project-scoped) Same as org-level initialize-payment; projectId from path is used for scope and tx_ref. Resolves project to org and uses org's payment-processing subaccount.

Parameters:

Returns:

  • (nil)


1643
1644
1645
1646
# File 'lib/mudbase/api/billing_api.rb', line 1643

def initialize_payment_for_project(project_id, initialize_payment_for_project_request, opts = {})
  initialize_payment_for_project_with_http_info(project_id, initialize_payment_for_project_request, opts)
  nil
end

#initialize_payment_for_project_with_http_info(project_id, initialize_payment_for_project_request, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Initialize fiat payment (project-scoped) Same as org-level initialize-payment; projectId from path is used for scope and tx_ref. Resolves project to org and uses org's payment-processing subaccount.

Parameters:

Returns:

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

    nil, response status code and response headers



1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
# File 'lib/mudbase/api/billing_api.rb', line 1654

def initialize_payment_for_project_with_http_info(project_id, initialize_payment_for_project_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.initialize_payment_for_project ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling BillingApi.initialize_payment_for_project"
  end
  # verify the required parameter 'initialize_payment_for_project_request' is set
  if @api_client.config.client_side_validation && initialize_payment_for_project_request.nil?
    fail ArgumentError, "Missing the required parameter 'initialize_payment_for_project_request' when calling BillingApi.initialize_payment_for_project"
  end
  # resource path
  local_var_path = '/api/projects/{projectId}/payment-processing/initialize-payment'.sub('{' + 'projectId' + '}', CGI.escape(project_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/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(initialize_payment_for_project_request)

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ProjectBearerAuth']

  new_options = opts.merge(
    :operation => :"BillingApi.initialize_payment_for_project",
    :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#initialize_payment_for_project\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#initialize_payment_with_http_info(org_id, initialize_payment_request, opts = {}) ⇒ Array<(InitializePayment200Response, Integer, Hash)>

Initialize fiat payment with split (org subaccount + platform fee) Creates a payment link. Customer pays; org receives (amount - 7% - $0.50) to their subaccount; platform fee (7% + $0.50, minus processing fee) stays on main account or goes to configured platform subaccounts. Requires payment processing enabled for org.

Parameters:

  • org_id (String)
  • initialize_payment_request (InitializePaymentRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
# File 'lib/mudbase/api/billing_api.rb', line 1580

def initialize_payment_with_http_info(org_id, initialize_payment_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.initialize_payment ...'
  end
  # verify the required parameter 'org_id' is set
  if @api_client.config.client_side_validation && org_id.nil?
    fail ArgumentError, "Missing the required parameter 'org_id' when calling BillingApi.initialize_payment"
  end
  # verify the required parameter 'initialize_payment_request' is set
  if @api_client.config.client_side_validation && initialize_payment_request.nil?
    fail ArgumentError, "Missing the required parameter 'initialize_payment_request' when calling BillingApi.initialize_payment"
  end
  # resource path
  local_var_path = '/api/orgs/{orgId}/payment-processing/initialize-payment'.sub('{' + 'orgId' + '}', CGI.escape(org_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/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(initialize_payment_request)

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

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

  new_options = opts.merge(
    :operation => :"BillingApi.initialize_payment",
    :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#initialize_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#record_usage(project_id, record_usage_request, opts = {}) ⇒ MessageResponse

Record usage (public)

Parameters:

  • project_id (String)
  • record_usage_request (RecordUsageRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1716
1717
1718
1719
# File 'lib/mudbase/api/billing_api.rb', line 1716

def record_usage(project_id, record_usage_request, opts = {})
  data, _status_code, _headers = record_usage_with_http_info(project_id, record_usage_request, opts)
  data
end

#record_usage_with_http_info(project_id, record_usage_request, opts = {}) ⇒ Array<(MessageResponse, Integer, Hash)>

Record usage (public)

Parameters:

  • project_id (String)
  • record_usage_request (RecordUsageRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    MessageResponse data, response status code and response headers



1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
# File 'lib/mudbase/api/billing_api.rb', line 1726

def record_usage_with_http_info(project_id, record_usage_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.record_usage ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling BillingApi.record_usage"
  end
  # verify the required parameter 'record_usage_request' is set
  if @api_client.config.client_side_validation && record_usage_request.nil?
    fail ArgumentError, "Missing the required parameter 'record_usage_request' when calling BillingApi.record_usage"
  end
  # resource path
  local_var_path = '/api/billing/public/projects/{projectId}/usage'.sub('{' + 'projectId' + '}', CGI.escape(project_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/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(record_usage_request)

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

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

  new_options = opts.merge(
    :operation => :"BillingApi.record_usage",
    :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#record_usage\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_plan(project_id, plan_id, update_plan_request, opts = {}) ⇒ CreatePlan201Response

Update billing plan

Parameters:

  • project_id (String)
  • plan_id (String)
  • update_plan_request (UpdatePlanRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1789
1790
1791
1792
# File 'lib/mudbase/api/billing_api.rb', line 1789

def update_plan(project_id, plan_id, update_plan_request, opts = {})
  data, _status_code, _headers = update_plan_with_http_info(project_id, plan_id, update_plan_request, opts)
  data
end

#update_plan_with_http_info(project_id, plan_id, update_plan_request, opts = {}) ⇒ Array<(CreatePlan201Response, Integer, Hash)>

Update billing plan

Parameters:

  • project_id (String)
  • plan_id (String)
  • update_plan_request (UpdatePlanRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    CreatePlan201Response data, response status code and response headers



1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
# File 'lib/mudbase/api/billing_api.rb', line 1800

def update_plan_with_http_info(project_id, plan_id, update_plan_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.update_plan ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling BillingApi.update_plan"
  end
  # verify the required parameter 'plan_id' is set
  if @api_client.config.client_side_validation && plan_id.nil?
    fail ArgumentError, "Missing the required parameter 'plan_id' when calling BillingApi.update_plan"
  end
  # verify the required parameter 'update_plan_request' is set
  if @api_client.config.client_side_validation && update_plan_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_plan_request' when calling BillingApi.update_plan"
  end
  # resource path
  local_var_path = '/api/billing/projects/{projectId}/plans/{planId}'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'planId' + '}', CGI.escape(plan_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/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/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(update_plan_request)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ProjectBearerAuth']

  new_options = opts.merge(
    :operation => :"BillingApi.update_plan",
    :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(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BillingApi#update_plan\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#verify_org_plan_payment(opts = {}) ⇒ VerifyOrgPlanPayment200Response

Verify org-level plan payment Org plan payment flow — Step 3. Call after the user completes payment (redirect or webhook). Pass tx_ref (or reference) from the payment redirect. Updates org plan and billing; idempotent. No auth required (redirect callback can call this).

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :tx_ref (String)

    Payment reference (mudbase_org_...) from checkout redirect

  • :reference (String)

    Alias for tx_ref

Returns:



1867
1868
1869
1870
# File 'lib/mudbase/api/billing_api.rb', line 1867

def verify_org_plan_payment(opts = {})
  data, _status_code, _headers = verify_org_plan_payment_with_http_info(opts)
  data
end

#verify_org_plan_payment_with_http_info(opts = {}) ⇒ Array<(VerifyOrgPlanPayment200Response, Integer, Hash)>

Verify org-level plan payment Org plan payment flow — Step 3. Call after the user completes payment (redirect or webhook). Pass tx_ref (or reference) from the payment redirect. Updates org plan and billing; idempotent. No auth required (redirect callback can call this).

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :tx_ref (String)

    Payment reference (mudbase_org_...) from checkout redirect

  • :reference (String)

    Alias for tx_ref

Returns:



1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
# File 'lib/mudbase/api/billing_api.rb', line 1878

def verify_org_plan_payment_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.verify_org_plan_payment ...'
  end
  # resource path
  local_var_path = '/api/billing/org/verify-payment'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'tx_ref'] = opts[:'tx_ref'] if !opts[:'tx_ref'].nil?
  query_params[:'reference'] = opts[:'reference'] if !opts[:'reference'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/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] || 'VerifyOrgPlanPayment200Response'

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

  new_options = opts.merge(
    :operation => :"BillingApi.verify_org_plan_payment",
    :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#verify_org_plan_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#verify_payment(project_id, reference, opts = {}) ⇒ VerifyPayment200Response

Verify payment and create subscription Customer subscription flow — Step 3. Call after the user completes payment. Pass reference as query (?reference=mudbase_...). On success, a subscription is created. No auth required when using the platform gateway (mudbase_ refs). Org-level gateway verification may require JWT. References starting with pmt_ are rejected (crypto billing is not enabled on this API).

Parameters:

  • project_id (String)
  • reference (String)

    Payment transaction reference (mudbase_...)

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

    the optional parameters

Returns:



1930
1931
1932
1933
# File 'lib/mudbase/api/billing_api.rb', line 1930

def verify_payment(project_id, reference, opts = {})
  data, _status_code, _headers = verify_payment_with_http_info(project_id, reference, opts)
  data
end

#verify_payment_with_http_info(project_id, reference, opts = {}) ⇒ Array<(VerifyPayment200Response, Integer, Hash)>

Verify payment and create subscription Customer subscription flow — Step 3. Call after the user completes payment. Pass reference as query (?reference=mudbase_...). On success, a subscription is created. No auth required when using the platform gateway (mudbase_ refs). Org-level gateway verification may require JWT. References starting with pmt_ are rejected (crypto billing is not enabled on this API).

Parameters:

  • project_id (String)
  • reference (String)

    Payment transaction reference (mudbase_...)

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

    the optional parameters

Returns:

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

    VerifyPayment200Response data, response status code and response headers



1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
# File 'lib/mudbase/api/billing_api.rb', line 1941

def verify_payment_with_http_info(project_id, reference, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BillingApi.verify_payment ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling BillingApi.verify_payment"
  end
  # verify the required parameter 'reference' is set
  if @api_client.config.client_side_validation && reference.nil?
    fail ArgumentError, "Missing the required parameter 'reference' when calling BillingApi.verify_payment"
  end
  # resource path
  local_var_path = '/api/billing/public/projects/{projectId}/verify-payment'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/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] || 'VerifyPayment200Response'

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

  new_options = opts.merge(
    :operation => :"BillingApi.verify_payment",
    :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#verify_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end