US President Donald Trump said the ceasefire with Iran was agreed upon as a favour to Pakistan, crediting Islamabad for helping ease tensions.