We study physician agency and optimal payment policy in the context of an expensive medication used in dialysis care. Using Medicare claims data we estimate a structural model of treatment decisions, in which physicians differ in their altruism and marginal costs, and this heterogeneity is unobservable to the government. In a novel application of nonlinear pricing methods, we theoretically characterize the optimal unrestricted contract in this screening environment with multidimensional heterogeneity. We combine these results with the estimated model to construct the optimal contract and simulate counterfactual outcomes. The optimal contract is a flexible fee-for-service contract, which pays for reported treatments but uses variable marginal payments instead of constant reimbursement rates, resulting in substantial health improvements and reductions in costs. Our structural approach also yields important qualitative findings, such as rejecting the optimality of any linear contract, and may be employed more broadly to analyze a variety of applications.