The broad market sell-off over the past few months has been brutal for many high-growth industries, including e-commerce. Online shopping got a huge boost during the pandemic, but investors are now worried about growth getting pulled forward and how much customer spending can grow over the next few years. Two North American e-commerce giants, Amazon (AMZN -0.16%) and Shopify (SHOP 0.19%), have been hit by this sentiment shift, with their stock prices down 17% and 64%, respectively, over the last six months.

Drawdowns like these are tough to swallow for shareholders but can provide buying opportunities for investors focused on the long term. The question then becomes, which one to purchase? Which is a better buy: Amazon or Shopify stock? Let's find out. 

A person putting a shipping label on a box.

Image source: Getty Images.

1. Amazon: A tech behemoth on multiple levels

We all know Amazon, a pioneer of online shopping back that has gone on to become a technology giant. Amazon's market cap is hovering around $1.5 trillion, making it the fifth-largest company in the world. 

The retail business for Amazon is separated into two segments: North America and International. North American revenue hit $280 billion in 2021, growing 18% and generating $7.3 billion in operating income. International revenue hit $128 billion in 2021, growing 22% but also generating an operating loss of approximately $1 billion. International includes regions like Europe, Japan, India, and Mexico. Many of these regions are still in their growth phases, so it's not surprising that they aren't generating positive operating income. Eventually, they should reach profitability.

Amazon's retail business is massive and competes heavily with Shopify, but investors shouldn't forget that Amazon has multiple revenue streams, including Amazon Web Services (AWS). AWS produced $62 billion in revenue last year and dominates the cloud computing market (with some competition from Microsoft and Alphabet). And unlike the retail business, AWS has fantastic operating margins, hitting 30% in 2021 and accounting for the majority of Amazon's consolidated profits. The cloud computing market is expected to grow at around 15% a year from now until 2030. If AWS can maintain its market lead, it should benefit from this tailwind for at least the next decade.

Amazon generated $25 billion in operating income last year, up slightly from 2020. This gives the stock a price-to-operating-income (P/OI) multiple of 58, which looks very expensive on its face. However, investors should remember that since the start of the pandemic, Amazon has invested massively to keep up with consumer demand, retain workers, and build out its internal logistics business. If Amazon can get a good return on these investments, operating income should go much higher over the next few years, making today's earnings multiple much more palatable. 

2. Shopify: Enabling Amazon's competitors

The biggest threat to Amazon's e-commerce dominance is actually a software company that enables retail brands to easily and efficiently sell products online directly to consumers. This is Shopify, a Canadian e-commerce platform that has grown massively over the last five years.

Shopify's business works like this: A company or individual who wants to sell products online signs up for one of its subscription tiers. This gives the seller access to a custom URL, an easy-to-use e-commerce website builder, and an app marketplace with hundreds of different add-ons to enhance the site. On top of these Subscription Solutions (Shopify's definition for the segment), it offers brands the ability to have customers checkout from other websites with Shopify Payments. Shopify makes money when customers choose this option at checkout, taking in between 2% and 3% of every transaction.

In 2021, Shopify processed $175.4 billion in gross merchandise volume (GMV), the total amount of dollars that flowed through its platform. This was up 47% from 2020. Gross payment volume (GPV), which is the number of dollars processed by Shopify Payments, hit $86 billion and now makes up around half of total GMV. These volume numbers led to Shopify's revenue growing 57% in 2021 to $4.6 billion. Operating income only came in at $269 million in 2021, which is 6% of revenue, but that is because Shopify is investing heavily for growth at the moment. As the business matures, it should have strong operating margins since it is a very asset-light business. 

One concern with Shopify is how little it is investing in fulfillment/delivery solutions compared to Amazon Logistics. This major hole in its business model could make the customer/business experience worse than Amazon. Besides this flaw, it looks like a great asset-light business. If the growth of e-commerce continues as expected over the next few years, Shopify should grow right along with it. 

So which is the better buy?

Going through the numbers, it's clear that both Amazon and Shopify are great businesses that have executed well with their various e-commerce strategies over the past few years. If the e-commerce industry continues to grow, both companies will continue growing their financials as well.

But if I have to choose, I'd say Amazon is the better buy here. Why? Because of AWS. The cloud computing segment has great margins and a huge runway for growth that is much more predictable than the e-commerce market at the moment. AWS can generate tons of value for Amazon shareholders over the next decade. At these company valuations, Amazon looks like a better buy right now.