Integration and Testing

Authorize.Net API questions and help with your payment integration.

Reply
Member
Posts: 6
Registered: ‎09-04-2016

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,

Posts: 2,765
Topics: 57
Kudos: 272
Blog Posts: 67
Registered: ‎12-05-2011

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

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

Member
Posts: 6
Registered: ‎09-04-2016

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

[ Edited ]

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,
                    ),
                ),

),