Most of the time yes, the confirmation comes back within a few seconds, but not always, and which one you get depends on the hotel and on the supplier the room came from.
Most of the rooms you see in a search are what the trade calls instantly confirmed. The supplier already holds live allotment for that property, so when your customer pays, the booking is sent, accepted and a supplier reference comes back while they are still sitting on the page, and the voucher can go out right then. A smaller number of rooms are sold on request, which means the supplier has to go and ask the hotel before anything can be held. In that case the booking sits in a pending state, and the answer can take anywhere from a few minutes to the next working day, sometimes longer over a weekend or a public holiday.
What matters is that your portal makes the difference obvious before the money is taken, and that a pending booking shows up clearly in your booking list so nobody on your team assumes it is done. If the hotel comes back and declines, the booking is cancelled and the payment is released or refunded on your payment gateway's normal timing rather than instantly.
Ask your supplier which of their properties are on request, because it varies a lot by region and by the type of property, and make sure your staff know to hold the voucher back until a pending booking has actually been confirmed.