Yes, you can pay your credit card bill immediately after a purchase.
Most credit card issuers allow you to make payments online. This can be beneficial if you want to avoid interest charges altogether.