EBay Inc. last year fought to keep hold of PayPal in a contentious battle before reversing course. As it plans to spin off the fast-growing payments unit on Friday, the e-commerce company may wish it had held its ground.

The company’s second-quarter results, its last as a united entity, tell a story of two online giants headed in seemingly opposite directions. While PayPal can point to double-digit revenue growth and a slate of recent acquisitions, eBay is beset by shrinking sales and is jettisoning assets.

...