Amazon (NASDAQ:AMZN) is the top e-commerce player in the U.S. by a wide margin. Yet e-commerce services provider Shopify (NYSE:SHOP), which brings offline merchants online, ranks second, according to eMarketer. The firm notes that Amazon accounted for 37.3% of all U.S. retail e-commerce sales last year, while Shopify claimed a 5.9% share.

Amazon and Shopify aren't direct competitors, but both e-commerce stocks have soared in recent years. Amazon's stock rallied 450% over the past five years, while Shopify's stock generated a 30-bagger return since its market debut in May 2015.

But past performance never guarantees future gains, so investors should take a fresh look at both stocks before chasing either rally. Let's dig deeper to see which e-commerce darling is the stronger overall investment for 2020.

Tiny parcels on a laptop keyboard.

Image source: Getty Images.

How do Amazon and Shopify make money?

Amazon splits its business into three main segments: North America, International, and its AWS (Amazon Web Services) cloud platform, which generated 61%, 27%, and 12% of its revenue, respectively, in fiscal 2019.

Amazon generates most of its revenue from its North American and International marketplaces, but it generated 63% its operating profits from AWS last year. In short, Amazon subsidizes the growth of its lower-margin marketplace businesses with its higher-margin cloud revenue.

Shopify's business is split into two main segments: merchant solutions, which generates revenue from payment and transaction fees; and subscription solutions, which generates recurring revenue from its core platform and various add-on services.

Shopify generated 59% of its revenue from the lower-margin merchant solutions unit last year, and the rest came from its higher-margin subscription solutions unit. To boost its subscription revenue, Shopify is expanding its ecosystem -- which includes an internal app store, point-of-sale card readers, a wholesale channel for buyers, bulk label printing services, AR features for mobile apps, cash advances via Shopify Capital, and other services -- to lock in its merchants.

Which company is growing faster?

Amazon and Shopify both benefited from the explosive growth of the e-commerce market over the past several years. Amazon also benefited from the growth of AWS, the world's largest cloud infrastructure platform, as companies migrated their data to the public cloud.

Shopify is smaller than Amazon and growing at a much faster rate, but both companies reported decelerating revenue growth last year.

YOY revenue growth

2015

2016

2017

2018

2019

Amazon

20%

27%

31%

31%

20%

Shopify

95%

90%

73%

59%

47%

YOY = Year-over-year. Source: Shopify annual reports.

Amazon's slowdown can be attributed to competition in the U.S. retail market from resurgent retailers like Walmart and Target, as well as tough competition in the cloud market from Microsoft's (NASDAQ:MSFT) Azure. Analysts expect that slowdown to continue with 19% revenue growth this year.

Shopify's slowdown is mainly attributed to the gradual maturation of its 16-year-old business, but it also faces fresh competition from Adobe (NASDAQ:ADBE), which acquired Shopify's rival MagentoSquare (NYSE:SQ), which bought Weebly to integrate online stores into its digital payments ecosystem; and even Microsoft, which hinted that it could bundle similar e-commerce services with its cloud services in the near future. Wall Street expects Shopify's revenue to rise 37% in 2020.

Profitability and valuations

Amazon has remained consistently profitable (by both GAAP and non-GAAP measures) over the past five years. Shopify has only stayed profitable by non-GAAP measures, which exclude stock-based compensation and other "one-time" charges, over the past three years.

Both companies are investing heavily in the expansion of their ecosystems. Amazon consistently adds new features to AWS and expands its reach with new data centers, and tightens its grip on its marketplace's Prime members with original digital content, better delivery options, and new hardware products.

Amazon's EPS rose 14% in 2019, and analysts anticipate 25% earnings growth this year as AWS continues to grow. Amazon's stock is pricey relative to that growth at over 50 times forward earnings, but its dominance of the e-commerce and cloud markets arguably justifies that premium.

Amazon's Echo speakers.

Image source: Amazon.

Shopify plans to widen its moat against its looming rivals with investments in its fulfillment network, new features for its premium Shopify Plus tier, improvements to its main platform, an overseas expansion, and fresh marketing initiatives.

Shopify's non-GAAP EPS fell 30% in 2019, and Wall Street expects another 17% decline this year as its investments rise. Those are mediocre growth rates for a stock that trades at over 650 times forward earnings.

The clear winner: Amazon

Shopify is a well-run company with a first mover's advantage in the e-commerce services space, but its stock is simply too hot to handle. Investors can consider buying Amazon at these levels, since its e-commerce and cloud businesses are broadly stable, but they shouldn't touch Shopify unless its valuations cool off.