cancel
Showing results for 
Search instead for 
Did you mean: 

can't connect to authorize.net with cim service

Trying to create a customer profile in cim, I'm getting the message" Error connecting to AuthorizeNet" , I'm using a test account, already checked that the account is active, and generate a new transaction key. This is the code.

 

function makeCIMProfileID ($params){
         require_once JPATH_BASE.DS.'/components/com_subscription/includes/'.'AuthorizeNet.php';
         define("AUTHORIZENET_API_LOGIN_ID", "login");
         define("AUTHORIZENET_TRANSACTION_KEY", "key");

 

        $cim = new AuthorizeNetCIM();
         $customerProfile = new AuthorizeNetCustomer;
         $customerProfile->description = $description = $params['username'];
         $customerProfile->merchantCustomerId = $merchantCustomerId = $params['user_id'];
         $customerProfile->email = $email = $params['email'];

 

$response= $cim->createCustomerProfile($customerProfile);

 $transactionResponse=$response->getTransactionResponse();
         if ($response->isOk()){
             $msg['customer_profile_id']=$response->getCustomerProfileId();
         } else {
           
                  if ($response->getMessageCode()=='E00039'){
                      $response2 = $cim->getCustomerProfileIds();
                      $customers=$response2->getCustomerProfileIds();
                      foreach ($customers as $customer) {
                          $response = $cim->getCustomerProfile($customer);

                          if ($params['username'] == $response->xpath('description')){
                              $msg['customer_profile_id']=$response->getCustomerProfileId();
                          }
                        }

                  } else {
                    $msg['MessageSource']="CIM Profile";
                      $msg['MessageCode']=$response->getMessageCode();
                     $msg['MessageText']=$response->getMessageText();
                     $msg['ErrorMessage']=$response->getErrorMessage();
                    foreach ($transactionResponse as $key => $value) {
                        $msg[$key]=$value;
                    }
                  }
         }
        return $msg;
     }

this is the result that I print from curl

url=>string https://apitest.authorize.net/xml/v1/request.api (length=48)

 


the rest of values returns 0

 

   

arobelo123
Member
1 REPLY 1

looking thru the source, look like it doesn't like the createCustomerProfile response.

RaynorC1emen7
Expert