cancel
Showing results for 
Search instead for 
Did you mean: 

CIM - Adding Payment Profile

Hello

I had AIM working fine on my site but am now swithing to CIM.

 

I am processing in steps in which I first create the customer profile with the following.

 

$request = new AuthorizeNetCIM; // Create new customer profile
     $customerProfile = new AuthorizeNetCustomer;
     $customerProfile->description = "Guest ID:$GuestIDnum Customer profile for $SiteTITLE";
     $customerProfile->merchantCustomerId= $GuestIDnum;
     $customerProfile->email = $_POST['x_email'];
     $response = $request->createCustomerProfile($customerProfile);
     if ($response->isOk()) {
     $customerProfileId = $response->getCustomerProfileId();
     }

 

This is working and $customerProfileId is saved to DB user table and to SESSION during this registration process.  The next step shows the CC form and I'm processing with this code, but I get the "white screen of death" and can't find where I've gone wrong with this code.  Can anyone spot the problem?

 

$request = new AuthorizeNetCIM;
    $paymentProfile = new AuthorizeNetPaymentProfile;
    $paymentProfile->customerType = "individual";
    $paymentProfile->payment->creditCard->cardNumber = "{$_POST['x_card_num']}";
    $paymentProfile->payment->creditCard->expirationDate = "{$_POST['x_exp_year']}-{$_POST['x_exp_month']}";
    $response = $request->createCustomerPaymentProfile($customerProfileId, $paymentProfile);
    $this->assertTrue($response->isOk());
    $paymentProfileId = $response->getPaymentProfileId();

 

Thank you for any help.

Drummin
Member
2 REPLIES 2

I changed the expiration date section in case it was being handled as MATH.  Still No GO.

 

    $expirationDate = "{$_POST['x_exp_year']}"."-"."{$_POST['x_exp_month']}";
    // Create customer payment profile
    $request = new AuthorizeNetCIM;
    $paymentProfile = new AuthorizeNetPaymentProfile;
    $paymentProfile->customerType = "individual";
    $paymentProfile->payment->creditCard->cardNumber = "{$_POST['x_card_num']}";
    $paymentProfile->payment->creditCard->expirationDate = $expirationDate;
    $response = $request->createCustomerPaymentProfile($customerProfileId, $paymentProfile);
    $this->assertTrue($response->isOk());
    $paymentProfileId = $response->getPaymentProfileId();

 

 

Drummin
Member

Well after days of fighting with AuthorizeNet.php, I switched to AuthnetXML.class and at least have CIM working.  Still need to find out how to apply refund using transaction_id.  Have not found that feature in AuthnetXML.class yet.  If anyone knows the best way to refund a transaction, please let me know, thanks.