Inc. agreed to buy the online pharmacy startup PillPack, jumping into the health care business with a deal that will give the retail giant an immediate nationwide drug network.


The move represents a formidable threat to pharmacy chains including Walgreens Boots Alliance Inc., which earlier Wednesday reported tepid U.S. same-store sales, and rival CVS Health Corp. Walgreens shares dropped roughly 10 percent, while CVS shed nearly 9 percent in premarket trading in New York.


Terms of the deal weren’t disclosed. The transaction is expected to close in the second half of 2018, according to a statement from the companies.

Importantly for Amazon, PillPack already has mail-order pharmacy licenses in all 50 U.S. states, which could enable Amazon to expand quickly into the broader mail-order pharmacy business. PillPack has relationships with most major drug-benefit managers, including Express Scripts CVS’s drug-benefit unit. The company also said it also works with most Medicare Part D drug plans. Those ties will give it links to much of the prescription drug market in the U.S.


PillPack, which is closely held, also has software that automates many routine pharmacy tasks, such as verifying when a refill is due, determining co-pays, and confirming insurance. That eliminates much of the manual work that pharmacists often are saddled with now.


The pact follows months of speculation about Amazon’s plans to get into the pharmacy or drug-distribution business. Despite the retailer’s vast reach, getting into prescription drugs presented a daunting logistical challenge in terms of licensing and dealing with a range of private and government payers. Acquiring PillPack’s networks helps Amazon surmount those hurdles.


Amazon has been disrupting businesses from electronics to household staples and even package delivery. Pharmacy and health benefits companies have long fretted that they’d be next. Chief Executive Officer Jeff Bezos signaled his interest in health care earlier this year when he teamed up with Berkshire Hathaway Inc.’s Warren Buffett and JPMorgan Chase & Co.’s Jamie Dimon to form a health care company to manage the health plans of their more than 1 million employees.

“When Amazon sneezes, everybody else catches a cold,” said Joseph Feldman, an analyst with Telsey Advisory. “And I think that that’s more likely than not what you’re going to see today.”‘


Prescription drugs sales are largely intertwined with groceries and personal items like makeup and shampoo and Amazon already sells bulk packs of latex gloves, bed pads and syringes. It recently began selling medical devices and instruments, as well.


Bezos been thinking about the drug business for nearly two decades; in 1999, Amazon purchased a stake in That effort ultimately failed and Walgreens purchased the money-losing startup in 2011.