cancel
Showing results for 
Search instead for 
Did you mean: 

how to get customerPaymentProfileIds - CIM

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

faisal6621
Contributor
1 ACCEPTED SOLUTION

Accepted Solutions

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

faisal6621
Contributor
1 REPLY 1

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);
faisal6621
Contributor