cancel
Showing results for 
Search instead for 
Did you mean: 

How to read and store userFields variables into other variables for website internal use purpose

Below userFields are printed in XML response. But I want to read and store userFields variables into other variables for website internal use purpose as they contain some useful info. So how can I do it? Please let me know.

 

<userFields>
    <userField>
       <name>Name001</name>
        <value>Value001</value>
     </userField>
     <userField>
        <name>Name002</name>
        <value>Value002</value>
    </userField>
</userFields>

 

Thank you,

kra091978
Member
2 REPLIES 2

Hello @kra091978

 

User fields are returned in the API Response where you can read and act on them as you wish.  They are not stored as part of the transaction.

 

Richard

RichardH
Administrator Administrator
Administrator

We received 'userFields' in XML response but we can't store it in other variables for further manipulation and database storage purpose. 

 

 

This userFields variables' values are displayed when we print $xml variable...

 

For e.g.

 

When I try to get value of <resultCode></resultCode> from response XML then I can get this value... For this i wrote: <?php echo ($xml->messages->resultCode); ?>

 

But when I try to get the value of 'userFields' then I can't get the value...

 

For this i write: <?php echo ($xml->userFields->userField->value); ?>

 

but I can't read this value with this...

 

Below code is used to pass userFields in XML request.

 

'userFields' => array(
               'userField' => array(
                       0 => array(
                        'name' => 'itm_id',
                        'value' => $itm_id,
                    ),
                    1 => array(
                        'name' => 'unq_id',
                        'value' => $unq_id,
                    ),
                ),

),