Investors who have focused on the future of retail -- dominated by the concept of e-commerce -- have been huge winners over the past decade. While Amazon.com is surely the 800-pound gorilla in the room, others have benefited as well.

Over the past two years, for instance, e-commerce platform leader Shopify (NYSE:SHOP) and alternative-payment leader PayPal (NASDAQ:PYPL) have both seen their shares more than double. 

Between the two, which is a better buy today?

A bespectacled man in front of a laptop while holding two smartphones in his hands

Image source: Getty Images

That's not a question anyone can answer with 100% certainty. But we can break the idea down into three parts, and get a better idea for which stock we're more comfortable putting our money behind.

Financial fortitude

How would these companies be affected if a financial downturn hit tomorrow? One of the best ways to evaluate that question is to check on a company's financial fortitude: current levels of cash, debt, and free cash flow. 

While almost all stocks will fall in such a downturn, the businesses themselves can actually grow stronger if they have lots of dry powder lying around. They can buy back their own shares, underprice the competition to grab market share, or simply acquire their rivals.

Keeping in mind that PayPal is valued at over seven times the size of Shopify, here's how the two stack up.

Company Cash Debt Free Cash Flow
Shopify $1.6 billion $0 ($12 million)
PayPal $10.5 billion $0 $3.4 billion

Data source: Yahoo! Finance. Cash includes long and short-term investments. Free cash flow presented on a trailing-12-month basis.

It's enormously important that neither of these companies has any long-term debt. Shopify's recently announced secondary offering will also increase its cash position to over $2 billion.

That said, PayPal's strong free cash flows give it the edge here. While Shopify is purposely spending a little bit more than it takes in to continue grabbing market share, a downturn would cause them to hit the brakes. PayPal, on the other hand, could get more aggressive when it comes to the competition.

Winner = PayPal

Valuation

Next, we have a variable that's very difficult to pin down: valuation. I like to consult a number of different metrics to get a holistic picture of how much I'm really paying when I buy shares of a company.

Company Price to Earnings Price to Free Cash Flow Price to Sales P/E-to-Growth Ratio
Shopify 536 N/A 15.5 5.1
PayPal 37 30 6.7 1.7

Data source: Yahoo! Finance, E*Trade. P/E presented using non-GAAP earning when applicable. N/A = Not applicable due to negative free cash flow.

Here again we run into the same problem we had before: Shopify is purposely spending most of what it brings in to grab market share. That's a smart long-term move, but it also makes the stock expensive.

While PayPal's shares aren't exactly what I call "cheap," they are definitely more favorably priced than Shopify's.

Winner = PayPal

Sustainable competitive advantages

Finally, we have what I consider the most important variable: a company's moat. Over the long run, companies with the widest moat -- or the strongest advantages -- are able to create incredible wealth for their shareholders.

PayPal's key moat is the network effect: As more consumers use the payment system, more merchants are likely to accept payments through PayPal. And as more merchants accept payments through PayPal, consumers are incentivized to use it. It's a virtuous cycle, and the same dynamics play for some of PayPal's subsidiaries, like Venmo.

Right now, that network effect is on fire: Total active accounts were up 15% last quarter to 254 million. At the same time, total payments volume jumped 24% to $143 billion.

Shopify, on the other hand, also benefits from the network effect, but of a different variety. Right now, there are over 500,000 merchants using Shopify for an e-commerce presence. That sheer size attracts third-party app developers to make tools on Shopify's platform. Those tools attract even more merchants, setting up the same virtuous cycle.

Figures on the strength of this moat are hard to come by -- and if Shopify only benefited from the network effect, my nod would go to PayPal. But Shopify has another major advantage: high switching costs. Once a small business gets all of its back-office functions on a single interface, it would be costly -- in terms of money, downtime, headaches, and retraining of staff -- to migrate to a new platform.

Shopify only releases its monthly billings retention rate annually, but it has been above 100% for its entire life as a public company. That, plus the ability to catch small companies before they hit it big -- and rake in more revenue as those merchants grow -- gives Shopify the edge here.

Winner = Shopify

And my winner is...

So, there you have it: While I think Shopify's moat is stronger than PayPal's, I can't deny that the latter's war chest and valuation make it a better buy at today's prices. For me, this is a bit of a surprise. Shopify makes up 6% of my family's real-life holdings, while I own no PayPal at all.

This will give me motivation to consider adding shares in the future, which is something I believe you should do as well.