2

I have a wordpress Civicrm instance and we are using Braintree as the payment processor. I'm trying to create a CiviEvent, selling tickets to an event. When I try to test payments out by submitting test payments, I get an error.

Looks like there was problem. Payment Response: Braintree\Configuration::merchantId needs to be set (or accessToken needs to be passed to Braintree\Gateway).:

The weird thing is, the merchantId and all the API keys are already defined. I made a test payment on a CiviContribute page and that worked just fine. I'm confused as to why it would work on one Civi module and not work on the other.

Can anyone help advise me on how to fix this? Thanks.

2

Figured it out. For some reason, the braintree keys were not being loaded at the time before it started to post to Braintree. In Braintree.php I added the following

 if (empty(Braintree_Configuration::environment())) {
  $environment = ($this->_mode == "test" ? 'sandbox' : 'production');
  Braintree_Configuration::environment($environment);
}

if (empty(Braintree_Configuration::merchantId())) {
  Braintree_Configuration::merchantId($this->_paymentProcessor["user_name"]);
}

if (empty(Braintree_Configuration::publicKey())) {
  Braintree_Configuration::publicKey($this->_paymentProcessor["password"]);
}

if (empty(Braintree_Configuration::privateKey())) {
  Braintree_Configuration::privateKey($this->_paymentProcessor["signature"]);
}

Right before the following:

try {
  $result = Braintree_Transaction::sale($requestArray);
} catch (Exception $e) {
  return self::error("Oops! Looks like there was problem. Payment Response: " . $e->getMessage());
}

And it worked. I'm not entirely sure why the values weren't being loaded initially but this will do!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.