UK online payments processor Worldpay and US rival Vantiv are set to pay out £21m in legal fees for advice on their merger, documents released today reveal.

Allen & Overy (A&O) and Skadden Arps Slate Meagher & Flom stand to benefit from the fees, with the former acting for London-headquartered Worldpay and the latter instructing Vantiv.

The tie-up was announced last summer and is expected to complete in early 2018.

Merger documents show Vantiv's legal costs are expected to total $17.9m (£13.5m), with Worldpay's legal costs estimated to be about £7.5m.

A number of other law firms are involved in the deal including Ashurst, which is representing the financial advisers Morgan Stanley and Credit Suisse International.

Other firms with advisory roles include Latham & Watkins for the underwriters and Sullivan & Cromwell for the Fifth Third Bank on a share transaction to facilitate the deal.

Other big deals in 2017 to produce large legal fees include Word Group's acquisition of Amec Foster Wheeler, which incurred £21.8m in legal costs. Firms to advise on the deal include Slaughter and May and Linklaters.

However, these fees pale in comparison to Anheuser-Busch InBev's 2016 acquisition of rival brewer SAB Miller which generated $1.94bn in advisory fees, with law firms receiving a $261m (£197m) share of the pot. Freshfields Bruckhaus Deringer and Linklaters were the main advisers on the deal.

Similarly, the failed deal between London Stock Exchange Group (LSE) and Deutsche Boerse created an expected payout of at least £102m for legal advice. Freshfields and Linklaters again were the main advisers on the deal, which was called off earlier this year.

London-headquartered Worldpay launched in 1989. It processes payments online, in-store and over the phone for hundreds of thousands of merchants.

It was sold by Royal Bank of Scotland to private equity firms Bain Capital and Advent International in 2010. Bain and Advent were advised by Weil Gotshal & Manges on the investment, as well as the company's 2015 IPO.

Allen & Overy also advised Worldpay on its £890m IPO.