Ankara promised cash and closer ties with EU in return for handling the flow of refugees into Europe on its territory.