Reply
Highlighted
Contributor
Posts: 13
Registered: ‎07-13-2011

PHP CIM SDK creating profiles and displaying information help

Hello!

 

I was wondering if someone can help me understand the PHP SDK. I'm new to this and would like some light shining my way please. I've been trying to figure this out...

 

So I have two requests: customer profile and payment profile

 

    // Create new customer profile
    $request = new AuthorizeNetCIM;
    $customerProfile = new AuthorizeNetCustomer;
    $customerProfile->description = "Description of customer";
    $customerProfile->merchantCustomerId = time().rand(1,10);
    $customerProfile->email = "blahblahblah@domain.com";
	$response = $request->createCustomerProfile($customerProfile);
	if($response->isOk()){
	$customerProfileId = $response->getCustomerProfileId();
	} else {echo $response->getErrorMessage();}
	
	
    // Add payment profile.
    $paymentProfile = new AuthorizeNetPaymentProfile;
    $paymentProfile->customerType = "individual";
    $paymentProfile->payment->creditCard->cardNumber = "4111111111111111";
    $paymentProfile->payment->creditCard->expirationDate = "2015-10";
	$customerProfile->paymentProfiles[] = $paymentProfile;
	$response = $request->createCustomerPaymentProfile($customerProfileId, $paymentProfile);
	if($response->isOk()){
	$paymentProfileId = $response->getPaymentProfileId();
echo $paymentProfileId;
} else {echo $response->getErrorMessage();}

 

 

I know how to echo out both customer profile id and payment profile id. Do I need to have two id's? can't they both just be one id? If so, whats the best way to integrate the two to have one id? Also, how would I echo out the information itself (email, cardNumber, etc...). I know its not a good thing to echo out cards, but I would like to echo out last 4 digit so users can choose their different types of cards.

 

Thank you very much!

 

 

Contributor
Posts: 13
Registered: ‎07-13-2011

Re: PHP CIM SDK creating profiles and displaying information help

Any idea on this subject?

 

Thanks!

Moderator
Posts: 590
Registered: ‎08-21-2009

Re: PHP CIM SDK creating profiles and displaying information help

The Customer Information Manager (CIM) is constructed so that individual customers may have multiple payment options on file.  Due to this design, it is necessary to provide both a Customer Profile and a Payment Profile when you choose to actually cahrge a customer. In order to retrieve and display information about a customer profile, you will want to look at the getCustomerProfile method.