Dynamic pricing offers the potential to increase revenues. At the same time, it creates an incentive for customers to strategize over the timing of their purchases. A firm should ideally account for this behavior when making its pricing and stocking decisions. In particular, we investigate whether it is optimal for a firm to create rationing risk by deliberately understocking products. Then, the resulting threat of shortages creates an incentive for customers to purchase early at higher prices. But when does such a strategy make sense? If it is profitable to create shortages, what is the optimal amount of rationing risk to create? We develop a stylized model to study this problem. In our model, customers have heterogeneous valuations for the firm's product and face declining prices over two periods. Customers are assumed to have identical risk preferences and know the price path and fill rate in each period. Via its capacity choice, the firm is able to control the fill rate and, hence, the rationing risk faced by customers. Customers behave strategically and weigh the payoff of immediate purchases against the expected payoff of delaying their purchases. We analyze the capacity choice that maximizes the firm’s profits. First, we consider a monopoly market and characterize conditions under which rationing is optimal. We examine how the optimal amount of rationing is affected by the magnitude of price changes over time and the degree of risk aversion among customers. We then analyze an oligopoly version of the model and show that competition reduces the firms’ ability to profit from rationing. Indeed, there exists a critical number of firms beyond which a rationing equilibrium cannot be supported.