They are often interchangeable. In a restaurant, I would say that both are acceptable, although «pedir» is more common. For an online order, I would say that only «encomendar» fits. The verb «pedir» requires an indirect object or the possibility of one. You can use «pedir» in a restaurant because the food is being requested of the waiter; on a website, this entity is not physically there. Therefore, «pedir» is "to ask for" or "to request," and «encomendar» is "to order."
I asked and word reference answered my own question which was, "What is the difference between pedir and perguntar which both mean 'to ask'?"
Use perguntar for "to inquire of", e.g.,
She asked me if I wanted dinner. Ela me perguntou se eu queria jantar.
And perguntar for "to request information about", e.g.,
He asked his father about jobs in the factory. Ele perguntou ao pai sobre empregos na fábrica. (Can also use indagar for this meanining)
But use pedir for "to seek to get with words", e.g.,
They asked their uncle for a loan. Eles pediram um empréstimo ao tio.
So pedir if you are asking for something tangible unlike a question or information.
Goodness, that is a mouthful (keyboardfull?). This is how I advise Portuguese learners. «perguntar» means "to ask," and «pedir» means "to ask for [something/someone]" or, more concisely, "to request." As for «indagar», its meaning is closer to "to inquire." Here is its definition: http://www.priberam.pt/dlpo/indagar.