At fifteen he ran away from school to become a soldier and fought in the 30 Years War. By the time he was twenty-four he had served six monarchs, including the King of Denmark and Gustavus Adolphus of Sweden. He returned to Scotland disillusioned by lack of pay, and in 1630 obtained a position as a chorister of the Chapel Royal at Stirling, from Charles I. David Stevenson, Mercer's biographer in the Oxford Dictionary of National Biography, says that "This musical side to his interests makes it likely that he was the 'William Merser, musician' who was admitted a burgess of Edinburgh in 1631. His first poetic work, A Description of the Creation, a miscellany, included fulsome praise for Edinburgh's magistrates." He fought for the Protestant cause in the Irish Rebellion of 1641, a conflict in which his brother Robert, a Presbyterian minister, and his family were killed, but left Ireland to join the Parliamentary side in the First English Civil War. He was commissioned as a captain in the parliamentarian army of the Earl of Essex, and he witnessed the Battle of Edgehill. By 1646 he had discovered that the English parliament were no more likely to pay their soldiers than the monarchs of Europe. His campaign to be paid culminated in the verse Angliae speculum, or, England's Looking-Glasse. It was addressed to Essex and pleaded for payment of his back pay of £900 from parliament. In the same year that Mercer wrote Angliae speculum he also wrote an elegy for his father-in-law Sir Henry Mervyn and later the same year one for Essex. By 1648 Mercer was in the Engagers army, probably with the rank of lieutenant-colonel, because in 1650 with that rank he repented his support for the Engagers in a petition to the commission of the general assembly of the Church of Scotland. His movements over the next decade are not known but he was in Ireland in 1659 when, in response to Lord Robartes of Truro' appointment to the position of Lord Lieutenant, Mercer wrote A Welcom in a Poem on Robartes entry into Dublin. In 1672 he sued the family of James Mercer of Aldie for damages after the breakdown of the engagement of his eldest son to Mercer's daughter. He wrote verses praising the Scottish court of session judges and begging for their favour in his case, but to no avail as he lost the case; however, in 1675 he was awarded compensation of the cost of coming from Ireland to fight the case. Before his death he had been working on a "big book" chronicling events since 1638. But it was not completed by his death and David Stevenson says "That this never appeared need be little lamented, for 'Mercer's writings are mainly valuable for their autobiographical details. The majority of his verses are mere doggerel, and display an inordinate self-conceit'. But his conceit did at least ensure that enough information survived to reconstruct the outline of his life." Mercer has been mistakenly credited by some with writing The Moderate Cavalier, or, The Soldier's Description of Ireland which was published in 1675, but the William Mercer who wrote it had served as a Royalist in the English Civil War.