Square Inc. is selling its Caviar food-delivery app to DoorDash Inc. for $410 million, as the money-losing payments company searches for profits.

The sale was disclosed as part of Square’s quarterly financial report Thursday, which failed to impress investors. The stock fell as much as 9% in extended trading.

The San Francisco-based company gave a third-quarter profit forecast of 18 cents to 20 cents a share, trailing the average analyst estimate of 22 cents. It said adjusted revenue in the period will be $590 million to $600 million, compared with estimates of $599.5 million, according to data compiled by Bloomberg.

The Caviar deal is a boost for DoorDash, already the most popular food delivery app in the U.S. The privately held company, which counts SoftBank Group Corp. as a major backer, is valued at more than $12 billion. DoorDash recently faced an outcry over its handling of customers’ tips and said it would change the policy, which counts gratuity toward a driver’s base pay. A challenge it has yet to solve -- and one that eluded Square -- is finding a way to reliably turn a profit from food delivery.

For Square, the sale frees up cash that can be spent on other areas. The company said it would shift investment to the cash register and online shopping business and to Cash App, a competitor of PayPal Holdings Inc.’s Venmo. The payments app is on track to generate $500 million in revenue annually based on recent performance, Square said.

The sale of Caviar “is about increasing our focus and investment in our two growing ecosystems,” Amrita Ahuja, the chief financial officer, said on a conference call with analysts following the report. The transaction is expected to close this year, and Square said it’ll update financial guidance after that. Ahuja said Caviar was the second-largest component of its subscription and services revenue, but also the biggest cost.

Square said earnings per share for the second quarter jumped to 21 cents, exceeding estimates of 16 cents. They were 13 cents in the same period last year. Adjusted sales increased 46% to $563 million, also above estimates. But gross payment volume was $26.8 billion, missing estimates by $100 million.