Reply
Highlighted
Contributor
Posts: 11
Registered: ‎04-07-2014
Accepted Solution

how to get customerPaymentProfileIds - CIM

[ Edited ]

I've a code snippet

 

$cim = new AuthorizeNet_AuthorizeNetCIM($_api_key, $_transaction_key);
$profile = $cim->getCustomerProfile($customerId);
 
If I do print $profile as print_r($profile); the result is:
 
AuthorizeNet_AuthorizeNetCIMResponse Object
(
    [xml] => SimpleXMLElement Object
        (
            [messages] => SimpleXMLElement Object
                (
                    [resultCode] => Ok
                    [message] => SimpleXMLElement Object
                        (
                            [code] => I00001
                            [text] => Successful.
                        )
                )
            [profile] => SimpleXMLElement Object
                (
                    [merchantCustomerId] => 10
                    [email] => user@nine.com
                    [customerProfileId] => 25441529
                    [paymentProfiles] => Array
                        (
                            [0] => SimpleXMLElement Object
                                (
                                    [billTo] => SimpleXMLElement Object
                                        (
                                            [firstName] => User
                                            [lastName] => Nine
                                            [address] => addressline two
                                            [city] => delhi
                                            [zip] => 201111
                                            [country] => IN
                                            [phoneNumber] => 43215464
                                        )
                                    [customerPaymentProfileId] => 23298664
                                    [payment] => SimpleXMLElement Object
                                        (
                                            [creditCard] => SimpleXMLElement Object
                                                (
                                                    [cardNumber] => XXXX2224
                                                    [expirationDate] => XXXX
                                                )
                                        )
                                )
                            [1] => SimpleXMLElement Object
                                (
                                    [customerType] => individual
                                    [billTo] => SimpleXMLElement Object
                                        (
                                            [firstName] => Test
                                            [lastName] => Individual
                                            [company] => SimpleXMLElement Object
                                                ()
                                            [address] => address
                                            [city] => city
                                            [state] => ST
                                            [zip] => 201111
                                            [country] => IN
                                            [phoneNumber] => SimpleXMLElement Object
                                                ()
                                            [faxNumber] => SimpleXMLElement Object
                                                ()
                                        )
                                    [customerPaymentProfileId] => 23299421
                                    [payment] => SimpleXMLElement Object
                                        (
                                            [creditCard] => SimpleXMLElement Object
                                                (
                                                    [cardNumber] => XXXX0027
                                                    [expirationDate] => XXXX
                                                )
                                        )
                                )
                        )
                    [shipToList] => Array
                        (
                            [0] => SimpleXMLElement Object
                                (
                                    [firstName] => User
                                    [address] => address line two
                                    [city] => delhi
                                    [zip] => 201301
                                    [country] => IN
                                    [customerAddressId] => 23184354
                                )
                            [1] => SimpleXMLElement Object
                                (
                                    [firstName] => Test
                                    [lastName] => Individual
                                    [company] => SimpleXMLElement Object
                                        ()
                                    [address] => address
                                    [city] => city
                                    [state] => ST
                                    [zip] => 201111
                                    [country] => IN
                                    [phoneNumber] => SimpleXMLElement Object
                                        ()
                                    [faxNumber] => SimpleXMLElement Object
                                        ()
                                    [customerAddressId] => 23185099
                                )
                        )
                )
        )
 

 

I'd tried $profile->getCustomerPaymentProfileIds(); but it also results in error


Accepted Solutions
Solution
Accepted by topic author faisal6621
‎08-21-2015 01:58 AM
Contributor
Posts: 11
Registered: ‎04-07-2014

Re: how to get customerPaymentProfileIds - CIM

I'd written this code in order to get customerPaymentProfileIds

 

$paymentProfileIds = array();
foreach($response->xml->profile->paymentProfiles AS $profile){
$paymentProfileIds[]=(string) $profile->customerPaymentProfileId;
}print_r($paymentProfileIds);

View solution in original post


All Replies
Solution
Accepted by topic author faisal6621
‎08-21-2015 01:58 AM
Contributor
Posts: 11
Registered: ‎04-07-2014

Re: how to get customerPaymentProfileIds - CIM

I'd written this code in order to get customerPaymentProfileIds

 

$paymentProfileIds = array();
foreach($response->xml->profile->paymentProfiles AS $profile){
$paymentProfileIds[]=(string) $profile->customerPaymentProfileId;
}print_r($paymentProfileIds);