In early 2018 it was announced that China had sold Pakistan a very high-tech ballistic missile tracking and monitoring system. China had never exported this system before and the price Pakistan paid was not mentioned. That was probably because the payment wasn’t in cash (which probably wasn’t involved at all) but in loyalty and other favors. This tracking and monitoring system probably comes with Chinese personnel to operate it and ensure the tech secrets are not passed onto someone else. This gear may technically be on “permanent loan” to Pakistan as sensitive tech like this is often not exported (by the U.S., Russia or other nations that have developed it).
This particular incident also made it clear that Pakistan isn’t an ally of China, as historically China has not had allies. Pakistan is more of a client state of China. Pakistan and China have little in common when it comes to culture or history. At the same time, China historically either had enemies or client states that were dependent on Chinese goodwill and patronage. For most of Chinese history, the Chinese attitude was that foreigners had nothing China needed. China was self-sufficient, so there was no room for trade. Some was tolerated but it was not encouraged. China was never an ally of Russia, which is perceived more as a potential enemy as well as someone who is illegally occupying Chinese territory (most of far eastern Russia). China and Russia do not publicize this aspect of their relationship but it is no secret in either country. Pakistan surrendered what little of its territory China claimed and sought to be on good terms with China, at whatever cost.
Pakistan needs China and never the other way around. After all democratic Pakistan is run by its military and intelligence services, which use Islamic terrorists to attack its neighbors. China has employed such tactics in the past but has since moved on to more sophisticated methods. At the same time, the Pakistani use of Islamic terrorists is of some interest to China. These domesticated Islamic terror groups are potentially dangerous to the Pakistani military and the military lets their pet Islamic terrorists understand that this risk is well understood by the generals and that any “protected” Islamic terror group that decides to forget that will be eliminated and the survivors constantly hunted. China played a role in that because one reason for the massive 2014 crackdown on hostile (to Pakistan) or potentially hostile Islamic terrorists was the need to placate China. The Chinese were investing billions of dollars in building new roads, ports, pipelines and much else in Pakistan. For that to continue China told the Pakistanis that any Islamic terrorist violence against these projects or the Chinese personnel in Pakistan to ensure everything was built on time and according to spec would result in Pakistan losing the support of China. Pakistan could not afford that. China was not only the major supplier of weapons to Pakistan but also the only major power ally Pakistan had. In short, Pakistan needed China more than the other way around.
Because of this relationship, China uses Pakistan as a test subject for new technology. The new Chinese GPS (Beidou) has two signals; the public one and the much more precise military one. The only nation outside China with access to the military Beidou is Pakistan, which is where China built the first Beidou ground control stations outside China. Pakistan is also the first foreign customer for Chinese stealth aircraft. Pakistan has not got the skills to be partners in developing these high-tech items, but Pakistan (or at least the Pakistani military) is considered dependent enough on Chinese goodwill to provide security. Pakistan is often the first customer for new types of warships China is exporting. If there are any problems with these ships, and that is normal, China will quietly fix things and the Pakistanis will ensure their media does not make an issue of the problem.
Pakistan is willing to do all this because the patronage of China gives Pakistan more leverage against Iran and India and some protection from American threats. At the same time, there is little danger of China seeking to take control of Pakistan because that is not how China operates. China does not like trying to rule and absorb large alien populations. It has enough problems with less than ten million Turkic Uighurs and would not want to deal with over 160,000 more Moslems. But China does have the economic clout to demand certain things from Pakistan and Pakistan find providing that level of security to Chinese investments and personnel a useful exercise in counter-terrorism. This also makes Pakistan one of the few South Asian nations that take comfort in rising Chinese military and economic power in the region.