A refund for a returned item will not usually post to your credit card account instantly. It generally takes several business days, and maybe up to a week, before a refunded purchase will appear on your credit card ledger and affect your card balance.
Generally, when a refund is processed for a returned item within the same credit card billing cycle, you won’t be held responsible to make a payment on that specific charge.
If you were to return a purchase near or after the end of your billing cycle, the refund for the transaction might not show on your account before your next credit card payment is due.