To answer your question directly: both by
and at
are viable options for setting someone's location.
at
would imply a very very close proximity to the bar (think, able to touch it)
by
would imply proximity, but could just be the general vicinity of it
In this particular case, I would choose at
since it's likely that they're physically quite close if they're talking to the bartender (barring yelling from several feet back).
However, there are a couple other things with your phrasing that bother me. I would likely word it:
When both of you are standing at the bar ordering a drink, and a bartender asks you to pay now or open a tab.
In particular
- your use of the "you're" contraction seems alien here. I think it's because
you
isn't the subject, but rather the object of the preposition of
.
- the verb
stand
should be standing
- I believe
asks to pay now
is incorrect (at the least, it sounds very odd). You could say asks if you want to pay now
or asks you to pay now
.