Having forfeited China to Alibaba and JD.com, Jeff Bezos is determined to win in India, a market of 1.3 billion people who at long last are discovering the pleasures of shopping.Amazon.com Inc.’s chief has committed $5.5 billion to India and selected Amit Agarwal to spend it wisely. A trusted lieutenant who grew up in Mumbai and admires his boss and Bollywood star Amitabh Bachchan with near-equal fervor, Agarwal, 44, is furiously adapting Amazon to local conditions.The company has set up a credit operation for Indians without bank accounts, built a streamlined mobile app so it doesn’t crash the cheaper phones typically used by small-town Indians and loaded up the online store with tens of thousands of eclectic products—from the butter chicken instant curry paste favored in Punjab in the north to the traditional churan herbal digestives used for centuries in central India.So far it’s proving a tough slog. Almost five years after opening for business there, Amazon is spending billions fighting a ground war with local rivals like Bangalore-based Flipkart Online Services Pvt that know the terrain.India is not so much one nation as a bunch of little Indias, whose people, culture and language are nowhere near as homogeneous as America’s. Selling stuff online in the big cities is comparatively easy; not so the hinterland where people tend to be less tech-savvy, smartphones are just catching on, and web connections are slower.“In the West, buyers transitioned to online ordering after mail-order catalogs,” Agarwal says. “In India, we are building everything [from the] bottom up, and more than half our investments have gone into erecting delivery stations, warehouses and such.” Last year alone Amazon’s international losses ballooned to more than $3 billion, mostly because of heavy spending on logistics, digital payments infrastructure and warehousing in India.Agarwal—who moved back to the country in 2013 after almost 15 years at Amazon, mostly at the Seattle headquarters—spent the first couple of years proving that e-commerce is no longer just the prerogative of urban, English-speaking Indians. The company now has 150 million registered users who can shop for 160 million items offered by 300,000 sellers. “The rate of change is extraordinary,” Agarwal says.In a country without UPS-type services, Amazon has built its own delivery network—solving the so-called last mile challenge by deploying an army of deliverymen who cut through the chaotic traffic on scooters and motorbikes. Amazon has 41 fulfillment centers, mainly in the countryside, and created a program called I Have Space, which involves using 17,500 stores in 225 cities as mini warehouses.Even as it builds a logistics infrastructure, the company is educating people new to online shopping. Amazon has partnered with neighborhood shop owners, who show customers how the website works, help them compare products and prices and then order the merchandise to the store. (Shopkeepers are compensated in return.)“India is complex and it’s early days in e-commerce so online retailers cannot afford to ignore either physical or virtual infrastructure,” says Gautam Chhaochharia, India head of research at UBS Group AG.About half of Agarwal’s team is dedicated to adapting the company’s technology to local conditions. The slimmed-down version of the app, called Micron, eats less memory and automatically downloads if it senses a device is old or low-tech. Engineers figured out how to streamline the Prime video service without overly compromising quality. Amazon has also taught the Alexa digital assistant on Echo speakers to converse in the mashup of English and local tongues typically spoken in India. Agarwal believes searching for products using Alexa will eventually become commonplace.Payments are a big challenge for e-commerce companies in India, where credit cards are rare. Depending on their circumstances, shoppers can pay for purchases in multiple ways: cash on delivery, credit, interest-free installments. They can trade in old appliances or gadgets and get discounts on new ones. Amazon created a digital lending marketplace to extend credit for small sellers, at least those deemed low-risk by machine-learning algorithms.Last year the company obtained a license to operate the Amazon Pay digital wallet. In a global first, customers paying cash for an order can ask the delivery person to load money into the wallet; it’s a canny way of getting newbie e-shoppers accustomed to digital payments.Will Amazon’s efforts be enough to take on well-financed local rivals like Flipkart and Paytm, which are growing quickly and pouring money into marketing and logistics? “Rivals’ efforts only serve as reassurance that the opportunity is large,” Agarwal says. Quoting Bezos, he says it’s barely “Day One” in India. “We are here for the next 100 years.”