WASHINGTON (AP) — The leaders of both Canada and Mexico got on the phone with President Donald Trump this past week to seek solutions after he slapped tariffs on their countries, but China's president appears unlikely to make a similar call soon.

Beijing, which unlike America's close partners and neighbors has been locked in a trade and tech war with the U.S. for years, is taking a different approach to Trump in his second term, making it clear that any negotiations should be conducted on equal footing.

China's leaders say they are open to talks, but they also made preparations for the higher U.S. tariffs, which have risen 20% since Trump took office seven weeks ago. Intent on not being caught off guard as they were during Trump's first term, the Chinese were ready with retaliatory measures — imposing their own taxes this past week on key U.S. farm imports and more.

"As Washington escalates the tariff, Beijing doesn't see other options but to retaliate," said Sun Yun, director of the China program at the Stimson Center, a Washington-based think tank. "It doesn't mean Beijing doesn't want to negotiate, but it cannot be seen as begging for talks or mercy."

As the world's second-largest economy, China aspires to be a great power on both the regional and global stage, commanding respect from all countries, especially the United States, as proof that the Communist Party has made China prosperous and strong.

After the U.S. this past week imposed another 10% tariff, on top of the 10% imposed on Feb. 4, the Chinese foreign ministry uttered its sharpest retort yet: "If war is what the U.S. wants, be it a tariff war, a trade war or any other type of war, we're ready to fight till the end."

The harsh rhetoric echoed similar comments in 2018, when Trump launched his first trade war with China and it scrambled to line up tit-for-tat actions. Beijing's leaders have since developed a toolkit of tariffs, import curbs, export controls, sanctions, regulatory reviews and measures to limit companies from doing business in China.

All are designed to inflict pain on the U.S. economy and businesses in response to the American measures.

That allowed the Chinese government to react swiftly to Trump's recent across-the-board doubling of new tariffs on Chinese goods by rolling out a basket of retaliatory measures, including taxing many American farm goods at up to 15%, suspending U.S. lumber imports and blacklisting 15 U.S. companies.

Beijing showed restraint in its response to leave room for negotiation, analysts say.

Xi Jinping’s leadership of the ruling Communist Party spans both of Trump’s terms, giving Beijing more continuity in its planning. He is the one who decided it's not yet time to speak with Trump, said Daniel Russel, vice president for international security and diplomacy at the Asia Society Policy Institute.

“That’s not a scheduling issue, it’s leverage for China,” said Russel, who previously served as the assistant secretary of state for East Asian and Pacific Affairs. “Xi won’t walk into a call if there’s a chance he’ll be harassed or humiliated and for both political and strategic reasons, Xi won’t play the role of a supplicant.”

“Instead, China is hitting back promptly — but judiciously — to each set of tariffs,” Russel said.

At his annual press conference Friday, Chinese Foreign Minister Wang Yi said that "no country should fantasize that it can suppress, contain China while developing good relations with China."

“Such two-faced acts not only are bad for the stability of bilateral relations but also will not build mutual trust," Wang said. He added that China welcomes cooperation with the U.S., but noted that “if you keep pressuring, China will firmly retaliate.”

Scott Kennedy, a trustee chair in Chinese business and economics at the Washington-based Center for Strategic and International Studies, said the Chinese this time are “not psychologically shocked” by Trump’s “shock-and-awe” tactics.

“They’ve seen this before,” Kennedy said. “These are the kind of things that they’ve anticipated.”

China's economy has slowed but is still growing at nearly a 5% annual pace, and under Xi, the party is investing heavily in advanced technology, education and other areas. It has stronger trade ties with many other countries than during Trump's first term and has diversified where it gets key products, for example, buying most of its soybeans from Brazil and Argentina instead of the U.S.

In turn, the percentage of Chinese goods sold to the U.S. has fallen.

“They are better prepared to absorb the effect of the shocks, compared to several years ago,” Kennedy said.

Meanwhile, more than 80% of Mexico's exports go to the U.S., and Canada sends 75% of its exports here.

China has learned from its previous dealings with Trump, Russel said. Canadian Prime Minister Justin Trudeau and Mexican President Claudia Sheinbaum are facing a reversal of Trump’s previous trade policies, with tariffs imposed and then postponed twice on at least some goods.

“Beijing has seen enough to know that appeasing Trump doesn’t work," Russel said. In the first go-around, Trudeau and Sheinbaum "bought a little time, but the pressure only came roaring back stronger.”

Trudeau flew to Mar-a-Lago to meet Trump in December after the president-elect threatened tariffs. But in announcing retaliatory tariffs Tuesday, Trudeau sternly warned: "This is a time to hit back hard and to demonstrate that a fight with Canada will have no winners."

Sheinbaum also has said that “no one wins with this decision.”