Credit card fraudulent transactions are causing businesses and banks to lose time and money. Detecting fraudulent transactions before a transaction is finalized will help businesses and banks to save resources. This research aims to compare the fraud detection accuracy of different sampling techniques and classification algorithms. An efficient method of detecting fraud using machine learning is proposed. Anonymized data set from Kaggle was used for detecting fraudulent transactions. Each transaction has been labeled as either a fraudulent transaction or not. The severe imbalance between fraud and non-fraudulent data caused the algorithms to under-perform. This was addressed with the application of sampling techniques. The combination of undersampling and SMOTE raised the recall accuracy of the classification algorithm. k-NN algorithm showed the highest recall accuracy compared to the other algorithms.