We investigate how capacity payments in combination with scarcity pricing of energy can ensure resource adequacy in electricity markets, defined as the ability of supply and other resources to provide enough energy and capacity to meet demand under steady-state operating conditions. This work generalizes models for determining capacity payments by deriving second-best discriminatory payments by resource type that account not only for the “missing money” market failure that arises from energy price caps, but also for market power in the capacity market and differences in risk tolerance among resource types that can arise from failures in risk and capital markets. A bi-level equilibrium-constrained optimization model is proposed to define second-best capacity payments in a static long-run setting, considering the impacts of those payments on the mix and cost of generation investment and energy outputs. The lower-level suppliers play a Nash game to determine the generation mix under a capacity payment scheme, while the upper-level regulator considers consumer welfare and resource adequacy. We introduce an equivalent formulation via a variational inequality approach, and find conditions for the solution to exist. Discriminatory payments are found to be second-best when there are market power in the investment game, price caps in energy markets and imperfections in risk markets that lead to diverse risk attitudes.