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

displaying CIM profile information with PHP SDK

Hello, 

 

I'm trying to display information, but its not displaying. Can someone help me figure this one out? I know its not a good idea to display information, but I'm doing this because it will help me understand how this SDK works.

 

Thanks

 

	require_once 'anet_php_sdk/AuthorizeNet.php';
    define("AUTHORIZENET_API_LOGIN_ID", "LOGIN_ID");
    define("AUTHORIZENET_TRANSACTION_KEY", "TRANSACTION_KEY");
    $request = new AuthorizeNetCIM;
    // Create new customer profile
//echo $_SESSION['user_id'];
	$customerProfile                    = new AuthorizeNetCustomer;
    $customerProfile->description       = "Description of customer";
    $customerProfile->merchantCustomerId= time();
    $customerProfile->email             = "test@domain.com";
	$customerProfile->cardNumber        = '4111111111111111';
	$customerProfile->expirationDate    = "2021-04";
	//$customerProfile->cardCode          = $cvv;
	
    $response = $request->createCustomerProfile($customerProfile);
    if ($response->isOk()) {
        $customerProfileId = $response->getCustomerProfileId();
		echo $customerProfileId;

    }
	$customerProfileId = $response->getCustomerProfileId();
echo $customerProfileId;

 


Accepted Solutions
Highlighted
Solution
Accepted by topic author andrewliu
‎08-21-2015 01:58 AM
Member
Posts: 4
Registered: ‎07-20-2011

Re: displaying CIM profile information with PHP SDK

The way you add a payment profile is wrong.

 

define('AUTHORIZENET_API_LOGIN_ID', 'LOGIN_ID');
define('AUTHORIZENET_TRANSACTION_KEY', 'TRANSACTION_KEY');

// Let's create a payment profile first.
$paymentProfile = new AuthorizeNetPaymentProfile();
$creditCard = $paymentProfile->payment->creditCard;
$creditCard->cardNumber = '4111111111111111';
$creditCard->expirationDate = '2021-04';
//$creditCard->cardCode = $cvv;

// Customer profile comes next.
$customerProfile = new AuthorizeNetCustomer();
$customerProfile->description = 'Description of customer';
$customerProfile->merchantCustomerId = time();
$customerProfile->email = 'test@domain.com';
$customerProfile->paymentProfiles[] = $paymentProfile;

// Off it goes.
$request = new AuthorizeNetCIM();
$response = $request->createCustomerProfile($customerProfile);

if($response->isOk()) {
	$customerProfileId = $response->getCustomerProfileId();
	echo $customerProfileId;
}
else {
	echo $response->getErrorMessage();
}

 

View solution in original post


All Replies
Highlighted
Contributor
Posts: 13
Registered: ‎07-13-2011

Re: displaying CIM profile information with PHP SDK

anyone have CIM experience? 

 

Thanks

Highlighted
Solution
Accepted by topic author andrewliu
‎08-21-2015 01:58 AM
Member
Posts: 4
Registered: ‎07-20-2011

Re: displaying CIM profile information with PHP SDK

The way you add a payment profile is wrong.

 

define('AUTHORIZENET_API_LOGIN_ID', 'LOGIN_ID');
define('AUTHORIZENET_TRANSACTION_KEY', 'TRANSACTION_KEY');

// Let's create a payment profile first.
$paymentProfile = new AuthorizeNetPaymentProfile();
$creditCard = $paymentProfile->payment->creditCard;
$creditCard->cardNumber = '4111111111111111';
$creditCard->expirationDate = '2021-04';
//$creditCard->cardCode = $cvv;

// Customer profile comes next.
$customerProfile = new AuthorizeNetCustomer();
$customerProfile->description = 'Description of customer';
$customerProfile->merchantCustomerId = time();
$customerProfile->email = 'test@domain.com';
$customerProfile->paymentProfiles[] = $paymentProfile;

// Off it goes.
$request = new AuthorizeNetCIM();
$response = $request->createCustomerProfile($customerProfile);

if($response->isOk()) {
	$customerProfileId = $response->getCustomerProfileId();
	echo $customerProfileId;
}
else {
	echo $response->getErrorMessage();
}

 

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

Re: displaying CIM profile information with PHP SDK

Amazing! Thank you!

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

Re: displaying CIM profile information with PHP SDK

So essentially, I can just call out that profileId and get those credit card information and Display it to the user?