An analytical structure to endogenize the optimal gestational surrogacy contract in terms of a simple moral hazard framework is provided . Altruistic surrogacy is optimal only if the surrogate has lower outside option and is sufficiently altruistic. Otherwise commercial surrogacy is optimal. We also show that for lower outside option greater social ignominy makes the surrogacy contract relatively more altruistic but the reverse happens when the surrogate has higher outside option. Alternative model specifications are provided and a case is provided where commercial surrogacy is always optimal irrespective of altruism, outside option and social ignominy.