diff --git a/enterprise/app/controllers/enterprise/api/v1/accounts/concerns/billing_v2.rb b/enterprise/app/controllers/enterprise/api/v1/accounts/concerns/billing_v2.rb index 1d38466d2..01d899279 100644 --- a/enterprise/app/controllers/enterprise/api/v1/accounts/concerns/billing_v2.rb +++ b/enterprise/app/controllers/enterprise/api/v1/accounts/concerns/billing_v2.rb @@ -53,7 +53,7 @@ module Enterprise::Api::V1::Accounts::Concerns::BillingV2 ) if result[:success] - render json: { success: true, redirect_url: result[:redirect_url], checkout_session_id: result[:checkout_session_id] } + render json: { success: true, redirect_url: result[:redirect_url], session_id: result[:session_id] } else render json: { error: result[:message] }, status: :unprocessable_entity end diff --git a/enterprise/app/services/enterprise/billing/v2/base_service.rb b/enterprise/app/services/enterprise/billing/v2/base_service.rb index 92da4f306..507ffd6bd 100644 --- a/enterprise/app/services/enterprise/billing/v2/base_service.rb +++ b/enterprise/app/services/enterprise/billing/v2/base_service.rb @@ -50,10 +50,4 @@ class Enterprise::Billing::V2::BaseService def with_locked_account(&) account.with_lock(&) end - - def with_stripe_error_handling - yield - rescue Stripe::StripeError => e - { success: false, message: e.message } - end end diff --git a/enterprise/app/services/enterprise/billing/v2/credit_management_service.rb b/enterprise/app/services/enterprise/billing/v2/credit_management_service.rb index 77f7a93cf..e21c0ce66 100644 --- a/enterprise/app/services/enterprise/billing/v2/credit_management_service.rb +++ b/enterprise/app/services/enterprise/billing/v2/credit_management_service.rb @@ -32,8 +32,7 @@ class Enterprise::Billing::V2::CreditManagementService < Enterprise::Billing::V2 return [] if customer_id.blank? response = Stripe::Billing::CreditGrant.list( - { customer: customer_id, limit: 100 }, - stripe_api_options + { customer: customer_id, limit: 100 } ) grants = response.data.map do |grant| @@ -87,8 +86,4 @@ class Enterprise::Billing::V2::CreditManagementService < Enterprise::Billing::V2 def stripe_customer_id custom_attribute('stripe_customer_id') end - - def stripe_api_options - { api_key: ENV.fetch('STRIPE_SECRET_KEY', nil), stripe_version: '2025-08-27.preview' } - end end diff --git a/enterprise/app/services/enterprise/billing/v2/plan_catalog.rb b/enterprise/app/services/enterprise/billing/v2/plan_catalog.rb index 390049eba..50f38d4a0 100644 --- a/enterprise/app/services/enterprise/billing/v2/plan_catalog.rb +++ b/enterprise/app/services/enterprise/billing/v2/plan_catalog.rb @@ -93,11 +93,10 @@ module Enterprise::Billing::V2::PlanCatalog } end - def rate_card_component(definition) + def rate_card_component(_definition) { type: 'rate_card', name: 'Overage Rate', - overage_rate: definition[:overage_rate], rate_unit: CREDIT_UNIT, meter_id: nil } diff --git a/enterprise/app/services/enterprise/billing/v2/topup_service.rb b/enterprise/app/services/enterprise/billing/v2/topup_service.rb index 018b204b9..e0bdcf6f0 100644 --- a/enterprise/app/services/enterprise/billing/v2/topup_service.rb +++ b/enterprise/app/services/enterprise/billing/v2/topup_service.rb @@ -102,8 +102,7 @@ class Enterprise::Billing::V2::TopupService < Enterprise::Billing::V2::BaseServi # Following Stripe UBB Integration Guide section 8 def create_stripe_credit_grant(amount_cents, currency, credits) Stripe::Billing::CreditGrant.create( - credit_grant_params(amount_cents, currency, credits), - stripe_api_options + credit_grant_params(amount_cents, currency, credits) ) end @@ -149,8 +148,4 @@ class Enterprise::Billing::V2::TopupService < Enterprise::Billing::V2::BaseServi def stripe_customer_id custom_attribute('stripe_customer_id') end - - def stripe_api_options - { api_key: ENV.fetch('STRIPE_SECRET_KEY', nil), stripe_version: '2025-08-27.preview' } - end end