Refunds are not normally processed ‘live’ - instead, they’re processed during the merchant’s overnight processing as part of the settlement process. Your money will typically go back on your card in a day or two.
However by contrast, a purchase will typically cause the retailer’s point-of-sale equipment to talk live to obtain an authorisation from your card issuer for the amount of the purchase, and it’s this authorisation that allows to send you the notification that you’ve made a purchase. During the overnight processing that follows the retailer will typically begin the settlement of the transaction - this can take a couple of days. As you may have guessed, the authorisation virtually guarantees the retailer of their money as it’ll be declined if there’s insufficient funds in the account, the card has been reported as lost or stolen, or is being used by a type of merchant that it’s been excluded (see the FAQ).