SEOUL—China has the two Koreas exactly where it wants them: as supplicants beseeching the ruler for mercy while it bestows gifts and goodwill on both of them.

North Korean leader Kim Jong Un played the ancient role of a Korean king kowtowing to the Chinese emperor by meeting Tuesday with President Xi Jinping, as required in the run-up to a possibly momentous summit with South Korea’s President Moon Jae-in next month. That get-together, at Panmunjom on the North-South line where the armistice ending the Korean War was signed in 1953, will be the prelude to the greatest summit of all when or if Kim meets President Trump in May.

Xi, who has spurned Kim’s previous pleas for a meeting as punishment for all those nuclear and missile tests, agreed to see him knowing this time he had Kim where he wanted him. In a massive exercise in face-saving, complete with a review of sword-bearing soldiers and a lavish dinner attended by both of their wives, Kim had to express his “willingness” to negotiate denuclearization.

By accepting Xi’s invitation to Beijing, as Victor Cha, a professor at Georgetown University who advised on Korea issues during the presidency of George W. Bush, observed, Kim was “saving face” while giving the “appearance of policy coordination.” In exchange for “kissing the ring” of the Chinese ruler, Kim could expect a “Chinese gift” even if it meant a “violation of sanctions” that China has endorsed in the U.N. Security Council.

The South Koreans, of course, were publicly delighted with this show of Chinese-North amity, even if they privately asked what kind of deal Xi and Kim had made—and what would Xi think if Moon betrayed reluctance to accept the “conditions” that Kim might attach to denuclearization. For that matter, Seoul officials also wondered how denuclearization might be defined—whether Xi had told Kim to shut down his nuclear program, including about 20 warheads estimated to have already been made, or merely stop upsetting everyone by testing them.

Formally, South Korea’s foreign ministry put out a statement welcoming Kim’s China adventure, which it said had actually begun Sunday, not Monday, as the world was led to believe from the sight in Beijing of the same armored train that had carried Kim’s father, Kim Jong Il to Beijing and other Chinese centers, including a trip shortly before he died nearly seven years ago. “The government hopes that the latest China visit by Chairman Kim,” said the statement, “will contribute to denuclearizing and building peace on the Korean Peninsula.”

The statement, though, was subtly laden with understatement and unstated implications. What incentive or gifts were the Chinese really giving Kim—and what would Xi do for Moon if he made a deal with Kim with which all sides could live?

Officials acknowledged that China still had not forgiven Moon for accepting the multibillion-dollar contraption known as THAAD for Theater High-Altitude Area Defense—an anti-missile battery implanted by U.S. Army soldiers last year about 160 miles south of Seoul. The Americans say THAAD is just the thing for shooting down high-flying North Korean missiles; the Chinese say it comes with powerful radar designed to spy on Chinese facilities.

If Moon puts on a display of cooperation with Kim, maybe agreeing upcoming war games with the Americans will be the last and asking the Americans to close some of their bases, will the Chinese stop bullying South Korea over THAAD? Koreans complain China is still not approving group tours for travel to South Korea, wiping out tens of millions of dollars in tourist revenue, even if Chinese can still visit individually.

Whatever the Chinese are telling Kim to say to Moon, the hard part comes when or if Kim meets Trump. By receiving Kim, feting him with all the trappings of a high-level state visit even though the official Chinese media said his visit was “unofficial,” Xi undercut any fantasies Trump’s incoming national-security adviser, the famously hawkish John Bolton, may have of telling Trump to stomp out if Kim sets “conditions” seen as “unacceptable.”

Bolton and Mike Pompeo, the tough-talking CIA director whom Trump has nominated to be secretary of State, will be in no position to consider such a dramatic response after Kim has met Moon.

Moon has just appointed advisers known for their dovish positions while serving the liberal administrations of Kim Dae-jung, the president who initiated the Sunshine policy of reconciliation while flying to Pyongyang for the first North-South Korean summit with Kim Jong Un’s father, Kim Jong Il, nearly 18 years ago. Moon himself, as chief of staff to Kim Dae-jung’s successor, Roh Moo-hyun, helped to set up the second such summit in October 2007. No way, say Koreans in and out of government, can Bolton get away with loose talk about a “preemptive strike” on the North’s nuclear and missile facilities if talks with Trump go nowhere.

“It’s meaningful that Kim stated his commitment to denuclearization in front of Xi,” said Cheong Seong-chang of the influential Sejong Institute, on Korea’s YTN cable news network. “It’s a thing that South Korea, the U.S., and China would welcome.”

The best “gift” that Xi could bestow on Kim would be to drop China’s support of U.N. sanctions, which China has until now supported in the U.N. Security Council after each of North Korea’s tests of nuclear warheads and the long-range missiles to carry them to targets in the U.S. Kim’s need for Chinese oil and other products is assumed to underlie the urgency if not desperation of his mission to Beijing.

Xi, by ordering the normal flow of oil on which North Korea’s economy depends and also resuming the import of North Korean coal, would achieve another goal. For the Chinese, revenge against Trump for tariff increases of as much as 45 percent takes priority over forcing Kim Jong Un to give up the nukes and missiles on which he’s staked his power and prestige before his own people as well as enemies he sees as ganging up against him.