AbstractThis article provides a robust optimization formulation to tackle the demand uncertainty in the web service dynamic pricing problem where a provider offers a web service with different service levels (i.e., web service classes) to manage capacity and maximize profit. Consumers may buy their required web service through a reservation system and have the right with no obligation to cancel their purchases as long as they pay the penalty. In this article, we develop a robust optimization formulation for the model in which the demand of a service class is a linear function of the price; the total shared capacity of the provider for the web service is limited; the demand function coefficients and cancelation rate are time‐dependent. We demonstrate that the robust formulation is of the equivalent order of complexity as the nominal problem. Eventually, we obtain the optimality condition and some managerial insights into the problem according to the maximum principal and provide an algorithm to find the optimal pricing policy as a function of the time on a finite time horizon. Numerical analyses are performed to evaluate the effect of uncertainty on the objective function. Furthermore, the proposed algorithm is compared with some existing approaches. The preliminary results show that the proposed algorithm offers better results than other algorithms such as QCP, NLP, GA, and SA in terms of time and accuracy.