Turkey has agreed in principle to an EU plan to take in more refugees in exchange for more than $3bn and freer travel for Turks into the EU.