What country are you in? The new cartridge may have a marking like -Z10. What is the marking? Check the markings on the cartridge you removed as well as the other cartridges in the printer - are they the same Z number?
On the front panel of the printer go to the home screen and press the ink droplet icon at the top of the screen. Next touch the black rectangle. At this point a new window will open that says "installed cartridge" and "Supported cartridge". What are the cartridge numbers listed?
HP introduced regionalized cartridges (Z10, Z20, Z30 and Z40) for the previously universal 950/951 cartridges in about January 2017. The printer will "lock" itself to the first Zxx cartridge installed in the printer. If you are in the US/Canada you will need Z10 cartridges, but the printer may have been locked to another region by accident. In that case you will need to have HP perform a "Regionalization Reset". You will need to Contact HP to request a "Regionalization Reset". There should not be any charge for this, it is covered as part of the cartridge warranty. You will need to have access to your computer and printer while on the line with HP. You will also need to have a set of cartridges for the new region, once the reset is complete cartridges from the original region will no longer work. HP's web page on the subject is here.
The regionalization reset is covered by cartridge warranty, see the document here for information. To get warranty coverage you will need to go to the Contact HP page, then enter the information for your printer. At this point it will likely say "Manufacturer's warranty has expired" To the right of this it will say "See details". Click the "See details" link, which will open another page with more details. Near the bottom of the text will be a paragraph that says :
HP has checked your product information, including the product and serial numbers, to determine your warranty results.
The legal warranty expiration date is based on the date of purchase, as indicated on your receipt. If you feel these results are incorrect, you may submit a dispute for review. Dispute this >
Click on the "Dispute this" link which will ask for some additional contact information. Fill out the contact information, then in the bottom section select:
Dispute reason
Issue with my Accessories, Supplies and/or Software.
In the comment section indicate that you need a regionalization reset and the cartridges are in warranty.