Search code examples
phperror-handlingbraintreeuncaught-exception

Fatal error: Uncaught exception 'Braintree_Exception_Configuration' with message 'environment needs to be set.'


How to set the environment? And how to rectify this error?

Fatal error: Uncaught exception 'Braintree_Exception_Configuration'


Solution

  • Message is pretty selfexplanatory. You need to call

    Braintree_Configuration::environment(...);
    

    with proper parameter prior using BT, as it needs to know if you want to talk to production or sandbox.