Every car carries a paint code, and people reasonably assume that code produces a match. It gets you close, and then several other things decide whether the repair is invisible.
Why the code is not enough
Manufacturers produce variants of the same code across plants and production runs, so one code may have several formulations. Paint also changes on the car: ultraviolet light, washing and time shift the color gradually, so a five year old panel is not the shade it left the factory. And metallic and pearl finishes change appearance with viewing angle, which no formula can fully predict.
What a shop actually does
Reads the code, selects the likely variant, then sprays a test panel and compares it against the car in proper light before committing. On difficult colors, particularly silvers, pearl whites and reds, the test panel is the difference between a match and a near miss.
Blending
Rather than painting only the new panel, the color is carried gradually into the adjacent panels so the eye never meets a hard edge. This is why a repair to one door may involve refinish time on the fender or the rear quarter, and it is the normal, correct method rather than an inflated estimate. See blending panels explained.
How to judge the result
Look outdoors, in daylight, from several angles rather than straight on. Metallic mismatches reveal themselves at an angle. Check the color where the repaired panel meets the original, and look at texture as well as color, since the finish should have the same orange peel as the rest of the car.
Three-stage finishes
Some pearls and candy colors are built in three layers and are genuinely harder. They take longer and cost more, and any shop that tells you otherwise has not done many.