The chemical reactions and pathways involving nicotinamide-adenine dinucleotide phosphate, a coenzyme involved in many redox and biosynthetic reactions; metabolism may be of either the oxidized form, NADP, or the reduced form, NADPH.