Digital payments company PayPal Holdings (PYPL 2.90%) has been around for a while. It was a public company for a brief moment in 2002, a few years after its 1998 founding, in the early days of the internet. Then online marketplace operator eBay snapped it up and held it until it was spun off as a public company in 2015.

Had you bought shares then, a $10,000 investment would be worth more than $15,000 today, for more than a 50% gained over eight years. While you didn't lose money, the S&P 500 would have turned that into $24,000. In other words, PayPal has underperformed the broader market.

Is now the time to give up on PayPal? I don't think so. In fact, now could be the best time to buy shares since the company's 2015 arrival on Wall Street.

Here's why.

PayPal's fall from grace

Cash and plastic payment cards were the standard for paying for things before PayPal helped change the game. The company operates a digital payments network, which helps move money between merchants and banks. PayPal's network lets you move money worldwide, offering services for 25 currencies in more than 200 countries.

If you heard that a stock was down more than 80% from its high, and you might assume it was never good. However, PayPal was a market-beater for years. Its fall from grace is only a recent phenomenon of the past 18 months or so.

So what turned Wall Street against the stock? It wasn't one thing, but several. First, PayPal's operating performance has significantly tailed off. Revenue growth has slowed from 30% to mid-single percentage digits, and free cash flow (as a percentage of revenue) swung from more than 24% to negative.

PYPL Revenue (Quarterly YoY Growth) Chart

Data source: YCharts

Additionally, the company's former Chief Executive Officer Dan Schulman announced earlier this year he was stepping down after leading the company since it split from eBay. This is a lot of uncertainty in an industry that's also ruthlessly competitive; PayPal has many rivals, ranging from fintech companies like Block to entrenched payment networks like Visa and Mastercard.  Understandably, a steep drop in performance and leadership uncertainty might shake investor confidence.

Addressing the concerns

Fortunately, much of what's ailed the stock could soon improve. For starters, PayPal's slowing revenue growth could reasonably be attributed to lower consumer sentiment. In other words, consumers are not as optimistic about the economy and might be pulling back on spending. You can see that PayPal's revenue growth follows a path similar to consumer sentiment, at least until recently.

US Index of Consumer Sentiment Chart

Data source: YCharts

It's important to note that PayPal's slowdown is not due to losing users. It has 431 million users, up slightly from a year ago. As long as users stay engaged, PayPal's revenue should grow as consumers spend more over time. It's just that growth may speed up or slow down depending on how healthy consumer spending is.

The long-term chart tells a good story:

PYPL Revenue (TTM) Chart

Data source: YCharts

Next, PayPal has taken steps to cut costs and focus on profits. Its non-transaction operating expenses declined 11% year-over-year in Q2. PayPal also signed an agreement earlier this year to sell its European buy now, pay later loans instead of holding them to maturity, freeing up PayPal to originate more loans and boost cash flow.

Lastly, PayPal's new CEO, Alex Chriss, recently joined the company. He was hired from Intuit and potentially represents stable leadership for the company.

Why buy the stock today?

The case for buying PayPal stock boils down to this. Sentiment has pushed the stock to a bargain-like valuation. Consider that the shares trade at a forward price-to-earnings (P/E) ratio of a littler more than 10. Yet analysts expect the business to increase earnings by an average of 17% annually over the next several years. How? Likely via what was discussed above -- continued revenue growth, lower expenses, and rebounding cash flow.

The stock's PEG ratio is less than 0.7, indicating an attractively valued stock when considering the company's expected earnings growth. The risk for investors is that the company's earnings growth doesn't meet analysts' expectations. However, at a PEG ratio under 0.7, the stock is so cheap compared to its expected growth that investors arguably have a margin of safety. That means the company could fall a bit short of expectations and still have a shot at solid investment returns.

It may not happen overnight, but PayPal's planting the seeds for a future turnaround. If those seeds sprout, you could be glad you scooped up the shares before the rest of Wall Street noticed.