def get_hosted_profile_page_request(profile_id, return_url)
        
      xml = ""
      xml << "<?xml version=\"1.0\"?>\n"
      xml << "<getHostedProfilePageRequest xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\">\n"    
      xml << "  <merchantAuthentication>\n"             
      xml << "    <name>#{@api_login_id}</name>\n"
      xml << "    <transactionKey>#{@api_transaction_key}</transactionKey>\n"
      xml << "  </merchantAuthentication>\n"
      xml << "  <customerProfileId>#{profile_id}</customerProfileId>\n"
      xml << "  <hostedProfileSettings>\n"
      xml << "    <setting><settingName>hostedProfilePageBorderVisible</settingName><settingValue>false</settingValue></setting>\n"
      xml << "    <setting><settingName>hostedProfileHeadingBgColor</settingName><settingValue>#ffffff</settingValue></setting>\n"
      xml << "    <setting><settingName>hostedProfileBillingAddressRequired</settingName><settingValue>true</settingValue></setting>\n"
      xml << "    <setting><settingName>hostedProfileCardCodeRequired</settingName><settingValue>true</settingValue></setting>\n"
      xml << "    <setting><settingName>hostedProfileReturnUrl</settingName><settingValue>#{return_url}</settingValue></setting>\n"
      xml << "  </hostedProfileSettings>\n"
      xml << "</getHostedProfilePageRequest>\n"
      
      response = HTTParty.post('https://api.authorize.net/xml/v1/request.api', { :body => xml, :headers => { 'Content-Type' => 'text/xml' }})
      #Caboose.log(response.body)
      
      # Note: Can't parse response with httparty because of namespace issue in the 
      #       response xml. Have to strip the namespace out before parsing.            
      str = response.body.gsub("xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\"", '')
      xml = Nokogiri::XML(str)
      token_nodes = xml.xpath('//getHostedProfilePageResponse//token')
      token = token_nodes ? token_nodes.first.content : nil
      #Caboose.log(token)
      
      return token    
    end
def get_hosted_profile_page_request(profile_id, return_url)
        
      xml = ""
      xml << "<?xml version=\"1.0\"?>\n"
      xml << "<getHostedProfilePageRequest xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\">\n"    
      xml << "  <merchantAuthentication>\n"             
      xml << "    <name>#{@api_login_id}</name>\n"
      xml << "    <transactionKey>#{@api_transaction_key}</transactionKey>\n"
      xml << "  </merchantAuthentication>\n"
      xml << "  <customerProfileId>#{profile_id}</customerProfileId>\n"
      xml << "  <hostedProfileSettings>\n"
      xml << "    <setting><settingName>hostedProfilePageBorderVisible</settingName><settingValue>false</settingValue></setting>\n"
      xml << "    <setting><settingName>hostedProfileHeadingBgColor</settingName><settingValue>#ffffff</settingValue></setting>\n"
      xml << "    <setting><settingName>hostedProfileBillingAddressRequired</settingName><settingValue>true</settingValue></setting>\n"
      xml << "    <setting><settingName>hostedProfileCardCodeRequired</settingName><settingValue>true</settingValue></setting>\n"
      xml << "    <setting><settingName>hostedProfileReturnUrl</settingName><settingValue>#{return_url}</settingValue></setting>\n"
      xml << "  </hostedProfileSettings>\n"
      xml << "</getHostedProfilePageRequest>\n"
      
      response = HTTParty.post('https://api.authorize.net/xml/v1/request.api', { :body => xml, :headers => { 'Content-Type' => 'text/xml' }})
      #Caboose.log(response.body)
      
      # Note: Can't parse response with httparty because of namespace issue in the 
      #       response xml. Have to strip the namespace out before parsing.            
      str = response.body.gsub("xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\"", '')
      xml = Nokogiri::XML(str)
      token_nodes = xml.xpath('//getHostedProfilePageResponse//token')
      token = token_nodes ? token_nodes.first.content : nil
      #Caboose.log(token)
      
      return token    
    end
=============================================================================
 Get hosted profile token
=============================================================================