When Amazon launched a funky membership program called Amazon Prime in 2005, Walmart boasted larger profits than Amazon had revenue. Fifteen years later, though, Prime is the key reason for Amazon’s dominance over Walmart in online sales.

That pressure has pushed the traditional retailer to burn tens of billions of dollars to fight back while its executives have cycled through various stages of reaction to Prime’s ascent: denial, followed by meek competition, followed by a reversal that seemed to signal Walmart wanted to stick to a free, no-membership strategy.

But Recode has learned that over the past 18 months, the world’s largest brick-and-mortar retailer has explored creating its own paid membership program that would include perks that Amazon can’t replicate, in part to avoid a direct comparison to Prime. Amazon now accounts for nearly 40 percent of all online retail sales in the US, according to eMarketer, and Prime is a huge reason why. Walmart is a distant No. 2 with only a little more than 5 percent of the US e-commerce market.

As soon as next month, Walmart plans to start publicly testing a membership program called Walmart+, according to sources. The program is expected to essentially launch as a rebrand of Walmart’s existing Delivery Unlimited service, which charges customers $98 a year for unlimited, same-day delivery of fresh groceries from one of the 1,600-plus Walmart stores in the US where the program is available. The company is also considering launching Walmart+ with a feature that would allow customers to use text messaging to place orders. Sources said that the amount of the Walmart+ fee could still change or the company might test multiple price points.

But the long-term vision for Walmart+ is for the program to add more perks, which could include discounts on prescription drugs at Walmart pharmacies and fuel at Walmart gas stations, as well as a Scan & Go service that would allow shoppers to check out in Walmart stores without waiting in line — a tool Walmart briefly tested but discontinued nearly two years ago.

Still, no additional perks beyond grocery delivery are set in stone, which has led some insiders to worry that the pressure to simply act might be supplanting a strong rollout plan and business case, according to sources. It’s unlikely that a $98 annual program built exclusively around grocery delivery would be enough to successfully compete with Amazon Prime. Those overseeing the program, however, believe that testing different perks and learning from those tests will benefit both customers and the business in the long term.

A Walmart spokesperson confirmed that a membership program called Walmart+ was in development but declined to provide other details.

The reality Walmart is facing is that Prime, which boasts more than 150 million members worldwide, has become a retail wrecking ball that’s impossible for competitors to ignore, even if they’re hard-pressed to truly compete with all it offers. Prime costs $119 a year in the US, and it comes with unlimited one-day shipping on more than 10 million products, same-day grocery deliveries from Whole Foods or Amazon Fresh, access to a large catalog of TV shows and movies available for online streaming, and more. Prime customers spend more and shop more frequently than Amazon’s non-Prime shoppers.

Even with its huge lead over all US competitors, Amazon isn’t satisfied, pushing into prescription drugs in 2018 with the acquisition of the online pharmacy PillPack, and developing multiple grocery store concepts beyond Whole Foods. Earlier this week, Amazon opened a new, high-tech supermarket that allows shoppers to pluck fresh foods like fruits, vegetables, and meat off of shelves, walk right out, and get automatically charged for the merchandise afterward.

In recent years, Amazon has also made moves for Prime to appeal to households with less disposable income that historically have favored shopping at Walmart. Amazon added a monthly payment option for Prime fees in 2016, a 45 percent Prime fee discount for those on government assistance in 2017, and ways for Prime customers to pay for orders with cash. Today, more than half of Walmart’s top-spending families are Amazon Prime members, according to sources. While Walmart’s overall grocery business is larger than Amazon’s, one fear is that top Walmart customers could eventually turn to Amazon for groceries as they get sucked further into the Prime suite of perks.

This state of affairs, in which even an industry titan like Walmart has struggled to combat Amazon’s e-commerce offensive, highlights the power Amazon has amassed that has made it a target of a broader congressional investigation of Big Tech and a separate probe by the Federal Trade Commission. Recode reported last year that the FTC was exploring the question of whether Prime’s bundling of various features allows Amazon to unfairly undercut competitive services.

At Walmart, the Walmart+ initiative is a top priority for Janey Whiteside, the company’s chief customer officer who joined from American Express in 2018, according to sources. Other top Walmart leaders, including CEO Doug McMillon, have played an active role in planning. The goal for the program is to eventually save Walmart customers both time and money, and presumably to encourage them to keep spending heavily with the brick-and-mortar giant. Executives believe the program needs to strike a balance of being valuable enough that customers will pay for it, while different enough from Amazon Prime that it doesn’t promote a direct comparison that would likely be impossible for Walmart to win.

Perks like prescription drug and fuel discounts could provide an edge, since they are frequent purchases and Amazon doesn’t own gas stations or its own brick-and-mortar pharmacies. (Amazon does own the online pharmacy PillPack, though its current target customer is someone who regularly takes multiple medications versus one-off patients.) The Walmart+ rollout also comes with a belief that top-spending Walmart families that subscribe to Amazon Prime will still be attracted to Walmart+ because its fresh grocery prices are often lower than those Amazon offers.

In the past, some Walmart executives have opposed a paid membership program, seeing Walmart’s competitive advantage as giving shoppers everyday low prices without the need to splurge on a membership fee. Some feared a program would look tame in comparison to Prime, which had a decade head start.

One of the first big moves Marc Lore made as US e-commerce chief following Walmart’s acquisition of his startup Jet.com in late 2016, was to ax a new Walmart membership that offered unlimited two-day shipping on a much smaller selection of goods than Amazon Prime’s catalog, but at half the price. Lore said at the time that two-day shipping had become “table stakes” — a consumer expectation single-handedly created by Amazon Prime.

Last year, Walmart followed up Amazon’s announcement that Prime would soon offer 10 million products for one-day delivery with a free, one-day delivery promise of its own for orders of $35 or more — no membership fee required. But Walmart’s one-day selection is about 1/50th of the size of Amazon’s.

Over the past few years, Walmart has also worked to build on its huge grocery business, which accounts for more than half of its store sales. The company is the US grocery leader when it comes to an order-online, pickup-at-store service, which is still the main driver of Walmart’s e-commerce growth. But last year Walmart also unveiled the $98-a-year Grocery Unlimited service that’s being rebranded as Walmart+, as Amazon ramped up its own grocery delivery services, and other competitors like Instacart and Shipt helped make the behavior more popular.

Same-day grocery delivery, however, is expensive. Grocery store profit margins are traditionally small to begin with, before even paying for the labor to pick orders and then deliver them. Walmart executives have said that having workers pick both grocery delivery and pickup orders from stores close to customers helps keep costs down. Walmart has also started testing robots that can pick out groceries, which it hopes will someday improve the economics even more.

In a best-case scenario, Walmart executives hope Walmart+ will lead customers to pay for more products and services with better profit margins, potentially helping to bring down losses in Walmart’s e-commerce business — a stress point that previously caused friction between leaders in Walmart’s store business and e-commerce business. Walmart executives said at a recent investor event that US e-commerce losses will be flat or slightly down from last year’s numbers.

From the time Walmart spent $3 billion to acquire Jet.com in 2016, executives have stressed both internally and externally that the traditional retailer has built-in advantages over Amazon. Walmart+ is the time to prove it.