Can't get why I'm sending wrong data with post request?
===

I need to  send data to PayPal - instead of sending first and last name it is sending authencity token.
<p>Here is my action:

     class StaticPagesController < ApplicationController
    ...
       def verify_paypal
    #include the gems needed
    require 'httpclient'
    require 'xmlsimple'
    require 'net/http'
    #set the header of the request
    header =  {"X-PAYPAL-SECURITY-USERID" => "######",
      "X-PAYPAL-SECURITY-PASSWORD" => "####",
      "X-PAYPAL-SECURITY-SIGNATURE" => "######",
      "X-PAYPAL-REQUEST-DATA-FORMAT" => "NV",
      "X-PAYPAL-RESPONSE-DATA-FORMAT" => "XML",
      "X-PAYPAL-APPLICATION-ID" =>  "#####"
    }
    #data to be sent in the request
    data = {"emailAddress" => params[:paypal],
            "firstName"=> current_user.first_name,
           "lastName" => current_user.last_name,
           "matchCriteria"=> "NAME",
           "requestEnvelope.errorLanguage" => "en_US"}

    #initialize the request
    clnt = HTTPClient.new
    #API end point
    url = URI.parse('https://svcs.paypal.com/AdaptiveAccounts/GetVerifiedStatus')
    #make the post
    res = clnt.post(uri, data, header)
    #if the request is successfull parse the XML
    if res.status == 200
      @xml = XmlSimple.xml_in(res.content)
      #check if the status node exists in the xml
      if @xml['accountType']!=nil
        account_type = @xml['accountType'][0] if account_type.to_s() == "Business"
          render :text => "Business account!"
          elseif account_type.to_s() == "Premier"
          render :text => "Premier Account!"
          elseif account_type.to_s() == "Personal"
          render :text => "Personal account!"
        else
          render :text => "Account type not null but not a valid PayPal account type."
        end
      else
        render :text => "Gee! sorry! something went seriously wrong"
      end
    end 
    end

In my views I'm calling this function:

     <%= link_to "verify", static_pages_verify_paypal_path, :method => :post %>

In routes:

         post "static_pages/verify_paypal"

http://curry.byteally.com/finding-verification-status-of-a-paypal-account-ruby-on-rails-paypal-adaptive-accounts-getverifiedstatus/( source, changed if statement to check accountType)
       