If you are using a credit card federal law provides very specific and broad anti fraud protections. Essentially, you are generally only liable for the first $50 of fraudulant charges. On top of that most banks and card issuers offer additional security protections bringing your liability to $0.
You do not have to pay fraudulant charges, and you will not be charged interet or penalties for disputed charges after you notify your card issuer until the issue is resolved. Most banks will even raise your credit limit the same amount of the charge while the investigation is ongoing to prevent any inconvenience to you.
DO NOT USE A DEBIT CARD for online purchases, while the laws for credit cards are very clear, debit cards are a little more murky, many banks and card issuers offer similar protections to credit cards but their obligation by law is much less. Furthermore, many banks will not refund the disputed charge to your checking account while they investigate it. Meaning, unlike a credit card you are without that money until the investigation is resolved, which could be several months