Skip to content

uninitialized constant SolidusPaypalBraintree::Gateway (NameError) #4746

Discussion options

You must be logged in to vote

Since Rails 7 is no longer possible to reference reloadable constants in an initializer. Probably, you need to change to:

Rails.application.config.to_prepare do
  Spree::Config.static_model_preferences.add(
     SolidusPaypalBraintree::Gateway,
    'braintree_credentials', {
       environment: Rails.env.production? ? 'production' : 'sandbox',
       merchant_id: ENV['BRAINTREE_MERCHANT_ID'],
       public_key: ENV['BRAINTREE_PUBLIC_KEY'],
       private_key: ENV['BRAINTREE_PRIVATE_KEY'],
       paypal_flow: 'vault', # 'checkout' is accepted too
       use_data_collector: true # Fingerprint the user's browser when using Paypal
     }
  )
end

I created a PR to update the README.

Thanks for…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by waiting-for-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants