After a decade-plus of epic market outperformance, digital payment infrastructure companies Visa (V -0.23%) and Mastercard (MA 0.07%) had a middling 2023. Both companies provided shareholders with a total return (stock price plus dividends reinvested) on par with the S&P 500's 26% return.

These two tech giants are far from finished, though. After lapping a boom-bust cycle for digital payments during the pandemic, followed by a surge in interest rates from central banks fighting inflation (higher interest rates lower the present value of a stock), Visa and Mastercard could have another great decade ahead of them. This could be true even if a return to more sluggish economic growth is right around the corner.

Here's why Visa and Mastercard are great stocks to build a portfolio around in 2024 and beyond.

A reasonable value to start the new year?

First, let's talk valuation. Both Visa and Mastercard's earnings multiples have contracted in the last couple of years because of the aforementioned spike in interest rates from near-zero to now over 5%. As a result, Visa and Mastercard stocks haven't been this "cheap" in years.

V Price to Free Cash Flow Chart

Data by YCharts.

Cheapness is relative, though, because neither company is exactly a screaming value at this point. Clearly, investors expect modest revenue growth (high single digits to low teens on average) for years to come.

Is that a reasonable assumption? It could be. Digital payment infrastructure still has a head of steam behind it. In many areas of the globe, cash is still king. And in others where digital payments have made significant headway, it's impossible to track exactly how much cash is still being used to enact daily transactions between people and businesses.

In fact, according to Worldpay (a division of fellow payments technologist Fiserv), some 1.4 billion of the world's approximate 6 billion adult population still have no bank account at all -- most of them in emerging markets with young populations.

Suffice it to say, there's plenty of room for more digital payments expansion, especially in tandem with smartphones and app-based services (versus traditional cards issued by a bank). Add on Visa and Mastercard's steady investment in data security services and the like, and these two could indeed keep putting up the kind of steady growth numbers investors have come to expect, even if global economic growth continues to slow in the aftermath of the pandemic.

Why Visa and Mastercard are so powerful

But there's more to this story than just growth. As I wrote a few months ago, Visa in particular has been an exceptional business at generating above-average return on invested capital (ROIC) -- a way to measure the profit a company has generated from money it has invested in itself.

There's another way to view this ability to convert invested dollars into more cash: the amount of capital expenditures (spending on property and equipment) versus growth in net income and free cash flow. Again, you can see for every dollar Visa spends, it has generated far more than that in profit.

Visa's data centers and private communications network are top-notch and incredibly efficient. There's hope that Mastercard's smaller payments network can achieve a similar financial effect over time.

V Net Income (TTM) Chart

Data by YCharts.

Either way, both Visa and Mastercard have managed to increase their already incredibly high profit margins over the last decade -- and they're still rising. That gives these two financial technology leaders ample cash to invest, repurchase stock, and increase their dividends.

V Operating Margin (TTM) Chart

Data by YCharts.

Are Visa and Mastercard a buy for 2024?

Perhaps shares of Visa and Mastercard will dip at some point this year. Earnings reports that will include an outlook for calendar year 2024 will be delivered late in January, which tends to add a shot of volatility to stock prices.

But I don't expect much in the way of an operational surprise from these two leading tech giants. Visa and Mastercard are both great stocks to add to your core portfolio and hold for the very long term.